Questions tagged [nssecurecoding]

Conforming to the NSSecureCoding protocol indicates that an object handles encoding and decoding instances of itself in a manner that is robust against object substitution attacks.

Conforming to the NSSecureCoding protocol indicates that an object handles encoding and decoding instances of itself in a manner that is robust against object substitution attacks.

Click Here for class reference.

48 questions
1
vote
0 answers

Does Core Data bypass security?

My iOS 13.2 Swift app is a type of SceneKit editor which uses Core Data to persist user edits. I'm wondering if Core Data might be associated with the message below since NSManagedObject is a subclass of NSObject and since a test app I created…
C. Outwin
  • 47
  • 1
  • 3
1
vote
1 answer

Secure coding of Set

My app uses core data, which stores instances of a custom class CustomClass. This class has a number of properties, most of them of standard types, but one property is xxx: Set. The xcdatamodeld thus specifies (among the others with…
Reinhard Männer
  • 14,022
  • 5
  • 54
  • 116
1
vote
1 answer

NSSecureCoding vs. Keychain

I understand using 'NSSecureCoding' one could securely store data to disk, similar to keychain as a place for safe storage of information. I understand also that keychain has the advantage of sharing between the applications for the same provider.…
Congruent Tech. UG
  • 1,408
  • 2
  • 12
  • 21
0
votes
0 answers

How can I conform NSSecureCoding in my Core Data entity class

I'm trying to use transformable with my entity class. But I had to do with some transformer? ValueTransformer in Core Data. I found some of them just making their own custom class, but for me I'm trying to use my Entity class generated by…
chan
  • 1
  • 1
0
votes
1 answer

Why is this subclass failing to be archived by NSKeyedArchived?

I have this class that have to be the subclass of OIDAuthState (this class is an NSObject and conforms to NSSecureCoding), The code to encode the class OIDAuthState was working fine before self.data = try NSKeyedArchiver.archivedData(withRootObject:…
Lucas
  • 746
  • 8
  • 23
0
votes
2 answers

Error unarchiving NSAttributedString on iOS13 with NSKeyedUnarchiver when NSTextAttachment is used

I archive an NSAttributedString, which contains an image with NSTextAttachment on iOS14 and noticed, that unarchiving it on iOS13 fail. On iOS14 the unarchive is successful. The error logged is this: Error decoding string object. error=Error…
Rainer Schwarze
  • 4,725
  • 1
  • 27
  • 49
0
votes
1 answer

NSSecureCoding returns nil for properly saved object

i am on macOS 10.15 (bigSUr), XCode 12, objective-c not ios. I have document based app. It has a simple object "SHGlobalAppData" (NSObject) that contains a property object of a custom class "SHSetupDataModel" (NSObject). When loading, initWithCoder…
Pat_Morita
  • 3,355
  • 3
  • 25
  • 36
0
votes
0 answers

NSSecureCoding VS saving id

i am on objective-c, macOS. I am currently rewriting an application to support NSSecureCoding Protocol. In some classes i have some properties like this @property id objectValue; These objects can be of very dynamic kind (NSString, custom object…
Pat_Morita
  • 3,355
  • 3
  • 25
  • 36
0
votes
0 answers

NSSecureUnarchiveFromDataTransformer.allowedTopLevelClasses no longer includes NSSet?

In the class header for NSSecureUnarchiveFromDataTransformer it is documented that NSSet is an allowed class. /// A value transformer which transforms values to and from \c NSData by archiving and unarchiving using secure…
trapper
  • 11,716
  • 7
  • 38
  • 82
0
votes
1 answer

Unarchive custom object with secure coding in iOS

I'm encoding an array of objects that conform to NSSecureCoding successfully like this. NSData *data = [NSKeyedArchiver archivedDataWithRootObject:array requiringSecureCoding:YES error:nil]; How do I unarchive this data? I'm trying like this but…
Berry Blue
  • 15,330
  • 18
  • 62
  • 113
0
votes
1 answer

Cast NSSecureCoding to URL in Swift

I have a ShareExtension in which I get the URL and I would like to use it but for that I need to cast it as a String: @objc func actionButtonTapped(){ print("yeet") var html: String? if let item =…
Chris
  • 1,828
  • 6
  • 40
  • 108
0
votes
1 answer

How to encode/decode [CKRecordZone.ID: CKServerChangeToken]?

public var zonesChangeToken: [CKRecordZone.ID: CKServerChangeToken]? { get { if(backingPreviousZonesChangeToken == nil) { guard let defaults: UserDefaults = UserDefaults(suiteName: CloudKitHandler.APP_GROUP_ID)…
erotsppa
  • 14,248
  • 33
  • 123
  • 181
0
votes
1 answer

iOS Swift How do you Secure Encode/Decode a TimeInterval for compatibility with NSSecureCoding?

I have a variable var pausedTime: TimeInterval? I want to encode & decode it with NSSecureCoding So far I have this for encoding: aCoder.encode(pausedTime, forKey: "Pause") and this for decoding, treating the TimeInterval as a Double: if…
Geoff H
  • 3,107
  • 1
  • 28
  • 53
0
votes
2 answers

Swift iOS SceneKit How do you secure encode an SCNMatrix4 with NSSecureCoding?

I'm trying to secure encode a SceneKit SCNMatrix4 so it conforms to NSSecureCoding with something akin to the following: if let transform = aDecoder.decodeObject(of: SCNMatrix4.self, forKey: DATA_KEY_TRANSFORM) { self.transform = transform …
Geoff H
  • 3,107
  • 1
  • 28
  • 53
0
votes
1 answer

`cannotDecodeObjectOfClassName` not invoked in `NSKeyedArchiverDelegate`

I am trying to catch the NSKeyedUnarchiver unarchiving exception NSInvalidUnarchiveOperationException where an unknown class is being decoded securely via NSSecureCoding protocol. The solution I am using is based on a related…
HuaTham
  • 7,486
  • 5
  • 31
  • 50