cryptography_plus library
Cryptographic algorithms for Dart / Flutter developers.
Main algorithm types
- Cipher for encrypting and decrypting
- KeyExchangeAlgorithm for key exchange
- KdfAlgorithm for key derivation
- HashAlgorithm for hashing
- MacAlgorithm for message authentication
- SignatureAlgorithm for signing and verifying
Factory methods
Cryptography contains factory methods for cryptographic algorithms.
Classes
- AesCbc
- AES-CBC (cipher block chaining mode) Cipher.
- AesCtr
- AES-CTR (counter mode) Cipher.
- AesGcm
- AES-GCM (Galois/Counter Mode) Cipher.
- Argon2id
- Argon2id (RFC 9106) memory-hard password hashing function.
- Blake2b
- BLAKE2B (RFC 7693), which can be used both as HashAlgorithm and MacAlgorithm.
- Blake2s
- BLAKE2S (RFC 7693), which can be used both as HashAlgorithm and MacAlgorithm.
- BrowserCryptography
- An implementation of Cryptography that uses Web Cryptography API for better performance in browsers.
- Chacha20
- ChaCha20 (RFC 7539) StreamingCipher.
- Cipher
- A cipher that supports encrypt() and decrypt().
- CipherState
- A state of Cipher, which helps you to encrypt or decrypt data that does not fit in memory.
- CipherWand
- An opaque object that possesses some non-extractable secret key.
- Cryptography
- A factory for cryptographic algorithms.
- Ecdh
- ECDH with P-256 / P-384 / P-521 elliptic curve.
- Ecdsa
- ECDSA with P-256 / P-384 / P-521 elliptic curve.
- EcKeyPair
- An opaque reference to P-256 / P-384 / P-521 key pair.
- EcKeyPairData
- P-256 / P-384 / P-521 key pair.
- EcPublicKey
- Public key of P-256 / P-384 / P-521 key pair.
- Ed25519
- Ed25519 (RFC 8032) signature algorithm.
- Hash
- A digest calculated with some HashAlgorithm.
- HashAlgorithm
- A hash algorithm that produces a Hash.
- HashSink
- A sink for calculating Hash for long sequences.
- Hchacha20
- Hchacha20 (draft-irtf-cfrg-xchacha) key derivation algorithm.
- Hkdf
- HKDF (RFC 5869) key derivation algorithm.
- Hmac
- HMAC, a widely used MacAlgorithm.
- KdfAlgorithm
- Abstract superclass for Key Derivation Algorithms (KDFs).
- KeyExchangeAlgorithm
- Abstract superclass for key exchange algorithms.
- KeyExchangeWand
- An opaque object that has some key pair and support for sharedSecretKey.
- KeyPair
- A key pair composed of a private key (KeyPairData) and PublicKey.
- KeyPairData
- Extracted data of a KeyPair.
-
KeyPairType<
S extends KeyPairData, P extends PublicKey> - Static information about a key pair type.
- Mac
- A Message Authentication Code (MAC). Usually obtained from some MacAlgorithm.
- MacAlgorithm
- A Message Authentication Code (MAC) algorithm.
- MacSink
- A sink for calculating a Mac.
- PaddingAlgorithm
- Padding algorithm for block ciphers.
- Pbkdf2
- PBKDF2 password hashing algorithm implemented in pure Dart.
- Poly1305
- Poly1305 (RFC 7539) MacAlgorithm.
- PublicKey
- A public key of some KeyPair.
- RsaKeyPair
- Opaque reference to RSA key pair.
- RsaKeyPairData
- RSA private key.
- RsaPss
- RSA-PSS SignatureAlgorithm.
- RsaPublicKey
- RSA public key.
- RsaSsaPkcs1v15
- RSA-SSA-PKCS1v15 SignatureAlgorithm.
- SecretBox
- Output of encrypting bytes with a Cipher.
- SecretKey
- An opaque reference to a secret sequence of bytes used for encryption and message authentication.
- SecretKeyData
- A SecretKey that is stored in memory.
- SecureRandom
- An abstract base class for reasonably secure Random implementations.
- SensitiveBytes
- List of security-sensitive bytes that can be destroyed with destroy.
- Sha1
- SHA-1 HashAlgorithm.
- Sha224
- SHA-224 (SHA2-224) HashAlgorithm.
- Sha256
- SHA-256 (SHA2-256) HashAlgorithm.
- Sha384
- SHA-384 (SHA2-384) HashAlgorithm.
- Sha512
- SHA-512 HashAlgorithm (sometimes called SHA2-512).
- Signature
- A digital signature by some SignatureAlgorithm.
-
SignatureAlgorithm<
T extends PublicKey> - An digital signature algorithm that supports newKeyPair(), sign(), verify().
- SignatureWand
- An opaque object that has some key pair and support for sign.
- SimpleKeyPair
- An opaque KeyPair that is made of two simple byte sequences.
- SimpleKeyPairData
- An in-memory SimpleKeyPair that is made of two simple byte sequences.
- SimplePublicKey
- A PublicKey that is a sequence of bytes.
- StreamingCipher
- Superclass of streaming ciphers such as AesGcm and Chacha20 that allow encrypter/decrypter to choose an offset in the keystream.
- Wand
- Superclass of SignatureWand, KeyExchangeWand, and CipherWand.
- X25519
- X25519 (RFC 7748) KeyExchangeAlgorithm.
- Xchacha20
- Xchacha20 (draft-irtf-cfrg-xchacha). cipher.
Exceptions / Errors
- SecretBoxAuthenticationError
- Error thrown by Cipher.decrypt when SecretBox has incorrect Mac.
- SecretBoxPaddingError
- Thrown by Cipher if invalid padding is found during SecretBox decryption.