2
2
//
3
3
// This source file is part of the SwiftCertificates open source project
4
4
//
5
- // Copyright (c) 2022-2023 Apple Inc. and the SwiftCertificates project authors
5
+ // Copyright (c) 2022 Apple Inc. and the SwiftCertificates project authors
6
6
// Licensed under Apache License v2.0
7
7
//
8
8
// See LICENSE.txt for license information
@@ -63,7 +63,7 @@ extension Certificate {
63
63
self . backing = . rsa( rsa)
64
64
}
65
65
66
- #if INCLUDE_SECURE_ENCLAVE_SUPPORT
66
+ #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
67
67
/// Construct a private key wrapping a SecureEnclave.P256 private key.
68
68
/// - Parameter secureEnclaveP256: The SecureEnclave.P256 private key to wrap.
69
69
@inlinable
@@ -87,7 +87,7 @@ extension Certificate {
87
87
case . rsa( let rsa) :
88
88
let padding = try _RSA. Signing. Padding ( forSignatureAlgorithm: signatureAlgorithm)
89
89
return try rsa. signature ( for: bytes, digestAlgorithm: digestAlgorithm, padding: padding)
90
- #if INCLUDE_SECURE_ENCLAVE_SUPPORT
90
+ #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
91
91
case . secureEnclaveP256( let secureEnclaveP256) :
92
92
return try secureEnclaveP256. signature ( for: bytes, digestAlgorithm: digestAlgorithm)
93
93
#endif
@@ -107,7 +107,7 @@ extension Certificate {
107
107
return PublicKey ( p521. publicKey)
108
108
case . rsa( let rsa) :
109
109
return PublicKey ( rsa. publicKey)
110
- #if INCLUDE_SECURE_ENCLAVE_SUPPORT
110
+ #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
111
111
case . secureEnclaveP256( let secureEnclaveP256) :
112
112
return PublicKey ( secureEnclaveP256. publicKey)
113
113
#endif
@@ -125,7 +125,7 @@ extension Certificate {
125
125
if !algorithm. isRSA {
126
126
throw CertificateError . unsupportedSignatureAlgorithm ( reason: " Cannot use \( algorithm) with RSA key \( self ) " )
127
127
}
128
- #if INCLUDE_SECURE_ENCLAVE_SUPPORT
128
+ #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
129
129
case . secureEnclaveP256:
130
130
if !algorithm. isECDSA {
131
131
throw CertificateError . unsupportedSignatureAlgorithm ( reason: " Cannot use \( algorithm) with ECDSA key \( self ) " )
@@ -154,7 +154,7 @@ extension Certificate.PrivateKey {
154
154
case p384( Crypto . P384 . Signing . PrivateKey )
155
155
case p521( Crypto . P521 . Signing . PrivateKey )
156
156
case rsa( _CryptoExtras . _RSA . Signing . PrivateKey )
157
- #if INCLUDE_SECURE_ENCLAVE_SUPPORT
157
+ #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
158
158
case secureEnclaveP256( SecureEnclave . P256 . Signing . PrivateKey )
159
159
#endif
160
160
@@ -169,7 +169,7 @@ extension Certificate.PrivateKey {
169
169
return l. rawRepresentation == r. rawRepresentation
170
170
case ( . rsa( let l) , . rsa( let r) ) :
171
171
return l. derRepresentation == r. derRepresentation
172
- #if INCLUDE_SECURE_ENCLAVE_SUPPORT
172
+ #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
173
173
case ( . secureEnclaveP256( let l) , . secureEnclaveP256( let r) ) :
174
174
return l. dataRepresentation == r. dataRepresentation
175
175
#endif
@@ -193,7 +193,7 @@ extension Certificate.PrivateKey {
193
193
case . rsa( let digest) :
194
194
hasher. combine ( 3 )
195
195
hasher. combine ( digest. derRepresentation)
196
- #if INCLUDE_SECURE_ENCLAVE_SUPPORT
196
+ #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
197
197
case . secureEnclaveP256( let digest) :
198
198
hasher. combine ( 4 )
199
199
hasher. combine ( digest. dataRepresentation)
0 commit comments