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. If one would ignore the keychain share feature, would one be able to say, it is equally safe to store data in keychain in comparison to NSSecureCoding ?
I have a user object
class User: NSObject, NSSecureCoding {
private enum CodingKeys: String, CodingKey {
case test
}
public static var supportsSecureCoding: Bool {
return true
}
override init() {}
var test: String = "teeees"
func encode(with aCoder: NSCoder) {
aCoder.encode(self.test as NSString)
}
required init?(coder aDecoder: NSCoder) {
test = aDecoder.decodeObject(of: NSString.self, forKey: CodingKeys.test.rawValue)! as String
}
}
which I archive
let user = User()
let data = NSKeyedArchiver.archivedData(withRootObject: user)
try! data.write(to: DocumentHelper.cashURLForID(id: "TTYYUU"))
the content of TTYYUU is:
6270 6c69 7374 3030 d401 0203 0405 0615 1658 2476 6572 7369 6f6e 5824 6f62 6a65 6374 7359 2461 7263 6869 7665 7254 2474 6f70 1200 0186 a0a4 0708 0d0e 5524 6e75 6c6c d209 0a0b 0c52 2430 5624 636c 6173 7380 0280 0356 7465 6565 6573 d20f 1011 125a 2463 6c61 7373 6e61 6d65 5824 636c 6173 7365 735f 1011 5365 6375 7265 436f 6469 6e67 2e55 7365 72a2 1314 5f10 1153 6563 7572 6543 6f64 696e 672e 5573 6572 584e 534f 626a 6563 745f 100f 4e53 4b65 7965 6441 7263 6869 7665 72d1 1718 5472 6f6f 7480 0108 111a 232d 3237 3c42 474a 5153 555c 616c 7589 8ca0 a9bb bec3 0000 0000 0000 0101 0000 0000 0000 0019 0000 0000 0000 0000 0000 0000 0000 00c5
Could someone show the way to decode the raw information, it says the format is 'NSPropertyList Binary Format_v1_0', could one show how to extract 'teeees' from this binary?