aes_cbc_cipher 1.0.2+1 copy "aes_cbc_cipher: ^1.0.2+1" to clipboard
aes_cbc_cipher: ^1.0.2+1 copied to clipboard

The `AESCBCCipher` is a singleton class that provides AES encryption and decryption functionality using the `encrypt` package. It is used to encrypt and decrypt data using the AES (Advanced Encryption [...]

AESCBCCipher #

The AESCBCCipher is a singleton class that provides AES encryption and decryption functionality using the encrypt package. It is used to encrypt and decrypt data using the AES (Advanced Encryption Standard) algorithm in CBC (Cipher Block Chaining) mode.

Functions #

init #

Initializes the AESCBCCipher with a 32-byte key and a 16-byte initialization vector (IV). It takes the following parameters:

  • key (required): The 32-byte key to be used for encryption and decryption.
  • iv (required): The 16-byte initialization vector to be used for encryption and decryption.
  • padding (optional): The padding type to be used for encryption and decryption. The default is AESPaddingType.pkcs7.

encrypt #

Encrypts the given plaintext and returns the encrypted string in Base64 format. It takes the following parameters:

  • plainText: The string to be encrypted.
  • isTest (optional): A boolean flag indicating whether the encryption is for testing purposes. Default is false.

decrypt #

Decrypts the given encrypted text and returns the decrypted string. It takes the following parameters:

  • encryptedText: The string to be decrypted.
  • isTest (optional): A boolean flag indicating whether the decryption is for testing purposes. Default is false.

The decrypt function may throw the following exceptions:

  • FormatException: If the given encryptedText is not in Base64 format.
  • ArgumentException: If the given encryptedText is not in the correct format.
  • StateError: If the given encryptedText is not in the correct format.

Please note that the init function must be called before using the encrypt and decrypt functions. If the init function is not called, an assertion error will be thrown.

The AESCBCCipher class also has private functions that are used internally for testing and initialization purposes.

0
likes
140
pub points
69%
popularity

Publisher

unverified uploader

The `AESCBCCipher` is a singleton class that provides AES encryption and decryption functionality using the `encrypt` package. It is used to encrypt and decrypt data using the AES (Advanced Encryption Standard) algorithm in CBC (Cipher Block Chaining) mode.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

crypto, encrypt, tuple

More

Packages that depend on aes_cbc_cipher