SBSDKAESEncrypter
@interface SBSDKAESEncrypter : NSObject <SBSDKStorageCrypting>
ScanbotSDKs default data encrypter. Provides AES128 and AES 256 encryption to your data.
-
The key used for encryption and decryption of the data. It is being derived from the given password, the salt and the iterations using the PBKDF2 function. https://en.wikipedia.org/wiki/PBKDF2
For decryption you can use this key directly or generate it using salt, password and the number of iterations. Readonly.
Declaration
Objective-C
@property (nonatomic, readonly) NSData *_Nonnull key;
Swift
var key: Data { get }
-
The salt data used to derive the encryption key from the password. A fixed value that may be needed for manual decryption key derivation on the backend side. Readonly.
Declaration
Objective-C
@property (nonatomic, readonly) NSData *_Nonnull salt;
Swift
var salt: Data { get }
-
The number of iterations used to derive the encryption key from the salt data and the password. A fixed value that may be needed for manual decryption key derivation on the backend side. Readonly.
Declaration
Objective-C
@property (nonatomic, readonly) NSUInteger iterations;
Swift
var iterations: UInt { get }
-
The encryption initialization vector. A fixed value that is needed for decryption on the backend side.
Declaration
Objective-C
@property (nonatomic, readonly) NSData *_Nonnull iv;
Swift
var iv: Data { get }
-
Not available.
Declaration
Objective-C
- (nonnull instancetype)init;
-
Not available.
Declaration
Objective-C
+ (nonnull instancetype)new;
-
Designated initializer. Creates a new AES encrypter/decrypter with either AES128 or AES256 encryption. The encryption/decryption key is derived from the password, the salt and the number of iterations using the PBKDF2 function. See https://en.wikipedia.org/wiki/PBKDF2
Declaration
Objective-C
- (nullable instancetype)initWithPassword:(nonnull NSString *)password mode:(SBSDKAESEncrypterMode)mode;
Swift
init?(password: String, mode: SBSDKAESEncrypterMode)
Parameters
password
The password phrase used to encrypt or decrypt the data. See notes in class info.
Return Value
The new encrypter object or nil if the encrypter could not be created due to an empty password.