wilton/crypto
Cryptography operations.
More...
Functions | |
Object | createCryptKey (String secret, Function|Undefined callback) |
Create crypt params from the specified string. | |
Undefined | decryptFile (Object options, Function|Undefined callback) |
AES decryption. | |
Undefined | encryptFile (Object options, Function|Undefined callback) |
AES encryption. | |
String | hashFile (Object options, Function|Undefined callback) |
Compute SHA256 sum of a file. |
This module provides access to cryptography operations: encryption and hash sum computation. Processing is done on files without loading all their content into memory.
Usage example:
Object crypto::createCryptKey | ( | String | secret, |
Function|Undefined | callback | ||
) |
Deterministically creates encryption key and initialization vector from the specified input string.
secret | String input secret string to create crypt params |
callback | Function|Undefined callback to receive result or error |
Object
with the following fields:String
encryption key in hexadecimalString
initialization vector in hexadecimal Undefined crypto::decryptFile | ( | Object | options, |
Function|Undefined | callback | ||
) |
Decrypts specified file using AES with specifief encryption key and initialization vector.
Key an IV may be created with createCryptKey
.
Results are written to the specified destination path.
options | Object configuration object, see possible options below |
callback | Function|Undefined callback to receive result or error |
Undefined
Options
String
path to the file to decryptString
path to the file to write decryption results intoString
encryption key in hexadecimal, must be 32 bytes longString
init vector in hexadecimal, must be 16 bytes long Undefined crypto::encryptFile | ( | Object | options, |
Function|Undefined | callback | ||
) |
Encrypts specified file using AES with specifief encryption key and initialization vector.
Key an IV may be created with createCryptKey
.
Results are written to the specified destination path.
options | Object configuration object, see possible options below |
callback | Function|Undefined callback to receive result or error |
Undefined
Options
String
path to the file to encryptString
path to the file to write encryption results intoString
encryption key in hexadecimal, must be 32 bytes longString
init vector in hexadecimal, must be 16 bytes long String crypto::hashFile | ( | Object | options, |
Function|Undefined | callback | ||
) |
Computes SHA256 hash sum from the contents of a specified file. Hash sum value returned as a hexadecimal string.
options | Object configuration object, see possible options below |
callback | Function|Undefined callback to receive result or error |
String
Options
String
path to the file to compute SHA256