]> git.saurik.com Git - apple/security.git/blobdiff - keychain/SecKeyPriv.h
Security-58286.60.28.tar.gz
[apple/security.git] / keychain / SecKeyPriv.h
index 6ec03618862a7058cf172d3536725c63814ba110..77bfcb5b668f4716597a94ca52ec39936cebef12 100644 (file)
 #include <Security/SecAsn1Types.h>
 #include <CoreFoundation/CFRuntime.h>
 
-#if SEC_OS_IOS
-#include <CoreFoundation/CoreFoundation.h>
-#include <CoreFoundation/CFDictionary.h>
-#endif
-
 #if SEC_OS_OSX
 #include <Security/SecKey.h>
 #include <Security/x509defs.h>
@@ -240,6 +235,14 @@ struct __SecKey {
 };
 #endif
 
+/* Create a public key from a CFData containing a SubjectPublicKeyInfo in DER format. */
+SecKeyRef SecKeyCreateFromSubjectPublicKeyInfoData(CFAllocatorRef allocator,
+                                                   CFDataRef subjectPublicKeyInfoData);
+
+/* Crete a SubjectPublicKeyInfo in DER format from a SecKey */
+CFDataRef SecKeyCopySubjectPublicKeyInfo(SecKeyRef key);
+
+
 #if SEC_OS_IPHONE
 /*!
     @function SecKeyCreate
@@ -260,36 +263,34 @@ SecKeyRef SecKeyCreatePublicFromDER(CFAllocatorRef allocator,
     const SecAsn1Oid *oid1, const SecAsn1Item *params,
     const SecAsn1Item *keyData);
 
-/* Create a public key from a CFData containing a SubjectPublicKeyInfo in DER format. */
-SecKeyRef SecKeyCreateFromSubjectPublicKeyInfoData(CFAllocatorRef allocator,
-    CFDataRef subjectPublicKeyInfoData);
-
 /* Create public key from private key */
 SecKeyRef SecKeyCreatePublicFromPrivate(SecKeyRef privateKey);
+#endif // SEC_OS_IPHONE
 
 /* Get Private Key (if present) by publicKey. */
 SecKeyRef SecKeyCopyMatchingPrivateKey(SecKeyRef publicKey, CFErrorRef *error);
-OSStatus SecKeyGetMatchingPrivateKeyStatus(SecKeyRef publicKey, CFErrorRef *error);
 
+OSStatus SecKeyGetMatchingPrivateKeyStatus(SecKeyRef publicKey, CFErrorRef *error);
 CFDataRef SecKeyCreatePersistentRefToMatchingPrivateKey(SecKeyRef publicKey, CFErrorRef *error);
 
 /* Return an attribute dictionary used to find a private key by public key hash */
 CFDictionaryRef CreatePrivateKeyMatchingQuery(SecKeyRef publicKey, bool returnPersistentRef);
 
-/* Return an attribute dictionary used to store this item in a keychain. */
-CFDictionaryRef SecKeyCopyAttributeDictionary(SecKeyRef key);
-
 /* Return a key from an attribute dictionary that was used to store this item
  in a keychain. */
+ in a keychain. */
 SecKeyRef SecKeyCreateFromAttributeDictionary(CFDictionaryRef refAttributes);
 
 OSStatus SecKeyDigestAndVerify(
-    SecKeyRef           key,            /* Public key */
-     const SecAsn1AlgId  *algId,         /* algorithm oid/params */
-     const uint8_t       *dataToDigest,     /* signature over this data */
-     size_t              dataToDigestLen,/* length of dataToDigest */
-     const uint8_t       *sig,               /* signature to verify */
-     size_t              sigLen);           /* length of sig */
+                               SecKeyRef           key,            /* Public key */
+                               const SecAsn1AlgId  *algId,         /* algorithm oid/params */
+                               const uint8_t       *dataToDigest,     /* signature over this data */
+                               size_t              dataToDigestLen,/* length of dataToDigest */
+                               const uint8_t       *sig,               /* signature to verify */
+                               size_t              sigLen);           /* length of sig */
+
+#if SEC_OS_IPHONE
+/* Return an attribute dictionary used to store this item in a keychain. */
+CFDictionaryRef SecKeyCopyAttributeDictionary(SecKeyRef key);
 
 OSStatus SecKeyDigestAndSign(
     SecKeyRef           key,            /* Private key */
@@ -385,6 +386,9 @@ typedef enum {
 size_t SecKeyGetSize(SecKeyRef key, SecKeySize whichSize)
 __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
 
+#endif
+
+#if SEC_OS_IPHONE
 
 /*!
  @function SecKeyLookupPersistentRef
@@ -395,6 +399,7 @@ __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0);
  */
 OSStatus SecKeyFindWithPersistentRef(CFDataRef persistentRef, SecKeyRef* lookedUpData)
 __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
+#endif // SEC_OS_IPHONE
 
 /*!
  @function SecKeyCopyPersistentRef
@@ -406,6 +411,7 @@ __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
 OSStatus SecKeyCopyPersistentRef(SecKeyRef key, CFDataRef* persistentRef)
 __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
 
+#if SEC_OS_IPHONE
 
 /*
  *
@@ -770,6 +776,9 @@ __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AV
 Boolean SecKeySetParameter(SecKeyRef key, CFStringRef name, CFPropertyListRef value, CFErrorRef *error)
 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
 
+extern const CFStringRef kSecKeyParameterSETokenAttestationNonce
+API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0));
+
 /*!
  @function SecKeyCreateDuplicate
  @abstract Creates duplicate fo the key.