- Source:
Requires
Methods
-
<static> decrypt(cipherfn, key, ciphertext, resync) → {String}
-
This function decrypts a given plaintext using the specified blockcipher to decrypt a message
Parameters:
Name Type Description cipherfn
String the algorithm cipher class to decrypt data in one block_size encryption, module:crypto/cipher. key
String binary string representation of key to be used to decrypt the ciphertext. This will be passed to the cipherfn ciphertext
String to be decrypted provided as a string resync
Boolean a boolean value specifying if a resync of the IV should be used or not. The encrypteddatapacket uses the "old" style with a resync. Decryption within an encryptedintegrityprotecteddata packet is not resyncing the IV. - Source:
Returns:
a string with the plaintext data- Type
- String
-
<static> encrypt(prefixrandom, cipherfn, plaintext, key, resync) → {String}
-
This function encrypts a given with the specified prefixrandom using the specified blockcipher to encrypt a message
Parameters:
Name Type Description prefixrandom
String random bytes of block_size length provided as a string to be used in prefixing the data cipherfn
String the algorithm cipher class to encrypt data in one block_size encryption, module:crypto/cipher. plaintext
String data to be encrypted provided as a string key
String binary string representation of key to be used to encrypt the plaintext. This will be passed to the cipherfn resync
Boolean a boolean value specifying if a resync of the IV should be used or not. The encrypteddatapacket uses the "old" style with a resync. Encryption within an encryptedintegrityprotecteddata packet is not resyncing the IV. - Source:
Returns:
a string with the encrypted data- Type
- String
-
<static> mdc(key, ciphertext) → {String}
-
Decrypts the prefixed data for the Modification Detection Code (MDC) computation
Parameters:
Name Type Description cipherfn.encrypt
String Cipher function to use, key
String binary string representation of key to be used to check the mdc This will be passed to the cipherfn ciphertext
String The encrypted data - Source:
- See:
-
- module:crypto/cipher.
Returns:
plaintext Data of D(ciphertext) with blocksize length +2- Type
- String