@@ -16,17 +16,10 @@ import Crypto
1616import CryptoBoringWrapper
1717import SwiftASN1
1818
19- #if CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
20- @available ( macOS 10 . 15 , iOS 13 , watchOS 6 , tvOS 13 , macCatalyst 13 , visionOS 1 . 0 , * )
21- fileprivate typealias BackingPublicKey = SecurityRSAPublicKey
22- @available ( macOS 10 . 15 , iOS 13 , watchOS 6 , tvOS 13 , macCatalyst 13 , visionOS 1 . 0 , * )
23- fileprivate typealias BackingPrivateKey = SecurityRSAPrivateKey
24- #else
2519@available ( macOS 10 . 15 , iOS 13 , watchOS 6 , tvOS 13 , macCatalyst 13 , visionOS 1 . 0 , * )
2620fileprivate typealias BackingPublicKey = BoringSSLRSAPublicKey
2721@available ( macOS 10 . 15 , iOS 13 , watchOS 6 , tvOS 13 , macCatalyst 13 , visionOS 1 . 0 , * )
2822fileprivate typealias BackingPrivateKey = BoringSSLRSAPrivateKey
29- #endif
3023
3124/// Types associated with the RSA algorithm
3225///
@@ -120,14 +113,8 @@ extension _RSA.Signing {
120113 }
121114
122115 /// Construct an RSA public key with the specified parameters.
123- ///
124- /// Only the BoringSSL backend provides APIs to create a key from its parameters so we first create a BoringSSL
125- /// key, and then pass it to the platform-specific initializer that accepts a BoringSSL key.
126- ///
127- /// On Darwin platforms, this will serialize it to PEM format, and then construct a platform-specific key from
128- /// the PEM representation.
129116 public init ( n: some ContiguousBytes , e: some ContiguousBytes ) throws {
130- self . backing = try BackingPublicKey ( BoringSSLRSAPublicKey ( n: n, e: e) )
117+ self . backing = try BackingPublicKey ( n: n, e: e)
131118 }
132119
133120 public var pkcs1DERRepresentation : Data {
@@ -218,14 +205,8 @@ extension _RSA.Signing {
218205 }
219206
220207 /// Construct an RSA private key with the specified parameters.
221- ///
222- /// Only the BoringSSL backend provides APIs to create a key from its parameters so we first create a BoringSSL
223- /// key, and then pass it to the platform-specific initializer that accepts a BoringSSL key.
224- ///
225- /// On Darwin platforms, this will serialize it to DER format, and then construct a platform-specific key from
226- /// the DER representation.
227208 public init ( n: some ContiguousBytes , e: some ContiguousBytes , d: some ContiguousBytes , p: some ContiguousBytes , q: some ContiguousBytes ) throws {
228- self . backing = try BackingPrivateKey ( BoringSSLRSAPrivateKey ( n: n, e: e, d: d, p: p, q: q) )
209+ self . backing = try BackingPrivateKey ( n: n, e: e, d: d, p: p, q: q)
229210 }
230211
231212 /// Randomly generate a new RSA private key of a given size.
@@ -546,14 +527,8 @@ extension _RSA.Encryption {
546527 }
547528
548529 /// Construct an RSA public key with the specified parameters.
549- ///
550- /// Only the BoringSSL backend provides APIs to create a key from its parameters so we first create a BoringSSL
551- /// key, and then pass it to the platform-specific initializer that accepts a BoringSSL key.
552- ///
553- /// On Darwin platforms, this will serialize it to DER format, and then construct a platform-specific key from
554- /// the DER representation.
555530 public init ( n: some ContiguousBytes , e: some ContiguousBytes ) throws {
556- self . backing = try BackingPublicKey ( BoringSSLRSAPublicKey ( n: n, e: e) )
531+ self . backing = try BackingPublicKey ( n: n, e: e)
557532 }
558533
559534 public var pkcs1DERRepresentation : Data { self . backing. pkcs1DERRepresentation }
@@ -614,14 +589,8 @@ extension _RSA.Encryption {
614589
615590
616591 /// Construct an RSA private key with the specified parameters.
617- ///
618- /// Only the BoringSSL backend provides APIs to create a key from its parameters so we first create a BoringSSL
619- /// key, and then pass it to the platform-specific initializer that accepts a BoringSSL key.
620- ///
621- /// On Darwin platforms, this will serialize it to PEM format, and then construct a platform-specific key from
622- /// the PEM representation.
623592 public init ( n: some ContiguousBytes , e: some ContiguousBytes , d: some ContiguousBytes , p: some ContiguousBytes , q: some ContiguousBytes ) throws {
624- self . backing = try BackingPrivateKey ( BoringSSLRSAPrivateKey ( n: n, e: e, d: d, p: p, q: q) )
593+ self . backing = try BackingPrivateKey ( n: n, e: e, d: d, p: p, q: q)
625594 }
626595
627596 /// Randomly generate a new RSA private key of a given size.
0 commit comments