AESUtility

open class AESUtility

Utility to work with symmetric AES encryption. Relies on CryptoSwift.

  • Bytes of the key to use, 32 by default.

    Declaration

    Swift

    open var keySize = 32
  • NSData representation of the symmetric key.

    Declaration

    Swift

    open var symmetricKeyData: Data
  • Designated initializer. Creates a random symmetric key if none is provided.

    Declaration

    Swift

    public init(key: [UInt8]? = nil)
  • Encrypt given data with the current symmetricKey and an IV parameter of all-zeroes.

    Declaration

    Swift

    open func encrypt(data: Data) throws -> Data

    Parameters

    data

    The data to encrypt using the receiver’s symmetric key

    Return Value

    Encryped data representation

  • Decrypt given data with the current symmetricKey and an IV parameter of all-zeroes.

    Declaration

    Swift

    open func decrypt(encData: Data) throws -> Data

    Parameters

    encData

    Encrypted data to decrypt using the receiver’s symmetric key

    Return Value

    Decrypted data