cipher

A Dart library for encryption and decryption. As of today, most of the classes are ports of Bouncy Castle from Java to Dart. The porting is almost always direct except for some classes that had been added to ease the use of low level data.

To make sure nothing fails, tests and benchmarks for every algorithm are provided. The expected results are taken from the Bouncy Castle Java version and also from standards, and matched against the results got from cipher.

As of the last release, the following algorithms are implemented:

Block ciphers:

  • AES (fast version)

Stream ciphers:

  • Salsa 20

Block cipher modes of operation:

  • SIC (a.k.a. CTR)
  • CBC

Paddings:

  • PKCS7

Digests:

  • RIPEMD-160
  • SHA-1
  • SHA-256

MACs:

  • HMAC

Signatures:

  • ECDSA

Password based key derivators:

  • PBKDF2
  • scrypt

Asymmetric key generators:

  • ECDSA

Entropy sources (true RNGs):

  • URL based (can be used, for example, with random.org)
  • File based (can be used, for example, with /dev/random)

Secure PRNGs:

  • Based on block cipher in CTR mode
  • Based on block cipher in CTR mode with auto reseed (for forward security)

Libraries

cipher

This is the main entry point to the cipher library API. It includes the cipher.api and cipher.parameters libraries, which comprise the whole API specification.

cipher.api

This is the API specification library for the cipher project.

cipher.block.aes_fast
cipher.digests.md4_family_digest
cipher.digests.ripemd160
cipher.digests.sha1
cipher.digests.sha256
cipher.ecc.ecc_base
cipher.ecc.ecc_fp
cipher.entropy.file_entropy_source
cipher.entropy.url_entropy_source
cipher.impl

This library contains all out-of-the-box implementations of the interfaces provided in the API which are compatible with client and server sides.

cipher.impl.server

This library contains all out-of-the-box implementations of the interfaces provided in the API which are compatible only with server side. It includes the cipher.impl library and extends it with more algorithms.

cipher.impl_client

This library contains all out-of-the-box implementations of the interfaces provided in the API which are compatible only with client side. It includes the cipher.impl library and extends it with more algorithms.

cipher.key_derivators.pbkdf2
cipher.key_derivators.scrypt
cipher.key_generators.ec_key_generator
cipher.macs.hmac
cipher.modes.cbc
cipher.modes.sic
cipher.paddings.padded_block_cipher
cipher.paddings.pkcs7
cipher.parameters

This library contains all parameters classes used by the implementations.

cipher.params.asymmetric_key_parameter
cipher.params.key_derivators.pbkdf2_parameters
cipher.params.key_derivators.scrypt_parameters
cipher.params.key_generators.ec_key_generator_parameters
cipher.params.key_generators.key_generator_parameters
cipher.params.key_parameter
cipher.params.padded_block_cipher_parameters
cipher.params.parameters_with_iv
cipher.params.parameters_with_random
cipher.random.auto_seed_block_ctr_random
cipher.random.block_ctr_random
cipher.random.secure_random_base
cipher.signers.ecdsa_signer
cipher.stream.salsa20