From 50605d756a9fc0a247e19922dff53b4a9d639a59 Mon Sep 17 00:00:00 2001
From: Ingela Anderton Andin
stream_cipher() = rc4 | aes_ctr
block_cipher() = aes_cbc128 | aes_cfb128 | blowfish_cbc |
+ blowfish_cfb64 | des_cbc | des_cfb | des3_cbc | des3_cbf
+ | des_ede3 | rc2_cbc
stream_key() = aes_key() | rc4_key()
block_key() = aes_key() | blowfish_key() | des_key()| des3_key()
aes_key() = binary()
Key length is 128, 192 or 256 bits
rc4_key() = binary()
Variable key length from 8 bits up to 2048 bits (usually between 40 and 256)
blowfish_key() = binary()
Variable key length from 32 bits up to 448 bits
des_key() = binary()
Key length is 64 bits (in CBC mod only 8 bits are used)
des3_key() = [binary(), binary(), binary()]
Each key part is 64 bits (in CBC mod only 8 bits are used)
Provides the available crypto algorithms in terms of a list - of atoms.
+ of atoms. This is interesting as older versions of the openssl + crypto library may not support all algorithms used in the crypto API. +Encrypt
Decrypt
Provides the available crypto functions in terms of a list - of atoms.
-Returns the initialization vector to be used in the next
+ iteration of encrypt/decrypt of type
Decrypts the
Encrypts the
Decrypts the
Encrypts the
Verifies a digital signature
-Encrypts
Decrypts
Encrypts
Decrypts
Returns the
Initializes the state for use in RC4 stream encryption
+
Encrypts
Decrypts
Initializes the state for use in streaming AES encryption using Counter mode (CTR).
Encrypts
Encrypts
Decrypts
Encrypts the first 64 bits of
Decrypts the first 64 bits of
Encrypts
Decrypts
Encrypts
Decrypts
Encrypts
Encrypts
Decrypts
Returns the
Encrypts
Decrypts
Returns the
Encrypts
Decrypts
Encrypts
May throw exception
Decrypts
May throw exception
Encrypts
Decrypts
Encrypts
Decrypts
Encrypts the data with RC4 symmetric stream encryption. - Since it is symmetric, the same function is used for - decryption.
-Encrypts the
Decrypts the
Decrypts
Encrypts the
Decrypts the
Verifies a digital signature
The Data Encryption Standard (DES) defines an algorithm for - encrypting and decrypting an 8 byte quantity using an 8 byte key - (actually only 56 bits of the key is used). -
-When it comes to encrypting and decrypting blocks that are - multiples of 8 bytes various modes are defined (NIST SP - 800-38A). One of those modes is the Cipher Block Chaining (CBC) - mode, where the encryption of an 8 byte segment depend not only - of the contents of the segment itself, but also on the result of - encrypting the previous segment: the encryption of the previous - segment becomes the initializing vector of the encryption of the - current segment. -
-Thus the encryption of every segment depends on the encryption - key (which is secret) and the encryption of the previous - segment, except the first segment which has to be provided with - an initial initializing vector. That vector could be chosen at - random, or be a counter of some kind. It does not have to be - secret. -
-The following example is drawn from the old FIPS 81 standard - (replaced by NIST SP 800-38A), where both the plain text and the - resulting cipher text is settled. The following code fragment - returns `true'. -
->, - IVec = <<16#12,16#34,16#56,16#78,16#90,16#ab,16#cd,16#ef>>, - P = "Now is the time for all ", - C = crypto:des_cbc_encrypt(Key, IVec, P), - % Which is the same as - P1 = "Now is t", P2 = "he time ", P3 = "for all ", - C1 = crypto:des_cbc_encrypt(Key, IVec, P1), - C2 = crypto:des_cbc_encrypt(Key, C1, P2), - C3 = crypto:des_cbc_encrypt(Key, C2, P3), - - C = <->, - C = <<16#e5,16#c7,16#cd,16#de,16#87,16#2b,16#f2,16#7c, - 16#43,16#e9,16#34,16#00,16#8c,16#38,16#9c,16#0f, - 16#68,16#37,16#88,16#49,16#9a,16#7c,16#05,16#f6>>, - <<"Now is the time for all ">> == - crypto:des_cbc_decrypt(Key, IVec, C). - ]]>
The following is true for the DES CBC mode. For all
- decompositions
Similarly, for all decompositions
For DES3 (which uses three 64 bit keys) the situation is the - same. -
-