cryptography_flutter library

An optimized version of package:cryptography.

Classes

AesGcm
Optimized AES-GCM implementation for subclassing. For documentation, see aesGcm.
Chacha20Poly1305Aead
Optimized AEAD_CHACHA20_POLY1305 implementation for subclassing. For documentation, see chacha20Poly1305Aead.
Cipher
An authenticated or unauthenticated cipher. [...]
CipherWithAppendedMac
Combines an arbitrary Cipher with an arbitrary MacAlgorithm. [...]
EcJwkPrivateKey
An elliptic curve private key using JWK (RFC 7517: "JSON Web Key") storage format. [...]
EcJwkPublicKey
An elliptic curve public key using JWK (RFC 7517: "JSON Web Key") storage format. [...]
Hash
A hash of some message. [...]
HashAlgorithm
A hash algorithm that produces a Hash. [...]
HashSink
Enables calculation of Hash for inputs larger than fit in the memory. [...]
HChacha20
HChaCha20 (draft-irtf-cfrg-xchacha) key derivation algorithm. [...]
Hkdf
HKDF key derivation algorithm (RFC 5869). [...]
Hmac
HMAC ("hash-based message authentication code"). [...]
JwkPrivateKey
Superclass for public keys that use JWK (RFC 7517: "JSON Web Key") storage format. [...]
JwkPublicKey
Superclass for public keys that use JWK (RFC 7517: "JSON Web Key") storage format. [...]
KeyExchangeAlgorithm
Superclass for key exchange algorithms. [...]
KeyPair
A pair of keys (PrivateKey and a PublicKey). [...]
Mac
A Message Authentication Code (MAC). [...]
MacAlgorithm
A Message Authentication Code (MAC) algorithm. [...]
MacSink
A sink for calculating a Mac. [...]
Nonce
A nonce (sometimes known as Initialization Vector, IV or salt). [...]
Pbkdf2
PBKDF2 password hashing algorithm. PBKDF2 is recommended by NIST. [...]
PrivateKey
A private key of some KeyPair. [...]
PublicKey
A public key of some KeyPair. [...]
RsaJwkPrivateKey
An RSA private key that uses JWK (RFC 7517: "JSON Web Key") storage format. [...]
RsaJwkPublicKey
An RSA public key that uses JWK (RFC 7517: "JSON Web Key") storage format. [...]
RsaPss
RSA-PSS signature algorithm. Currently supported only in browsers. The hash algorithm must be sha256, sha384, or sha512. [...]
RsaSsaPkcs1v15
RSASSA-PKCS1-v1_5 signature algorithm. Currently supported only in browsers. The hash algorithm must be sha256, sha384, or sha512. [...]
SecretKey
A secret key. [...]
Signature
A digital signature made of bytes and publicKey. [...]
SignatureAlgorithm
An digital signature algorithm that supports newKeyPair, sign, verify. [...]

Constants

