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

Asymmetric block ciphers:

  • RSA

Stream ciphers:

  • Salsa20

Block cipher modes of operation:

  • CBC (Cipher Block Chaining mode)
  • CFB (Cipher Feedback mode)
  • ECB (Electronic Code Book mode)
  • GCTR (GOST 28147 OFB counter mode)
  • OFB (Output FeedBack mode)
  • CTR (Counter mode)

Paddings:

  • PKCS7

Digests:

  • MD2
  • MD4
  • MD5
  • RIPEMD-128
  • RIPEMD-160
  • RIPEMD-256
  • RIPEMD-320
  • SHA-1
  • SHA-224
  • SHA-256
  • SHA-3
  • SHA-384
  • SHA-512
  • SHA-512/t
  • Tiger
  • Whirlpool

MACs:

  • HMAC

Signatures:

  • ECDSA
  • RSA

Password based key derivators:

  • PBKDF2
  • scrypt

Asymmetric key generators:

  • ECDSA
  • RSA

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 libraries cipher.api (which comprises the whole API specification) and cipher.impl.parameters (which defines CipherParameters to be used with provided implementations). .

cipher.adapters.stream_cipher_as_block_cipher
cipher.api

This is the API specification library for the cipher project.

cipher.api.ecc
cipher.api.registry
cipher.api.rsa
cipher.api.ufixnum
cipher.asymmetric.base_asymmetric_block_cipher
cipher.asymmetric.pkcs1
cipher.asymmetric.rsa
cipher.block.aes_fast
cipher.block.base_block_cipher
cipher.digests.base_digest
cipher.digests.long_sha2_family_digest
cipher.digests.md2
cipher.digests.md4
cipher.digests.md4_family_digest
cipher.digests.md5
cipher.digests.ripemd128
cipher.digests.ripemd160
cipher.digests.ripemd256
cipher.digests.ripemd320
cipher.digests.sha1
cipher.digests.sha224
cipher.digests.sha256
cipher.digests.sha3
cipher.digests.sha384
cipher.digests.sha512
cipher.digests.sha512t
cipher.digests.tiger
cipher.digests.whirlpool
cipher.ecc.ecc_base
cipher.ecc.ecc_fp
cipher.entropy.file_entropy_source
cipher.entropy.url_entropy_source
cipher.impl.base

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.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.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.key_derivators.base_key_derivator
cipher.key_derivators.pbkdf2
cipher.key_derivators.scrypt
cipher.key_generators.ec_key_generator
cipher.key_generators.rsa_key_generator
cipher.macs.base_mac
cipher.macs.hmac
cipher.modes.cbc
cipher.modes.cfb
cipher.modes.ecb
cipher.modes.gctr
cipher.modes.ofb
cipher.modes.sic
cipher.paddings.base_padding
cipher.paddings.padded_block_cipher
cipher.paddings.pkcs7
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_generators.rsa_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.signers.rsa_signer
cipher.stream.base_stream_cipher
cipher.stream.salsa20