SecKeyGetBlockSize (persistPeer); provoca un mal acceso

SecKeyGetBlockSize (persistPeer); provoca un mal acceso. No he trabajado con esto antes, así que no estoy seguro de qué causaría este error.

NSData* peerTag = [@"Test PublicKey" dataUsingEncoding:NSUTF8StringEncoding]; NSDictionary * peerPublicKeyAttr = [NSDictionary dictionaryWithObjectsAndKeys: (__bridge id)kSecClassKey, kSecClass, (__bridge id)kSecAttrKeyTypeRSA, kSecAttrKeyType, (__bridge id)kSecAttrKeyClassPublic, kSecAttrKeyClass, peerTag, kSecAttrApplicationTag, testPubKey, kSecValueData, kCFBooleanTrue, kSecReturnPersistentRef, nil]; OSStatus sanityCheck = noErr; sanityCheck = SecItemDelete((__bridge CFDictionaryRef) peerPublicKeyAttr); SecKeyRef persistPeer = NULL; sanityCheck = SecItemAdd((__bridge CFDictionaryRef)peerPublicKeyAttr, (CFTypeRef *)&persistPeer); NSData* passwordData = [@"password" dataUsingEncoding:NSUTF8StringEncoding]; NSData* encryptedPass = [[Methods shanetworkingCenter]encrypt:passwordData usingKey:persistPeer]; size_t cipherBufferSize = SecKeyGetBlockSize(persistPeer);