DecryptorV3
public final class DecryptorV3: VersionedDecryptorType
Format version 3 decryptor. This is required in order to decrypt
using keys (since key configuration is version-specific). For password
decryption, Decryptor
is generally preferred, and will call this
if appropriate.
-
Creates and returns a decryptor.
Declaration
Swift
public init(password: String)
Parameters
password
Non-empty password string. This will be interpretted as UTF-8.
-
Creates and returns a decryptor using keys.
Declaration
Swift
public init(encryptionKey: Data, hmacKey: Data)
Parameters
encryptionKey
AES-256 key. Must be exactly FormatV3.keySize (kCCKeySizeAES256, 32 bytes)
hmacKey
HMAC key. Must be exactly FormatV3.keySize (kCCKeySizeAES256, 32 bytes)
-
Decrypt data using password and return decrypted data. Throws if password is incorrect or ciphertext is in the wrong format.
Throws
throwsError
Declaration
Swift
public func decrypt(data: Data) throws -> Data
-
Updates cryptor with data and returns encrypted data.
Declaration
Swift
public func update(withData data: Data) throws -> Data
Parameters
data
Data to process. May be empty.
Return Value
Processed data. May be empty.
-
Returns trailing data and invalidates the cryptor.
Declaration
Swift
public func finalData() throws -> Data
Return Value
Trailing data