How to get the public key from a certificate in the iPhone program?

Now I have a certificate that includes the public key, I want to get the public key from it in the programming of the iPhone SDK and encrypt the RSA string with the public key. What should I do?

+3
source share
1 answer
SecKeyRef publicKeyReference = NULL;
NSMutableDictionary* queryPublicKey;

SecItemCopyMatching((CFDictionaryRef)queryPublicKey, (CFTypeRef *)&publicKeyReference);

publicKeyReference is your public key representation; queryPublicKey is your certificate submission; SecItemCopyMatching is a function that allows you to get the public key from a certificate!

-1
source

Source: https://habr.com/ru/post/1708064/


All Articles