ZTAES

Advanced Encryption Standard (ZTAES)

For testing purpose created a static instance called default which takes a key of 16 or 32 characters and an iv of 16 characters for Production try to create your own ZTAES object

var aes: ZTAES? = {
  var key128 = "1qaz2wsx3edc4rfv"
  let iv =  "5tgb6yhn7ujm8ikl"
  return ZTAES(key: key128, iv: iv)
}()
  • key

    Data representing key in utf8 format

  • iv

    Data representing iv in utf8 format

  • Advanced Encryption Standard, 128-bit block

  • Perform PKCS7 padding.

    Electronic code book mode, default is CBC.

  • Encrypt option

  • Decrypt option

  • Status where operation completed normally

  • Evaluate a status, with needed status

  • Error Class used for ZTAES errors.

  • Initialize an optional ZTAES object

    Can fail to initalize when key characters was not 16 chars or 32 cars, or initial vector iv was not 16 chars.

  • Encrypt raw data with kCCEncrypt option, returns encrypted data

  • Decrypt encrypted data with kCCDecrypt option, returns raw data

  • Crypt data whether Encrypted Data or Raw Data with kCCDecrypt or kCCEncrypt option and returns data based on requested option