Module hmac
hmac module perform Message Authentication Code operations.
It base on HMAC_CTX in OpenSSL v1.
Usage:
hamc = require('openssl').hmac
Info:
- Author: george zhao <zhaozg(at)gmail.com>
Functions
new (alg, key[, engine]) | get hamc_ctx object |
hmac (digest, message, key, boolean) | compute hmac one step, in module openssl.hamc |
Class hmac_ctx
hmac_ctx:update (msg) | feed data to do digest |
hmac_ctx:final ([last[, raw]]) | get result of hmac |
hmac_ctx:size (msg) | return size of mac value |
Functions
- new (alg, key[, engine])
-
get hamc_ctx object
Parameters:
- alg string, integer or asn1_object name, nid or object identity
- key string secret key
- engine engine , nothing with default engine (optional)
Returns:
-
hamc_ctx
hmac object mapping HMAC_CTX in openssl
See also:
- hmac (digest, message, key, boolean)
-
compute hmac one step, in module openssl.hamc
Parameters:
- digest evp_digest, string or nid digest alg identity
- message string
- key string
- boolean (opt=false) raw
Returns:
-
string
result binary string
Class hmac_ctx
openssl.hmac_ctx object
- hmac_ctx:update (msg)
-
feed data to do digest
Parameters:
- msg string data
- hmac_ctx:final ([last[, raw]])
-
get result of hmac
Parameters:
- last string last part of data (optional)
- raw boolean binary or hex encoded result, default true for binary result (optional)
Returns:
-
string
val hash result
- hmac_ctx:size (msg)
-
return size of mac value
Parameters:
- msg string data