Skip to content

[Collections] Signing (part 2): signed collections #3242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file added Fixtures/Collections/Signing/TestRootCA_rsa.cer
Binary file not shown.
Binary file added Fixtures/Collections/Signing/Test_ec.cer
Binary file not shown.
5 changes: 5 additions & 0 deletions Fixtures/Collections/Signing/Test_ec_key.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIKRNt0dFe1qbIFqyWbpU3dvrdzRqZ18BrQBhIoSzm8K2oAoGCCqGSM49
AwEHoUQDQgAE7TEGQSoJ6YWtocE3GTe/GEXgLayMdIGDe1OL66KLECP1CKm0BsJy
Cz5Ae+Rox51jc8zTUcniBXZRNhoP6+6AhQ==
-----END EC PRIVATE KEY-----
Binary file added Fixtures/Collections/Signing/Test_rsa.cer
Binary file not shown.
27 changes: 27 additions & 0 deletions Fixtures/Collections/Signing/Test_rsa_key.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAtFFRh3JRc3PEWmjJ6iygXdSyIeIrNYgVYQPU9t5QwrFQvWSE
IvLaxmKWY9cHOacYJaOgfK2LKuod72K0xFOKX00Ww9Pt6mileP9SKpCkwcT8WN4Z
BLH1dhUqWt32ZZnay0TDs9XT8JQM8vwZrQ2+TlOvVTJdmU8GQzeponj4iNRvoc6Q
g3CvBtADhJHfKW+TGFfDQf284NQEs/95DRual90yeu/E46uY18PGU2jlhJdyugAy
+dK+bBTvZrg0AGylGGZJEQeqP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JgSSbPP7Uf8N586IAVd5h3erXJoMZF4ZhFRTypvlnC3gO62ep
KxV2yQKBgF5nM2fs31xPsHN3Q/iGiQQQG//PIUttCl47XcUnxoabgebIq+lp5UmQ
ArYcBO4+cBZSbNjmUdUOSyM8fAUrWmy4QyvZXNy15V7W6qVzxfa0hT8T6tFUVmKG
qseI/cG+CoygHw9OqBcffl1d8LVAHmF8mkfzJ2CnQs9CLFxS1+f9
-----END RSA PRIVATE KEY-----
20 changes: 14 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,21 @@ let package = Package(
dependencies: ["SwiftToolsSupport-auto", "Basics", "PackageLoading", "PackageModel", "SourceControl"]),

// MARK: Package Collections

.target(
/** Data structures and support for package collections */
name: "PackageCollections",
dependencies: ["SwiftToolsSupport-auto", "Basics", "PackageModel", "SourceControl", "PackageCollectionsModel"]),

.target(
/** Package collections models */
name: "PackageCollectionsModel",
dependencies: []),

.target(
/** Data structures and support for package collections */
name: "PackageCollections",
dependencies: ["SwiftToolsSupport-auto", "Basics", "PackageModel", "SourceControl", "PackageCollectionsModel", "Crypto"]),
/** Package collections signing */
name: "PackageCollectionsSigning",
dependencies: ["PackageCollectionsModel", "Crypto"]),

// MARK: Package Manager Functionality

Expand Down Expand Up @@ -262,12 +267,15 @@ let package = Package(
.testTarget(
name: "PackageGraphPerformanceTests",
dependencies: ["PackageGraph", "SPMTestSupport"]),
.testTarget(
name: "PackageCollectionsTests",
dependencies: ["PackageCollections", "SPMTestSupport"]),
.testTarget(
name: "PackageCollectionsModelTests",
dependencies: ["PackageCollectionsModel"]),
.testTarget(
name: "PackageCollectionsTests",
dependencies: ["SPMTestSupport", "PackageCollections"]),
name: "PackageCollectionsSigningTests",
dependencies: ["PackageCollectionsSigning", "SPMTestSupport"]),
.testTarget(
name: "SourceControlTests",
dependencies: ["SourceControl", "SPMTestSupport"]),
Expand Down
3 changes: 2 additions & 1 deletion Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
Expand All @@ -12,6 +12,7 @@ add_subdirectory(Commands)
add_subdirectory(LLBuildManifest)
add_subdirectory(PackageCollections)
add_subdirectory(PackageCollectionsModel)
add_subdirectory(PackageCollectionsSigning)
add_subdirectory(PackageDescription)
add_subdirectory(PackageGraph)
add_subdirectory(PackageLoading)
Expand Down
4 changes: 0 additions & 4 deletions Sources/PackageCollections/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,11 @@ target_link_libraries(PackageCollections PUBLIC
TSCBasic
TSCUtility
Basics
Crypto
CCryptoBoringSSL
PackageModel
SourceControl)
# NOTE(compnerd) workaround for CMake not setting up include flags yet
set_target_properties(PackageCollections PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
target_link_options(PackageCollections PRIVATE
"$<$<PLATFORM_ID:Darwin>:SHELL:-Xlinker -framework -Xlinker Security>")

if(USE_CMAKE_INSTALL)
install(TARGETS PackageCollections
Expand Down

This file was deleted.

53 changes: 53 additions & 0 deletions Sources/PackageCollectionsSigning/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2021 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for Swift project authors

add_library(PackageCollectionsSigning
Certificate/Certificate.swift
Certificate/CertificatePolicy.swift
Key/ASN1/ASN1.swift
Key/ASN1/ASN1Error.swift
Key/ASN1/PEMDocument.swift
Key/ASN1/SEC1PrivateKey.swift
Key/ASN1/SubjectPublicKeyInfo.swift
Key/ASN1/Types/ASN1BitString.swift
Key/ASN1/Types/ASN1Identifier.swift
Key/ASN1/Types/ASN1Integer.swift
Key/ASN1/Types/ASN1ObjectIdentifier.swift
Key/ASN1/Types/ASN1OctetString.swift
Key/BoringSSLKey.swift
Key/Key.swift
Key/Key+EC.swift
Key/Key+RSA.swift
PackageCollectionSigning.swift
Signing/BoringSSLSigning.swift
Signing/Signature.swift
Signing/Signing.swift
Signing/Signing+ECKey.swift
Signing/Signing+RSAKey.swift
Utilities/Base64URL.swift
Utilities/Utilities.swift)
target_link_libraries(PackageCollectionsSigning PUBLIC
PackageCollectionsModel
$<$<NOT:$<PLATFORM_ID:Darwin>>:dispatch>
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>)
target_link_libraries(PackageCollectionsSigning PRIVATE
Crypto
CCryptoBoringSSL)
# NOTE(compnerd) workaround for CMake not setting up include flags yet
set_target_properties(PackageCollectionsSigning PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
target_link_options(PackageCollectionsSigning PRIVATE
"$<$<PLATFORM_ID:Darwin>:SHELL:-Xlinker -framework -Xlinker Security>")

if(USE_CMAKE_INSTALL)
install(TARGETS PackageCollectionsSigning
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
endif()
set_property(GLOBAL APPEND PROPERTY SwiftPM_EXPORTS PackageCollectionsSigning)
Loading