]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_smime/lib/cmspubkey.c
Security-58286.260.20.tar.gz
[apple/security.git] / OSX / libsecurity_smime / lib / cmspubkey.c
index ea27d7cedcb424c68f75a9c1186bc99e655cb371..c4dc0eaa4f65397f10da3b3a2bbd4c0314698cd8 100644 (file)
  * according to PKCS#1 and RFC2633 (S/MIME)
  */
 OSStatus
-SecCmsUtilEncryptSymKeyRSA(PLArenaPool *poolp, SecCertificateRef cert,
+SecCmsUtilEncryptSymKeyRSA(PLArenaPool *poolp, SecCertificateRef cert, 
                               SecSymmetricKeyRef bulkkey,
                               CSSM_DATA_PTR encKey)
 {
-    SecPublicKeyRef publickey = SecCertificateCopyPublicKey_ios(cert);
+    OSStatus rv;
+    SecPublicKeyRef publickey = SecCertificateCopyKey(cert);
     if (publickey == NULL)
        return SECFailure;
 
-    OSStatus rv = SecCmsUtilEncryptSymKeyRSAPubKey(poolp, publickey, bulkkey, encKey);
+    rv = SecCmsUtilEncryptSymKeyRSAPubKey(poolp, publickey, bulkkey, encKey);
     CFRelease(publickey);
     return rv;
 }
@@ -92,15 +93,6 @@ SecCmsUtilEncryptSymKeyRSAPubKey(PLArenaPool *poolp,
     mark = PORT_ArenaMark(poolp);
     if (!mark)
        goto loser;
-
-#if 0
-    /* sanity check */
-    keyType = SECKEY_GetPublicKeyType(publickey);
-    PORT_Assert(keyType == rsaKey);
-    if (keyType != rsaKey) {
-       goto loser;
-    }
-#endif
     /* allocate memory for the encrypted key */
     theirKeyAttrs = SecKeyCopyAttributes(publickey);
     if (!theirKeyAttrs) {
@@ -779,11 +771,7 @@ SecCmsUtilEncryptSymKeyECDH(
     encKey->Length = 0;
 
     /* Copy the recipient's static public ECDH key */
-#if TARGET_OS_IPHONE
-    theirPubKey = SecCertificateCopyPublicKey(cert);
-#else
-    rv = SecCertificateCopyPublicKey(cert, &theirPubKey);
-#endif
+    theirPubKey = SecCertificateCopyKey(cert);
     if (rv || !theirPubKey) {
         dprintf("SecCmsUtilEncryptSymKeyECDH: failed to get public key from cert, %d\n", (int)rv);
         goto out;