DecryptorV3

public final class DecryptorV3: NSObject, 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.

    • parameters:
      • encryptionKey: AES-256 key. Must be exactly FormatV3.keySize (kCCKeySizeAES256, 32 bytes)
      • hmacKey: HMAC key. Must be exactly FormatV3.keySize (kCCKeySizeAES256, 32 bytes)

    Declaration

    Swift

    public init(encryptionKey: NSData, hmacKey: NSData)

    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 Error

    Declaration

    Swift

    public func decryptData(data: NSData) throws -> NSData
  • Updates cryptor with data and returns encrypted data.

    Declaration

    Swift

    public func updateWithData(data: NSData) throws -> NSData

    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 -> NSData

    Return Value

    Trailing data