aesCbc → const Cipher
AES-CBC cipher ("cipher block chaining mode"). [...]
const _AesCbc()
aesCtr → const Cipher
AES-CTR cipher ("counter mode"). [...]
const _AesCtr()
aesGcm → const Cipher
Optimized AES-GCM implementation. [...]
const AesGcm()
blake2b → const HashAlgorithm
BLAKE2B hash function (RFC 7693). [...]
const Blake2b()
blake2s → const HashAlgorithm
BLAKE2S hash function (RFC 7693). [...]
const _Blake2s()
chacha20 → const Cipher
ChaCha20 cipher (RFC 7539). [...]
const ChaCha(rounds: 20, name: 'chacha20')
chacha20Poly1305Aead → const Cipher
Optimized AEAD_CHACHA20_POLY1305 implementation. [...]
const Chacha20Poly1305Aead(name: 'chacha20Poly1305Aead', cipher: chacha20)
ecdhP256 → const KeyExchangeAlgorithm
P-256 (secp256r1 / prime256v1) Elliptic Curve Diffie-Hellman (ECDH) key exchange algorithm. Currently supported only in the browser. [...]
const _EcdhP256()
ecdhP384 → const KeyExchangeAlgorithm
P-384 (secp384r1 / prime384v1) Elliptic Curve Diffie-Hellman (ECDH) key exchange algorithm. Currently supported only in the browser. [...]
const _EcdhP384()
ecdhP521 → const KeyExchangeAlgorithm
P-521 (secp521r1 / prime521v1) Elliptic Curve Diffie-Hellman (ECDH) key exchange algorithm. Currently supported only in the browser. [...]
const _EcdhP521()
ecdsaP256Sha256 → const SignatureAlgorithm
Elliptic Curve Digital Signature Algorithm (ECDSA) using P-256 (secp256r1 / prime256v1) curve and sha256 hash algorithm. Currently supported only in browsers. [...]
const _EcdsaP256(sha256, name: 'ecdsaP256Sha256')
ecdsaP384Sha256 → const SignatureAlgorithm
Elliptic Curve Digital Signature Algorithm (ECDSA) using P-384 (secp384r1 / prime384v1) curve and sha256 hash algorithm. Currently supported only in browsers. [...]
const _EcdsaP384(sha256, name: 'ecdsaP384Sha256')
ecdsaP384Sha384 → const SignatureAlgorithm
Elliptic Curve Digital Signature Algorithm (ECDSA) using P-384 (secp384r1 / prime384v1) curve and sha384 hash algorithm. Currently supported only in browsers. [...]
const _EcdsaP384(sha384, name: 'ecdsaP384Sha384')
ecdsaP521Sha256 → const SignatureAlgorithm
Elliptic Curve Digital Signature Algorithm (ECDSA) using P-521 (secp521r1 / prime521v1) curve and sha256 hash algorithm. Currently supported only in browsers. [...]
const _EcdsaP521(sha256, name: 'ecdsaP521Sha256')
ecdsaP521Sha512 → const SignatureAlgorithm
Elliptic Curve Digital Signature Algorithm (ECDSA) using P-521 (secp521r1 / prime521v1) curve and sha512 hash algorithm. Currently supported only in browsers. [...]
const _EcdsaP521(sha512, name: 'ecdsaP521Sha512')
ed25519 → const SignatureAlgorithm
Ed25519 (RFC 8032) signature algorithm. [...]
const _Ed25519()
poly1305 → const MacAlgorithm
Poly1305 message authentication algorithm (RFC 7539). [...]
const _Poly1305()
sha1 → const HashAlgorithm
SHA1, an old cryptographic hash function that's not recommended for new applications. [...]
const _Sha1()
sha224 → const HashAlgorithm
SHA224, a function in the SHA2 family of cryptographic hash functions. [...]
const _Sha224()
sha256 → const HashAlgorithm
SHA256, a function in the SHA2 family of cryptographic hash functions. [...]
const _Sha256()
sha384 → const HashAlgorithm
SHA385, a function in the SHA2 family of cryptographic hash functions. [...]
const _Sha384()
sha512 → const HashAlgorithm
SHA512, a function in the SHA2 family of cryptographic hash functions. [...]
const _Sha512()
x25519 → const KeyExchangeAlgorithm
X25519 (RFC 7748) key exchange algorithm (Curve25519 Diffie-Hellman). [...]
const _X25519()
xchacha20 → const Cipher
XChaCha20 cipher (draft-irtf-cfrg-xchacha). [...]
const _XChaCha(name: 'xchacha20', rounds: 20)
xchacha20Poly1305Aead → const CipherWithAppendedMac
XAEAD_CHACHA20_POLY1305 (draft-irtf-cfrg-xchacha) cipher. [...]
const Chacha20Poly1305Aead(name: 'xchacha20Poly1305Aead', cipher: xchacha20)

Functions

poly1305SecretKeyFromChacha20(SecretKey secretKey, {Nonce nonce}) SecretKey
Calculates a Poly1305 secret key by using Chacha20.

Exceptions / Errors

MacValidationException
An exception thrown by Cipher when decrypted bytes have invalid Mac.