1
votes

I am trying to use this function to retrieve public key from a certificate.

@import Security
SecCertificateCopyPublicKey (SecCertificateRef certificate, SecKeyRef *key)

Note- The above code is just a snippet. I am using Xcode Version 6.2 (6C131e) and iOS SDK 8.2. SecCertificateCopyPublicKey function seems to be not available in iOS SDK 8.2. Only the below functions are available in iOS 8.2 SDK on SecCertificate.... Could someone clarify on the availability of SecCertificateCopyPublicKey function in the iOS SDK?

enter image description here

1

1 Answers

0
votes

I can't find it either in the sdks headers but it is in the docs .. and there is no indication it was removed

You can try defining it yourself at the beginning of your m file so the compiler can see it (the header just tells it it is there - it doesn't really 'do' anything)

that way you can use it

at the same time I'd file a bug for that


works on IOS 8.2

//forward define it
//IF it doesnt exist, you get an error but if it exists you can use it!
OSStatus SecCertificateCopyPublicKey ( SecCertificateRef certificate, SecKeyRef *key );

//my class
@implementation M42Defaults 

- (id)initWithURL:(NSURL *)url {
    self = [super init];
    if(self) {
        //use it
        OSStatus s = SecCertificateCopyPublicKey(nil, nil);
        //...
    }
    return self;
}