【发布时间】:2013-03-23 15:04:01
【问题描述】:
我正在尝试使用此示例 https://developer.apple.com/library/mac/documentation/security/conceptual/CertKeyTrustProgGuide/iPhone_Tasks/iPhone_Tasks.html#//apple_ref/doc/uid/TP40001358-CH208-SW9 来创建公钥/私钥并在加密一些数据之后。
SecKeyRef publicKey = NULL; // 3
NSData * publicTag = [NSData dataWithBytes:publicKeyIdentifier length:strlen((const char *)publicKeyIdentifier)]; // 4 NSMutableDictionary *queryPublicKey = [[NSMutableDictionary alloc] init]; // 5 [queryPublicKey setObject:(id)kSecClassKey forKey:(id)kSecClass]; [queryPublicKey setObject:publicTag forKey:(id)kSecAttrApplicationTag]; [queryPublicKey setObject:(id)kSecAttrKeyTypeRSA forKey:(id)kSecAttrKeyType]; [queryPublicKey setObject:[NSNumber numberWithBool:YES] forKey:(id)kSecReturnRef]; // 6 status = SecItemCopyMatching ((CFDictionaryRef)queryPublicKey, (CFTypeRef *)&publicKey); // 7
在 iOS 上,这可以正常工作。
在 OSX 中,当我调用 SecItemCopyMatching (7) 时,我得到了这个。它是 Apple 提供的示例。我不知道出了什么问题,在 OSX 上查询的某些属性可能需要不同吗?
谢谢
[NSConcreteData _fastCharacterContents]:无法识别的选择器发送到 实例 0x1005440f0
【问题讨论】:
标签: objective-c macos cocoa encryption