Class Index | File Index

Classes


Namespace aes

AES-256 encryption and associated modes
Defined in: aes.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
aes

Implementation of AES on 256 bit keys.

Method Summary
Method Attributes Method Name and Description
<private> <static>  
aes._aes(input, dir)
Internal AES block function.
<private> <static>  
aes._blockGen(s, dir)
Block generator function, with PKCS#5 support for padding.
<private> <static>  
aes._output(block, last)
Output processing.
<static>  
aes.CBC(s, iv, dir)
CBC mode encryption and decryption using AES.
<static>  
aes.CCM_decrypt(s, iv, adata, tlen)
Decryption in CCM mode.
<static>  
aes.CCM_encrypt(s, iv, adata, tlen)
Authenticated encryption in CCM mode (provides ciphertext integrity).
<static>  
aes.setKey(key)
Set the key to use for encryption and decryption.
Namespace Detail
aes

Implementation of AES on 256 bit keys.


Author: Anonymized.
Requires:
encoding
Method Detail
<private> <static> {number array[8]} aes._aes(input, dir)
Internal AES block function.
Parameters:
{number array[4]} input
array of four 32-bit words to process
{boolean} dir
false for encryption, true for decryption
Returns:
{number array[8]} result of the encryption

<private> <static> {blocks:number|gen:()->number array[4]} aes._blockGen(s, dir)
Block generator function, with PKCS#5 support for padding.
Parameters:
{string} s
input string to process in blocks
{boolean} dir
false for encryption, true for decryption (no padding)
Returns:
{blocks:number|gen:()->number array[4]} A record containing the number of blocks and the block generating function

<private> <static> {string} aes._output(block, last)
Output processing. By default, returns an ASCII string.
Parameters:
{number array[4]} block
internal block to output
{boolean} last
true if this is the last block, false otherwise
Returns:
{string} ASCII string representing the input block. Will unpad if this is the last block.

<static> {string} aes.CBC(s, iv, dir)
CBC mode encryption and decryption using AES.
Parameters:
{string} s
input plaintext or ciphertext (ASCII string)
{string} iv
initial vector of the encryption, a 16 bytes ASCII string
{boolean} dir
false for encryption, true for encryption
Returns:
{string} result as an ASCII string

<static> {valid:bolean|data:string} aes.CCM_decrypt(s, iv, adata, tlen)
Decryption in CCM mode.
Parameters:
{string} s
input ciphertext
{string} iv
random initialization vector (ASCII string)
{string} adata
Optional authenticated data (ASCII)
{number} tlen
tag length in bytes
Returns:
{valid:bolean|data:string} Object containing the decrypted data and authentication status

<static> {string} aes.CCM_encrypt(s, iv, adata, tlen)
Authenticated encryption in CCM mode (provides ciphertext integrity).
Parameters:
{string} s
input plaintext (ASCII string)
{string} iv
Random initialization vector, 16 byte ASCII string
{string} adata
Optional authentication data (not secret but integrity protected)
{number} tlen
tag length in bytes (2 to 16) - high values make it harder to tamper with the ciphertext
Returns:
{string} the encrypted data, an ASCII string

<static> aes.setKey(key)
Set the key to use for encryption and decryption.
Parameters:
{string} key
ASCII key (32 bytes long)

Documentation generated by JsDoc Toolkit on Mon, 26 Nov 2012 17:47:45 UTC