Printing SecKeyRef reference using NSLog in Objective-C

醉酒当歌 提交于 2019-12-24 16:44:15

问题


I am retrieving public key from a certificate with the following code.

- (SecKeyRef) extractPublicKeyFromCertificate: (SecIdentityRef) identity {
    // Get the certificate from the identity.
    SecCertificateRef myReturnedCertificate = NULL;
    OSStatus status = SecIdentityCopyCertificate (identity,
                                              &myReturnedCertificate);

    if (status) {
        NSLog(@"SecIdentityCopyCertificate failed.\n");
        return NULL;
    }

    SecKeyRef publickey;

    SecCertificateCopyPublicKey(myReturnedCertificate, &publickey);
    NSLog(@"%@", publickey);   

    return publickey;
}

I am trying to print the "publickey" variable to see the contents. I am getting runtime error. I would like to know how to print the contents of the "publickey" variable?

来源:https://stackoverflow.com/questions/29285904/printing-seckeyref-reference-using-nslog-in-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!