Posts

Post not yet marked as solved
0 Replies
114 Views
According to my experiments SwiftData does not work with model attributes of primitive type UInt64. More precisely, it crashes in the getter of a UInt64 attribute invoked on an object fetched from the data store. With Core Data persistent UInt64 attributes are not a problem. Does anyone know whether SwiftData will ever support UInt64?
Posted
by rx8.
Last updated
.
Post not yet marked as solved
4 Replies
728 Views
My little Swift program on macOS 12.3.1 creates a cryptographic key for a symmetric cipher as follows: let parameters = NSMutableDictionary() var raw = 256 let num = CFNumberCreate(kCFAllocatorDefault, .sInt32Type, &raw)! var optError: Unmanaged<CFError>? parameters.setValue("Pix Cipher", forKey: kSecAttrLabel as String) parameters.setValue(kSecAttrKeyTypeAES, forKey: kSecAttrKeyType as String) parameters.setValue(num, forKey: kSecAttrKeySizeInBits as String) parameters.setValue(kCFBooleanTrue, forKey: kSecAttrIsPermanent as String) parameters.setValue(kCFBooleanTrue, forKey: kSecAttrCanEncrypt as String) parameters.setValue(kCFBooleanTrue, forKey: kSecAttrCanDecrypt as String) key = SecKeyGenerateSymmetric(parameters, &optError) This key can be stored in the Key Chain and works fine for encryption and decryption. But when I want to export it using var error: Unmanaged<CFError>? let cfData = SecKeyCopyExternalRepresentation(key!, &error) , this fails, with error set to something like Error Domain=NSOSStatusErrorDomain Code=-4 "MacOS error: -4" What does "MacOS error: -4" mean? (kCFMessagePortTransportError/kCSIdentityDeletedErr /unimpErr?) Why does SecKeyCopyExternalRepresentation not work? What is wrong with the key? Kind regards, Jakob
Posted
by rx8.
Last updated
.