cryppo library

Classes

DataEncryptionKey
An encryption key intended for use in Aes/Symmetric key encryption
DerivationArtefacts
Derivation Artefacts from a key derivation strategy (such as Pbkdf2)
DerivedKey
An encryption key derived from a user-entered string using an algorithm such as Pbkdf2
KeyPair
An RSA Key pair used for encryption/decryption and signing/verification
Rsa4096
RSA implementation with a 4096 bit key
Signature
An RSA Signature's data

Enums

DerivationStrategy
Strategy used to derive a fixed-length encryption key
EncryptionStrategy
Encryption strategy. Preference should be EncryptionStrategy.aes256Gcm for symmetric encryption and EncryptionStrategy.rsa4096 for asymmetric encryption.

Extensions

EncodeStrategy
Convert a DerivationStrategy to its corresponding DerivationService implementation
MapToService
Convert an EncryptionStrategy into its respective EncryptionService.

Functions

decryptWithKey({dynamic encrypted, required EncryptionKey key}) Future<List<int>>
Provided an encrypted+serialized string (in Cryppo's encryption serialization format) and a Key (the type of which depends on the type of encryption used) return the decrypted binary data.
decryptWithKeyDerivedFromString({required String serialized, required String passphrase}) Future<List<int>>
Provided an encrypted+serialized string (in Cryppo's encryption serialization format which includes serialized key derivation artefacts), derive the key (using the entered passphrase) and return the decrypted binary data.
derivationStrategyFromString(String strategy) DerivationStrategy
Maps a serialized DerivationStrategy string into the actual enum value
deriveKeyWithSerializedOptions(String passphrase, String serializedDerivationArtefacts) Future<DerivedKey>
Provided a user-entered passphrase and artifacts serialized in cryppo's serialization format, derive the data encryption key.
deriveNewKeyFromString(String passphrase, DerivationStrategy strategy) Future<DerivedKey>
Provided a user-entered passphrase and a key derivation strategy, derive a data encryption key with randomly generated derivation artefacts. The key and artefacts can be serialized for transfer over the wire and storage.
encryptionStrategyFromString(String strategy) EncryptionStrategy
Given a string from Cryppo's seralization format, return the corresponding EncryptionStrategy
encryptWithDerivedKey({required EncryptionStrategy encryptionStrategy, DerivationStrategy keyDerivationStrategy = DerivationStrategy.pbkdf2Hmac, required String passphrase, required List<int> data}) Future<EncryptionResult>
Encrypts data with a key derived from passphrase using keyDerivationStrategy, data must be provided in bytes A EncryptionKey can be a symmetrical key or a key pair, which corresponds to AES or RSA EncryptionStrategy
encryptWithKey({required EncryptionStrategy encryptionStrategy, required EncryptionKey key, required List<int> data}) Future<EncryptionResult>
Encrypts data with EncryptionKey, data must be provided in bytes A EncryptionKey can be a symmetrical key or a key pair, which corresponds to AES or RSA EncryptionStrategy
sign({required RSAPrivateKey privateKey, required List<int> data}) String
Sign some binary data with the provided Private Key
verify({required RSAPublicKey publicKey, required String serializedSignature}) bool
Verify some signed binary data (sierlized in Cryppo's signature serliazation format) with the provided Public Key

Typedefs

DecryptionMethod = Future<Uint8List> Function(String serialized, DataEncryptionKey key)