rspamd_cryptoboxRspamd cryptobox is a module that operates with digital signatures and hashes.
local hash = require "rspamd_cryptobox_hash"
local h = hash.create()
h:update('hello world')
print(h:hex())Functions:
Methods:
The module rspamd_cryptobox defines the following functions.
rspamd_cryptobox_pubkey.load(file[, type[, alg]])Loads public key from base32 encoded file
Parameters:
file {string}: filename to loadtype {string}: optional ‘sign’ or ‘kex’ for signing and encryptionalg {string}: optional ‘default’ or ‘nist’ for curve25519/nistp256 keysReturns:
{cryptobox_pubkey}: new public keyBack to module description.
rspamd_cryptobox_pubkey.create(data[, type[, alg]])Loads public key from base32 encoded file
Parameters:
base32 {base32 string}: string with the keytype {string}: optional ‘sign’ or ‘kex’ for signing and encryptionalg {string}: optional ‘default’ or ‘nist’ for curve25519/nistp256 keysReturns:
{cryptobox_pubkey}: new public keyBack to module description.
rspamd_cryptobox_keypair.load(file)Loads public key from UCL file
Parameters:
file {string}: filename to loadReturns:
{cryptobox_keypair}: new keypairBack to module description.
rspamd_cryptobox_keypair.create(ucl_data)Loads public key from UCL data
Parameters:
ucl_data {string}: ucl to loadReturns:
{cryptobox_keypair}: new keypairBack to module description.
rspamd_cryptobox_signature.load(file)Loads signature from raw file
Parameters:
file {string}: filename to loadReturns:
{cryptobox_signature}: new signatureBack to module description.
rspamd_cryptobox_signature.create(data)Creates signature object from raw data
Parameters:
raw {data}: signature dataReturns:
{cryptobox_signature}: signature objectBack to module description.
rspamd_cryptobox_hash.create([string])Creates new hash context
Parameters:
data {string}: optional string to hashReturns:
{cryptobox_hash}: hash objectBack to module description.
rspamd_cryptobox_hash.create_specific(type, [string])Creates new hash context
Parameters:
type {string}: type of signaturedata {string}: raw signature dataReturns:
{cryptobox_hash}: hash objectBack to module description.
rspamd_cryptobox_hash.create_keyed(key, [string])Creates new hash context with specified key
Parameters:
key {string}: keyReturns:
{cryptobox_hash}: hash objectBack to module description.
rspamd_cryptobox.verify_memory(pk, sig, data)Check memory using specified cryptobox key and signature
Parameters:
pk {pubkey}: public key to verifysignature {sig}: to checkdata {string}: data to check signature againstReturns:
{boolean}: true - if string matches cryptobox signatureBack to module description.
rspamd_cryptobox.verify_file(pk, sig, file)Check file using specified cryptobox key and signature
Parameters:
pk {pubkey}: public key to verifysignature {sig}: to checkfile {string}: to load data fromReturns:
{boolean}: true - if string matches cryptobox signatureBack to module description.
rspamd_cryptobox.sign_memory(kp, data)Sign data using specified keypair
Parameters:
kp {keypair}: keypair to signdata {string}:Returns:
{cryptobox_signature}: signature objectBack to module description.
rspamd_cryptobox.sign_file(kp, file)Sign file using specified keypair
Parameters:
kp {keypair}: keypair to signfilename {string}:Returns:
{cryptobox_signature}: signature objectBack to module description.
The module rspamd_cryptobox defines the following methods.
rspamd_cryptobox_signature:save(file)Stores signature in raw file
Parameters:
file {string}: filename to useReturns:
{boolean}: true if signature has been savedBack to module description.
cryptobox_signature:hex()Return hex encoded signature string
Parameters:
No parameters
Returns:
{string}: raw value of signatureBack to module description.
cryptobox_signature:base32()Return base32 encoded signature string
Parameters:
No parameters
Returns:
{string}: raw value of signatureBack to module description.
cryptobox_signature:base64()Return base64 encoded signature string
Parameters:
No parameters
Returns:
{string}: raw value of signatureBack to module description.
cryptobox_signature:bin()Return raw signature string
Parameters:
No parameters
Returns:
{string}: raw value of signatureBack to module description.
cryptobox_hash:update(data)Updates hash with the specified data (hash should not be finalized using hex or bin methods)
Parameters:
data {string}: data to hashReturns:
No return
Back to module description.
cryptobox_hash:reset()Resets hash to the initial state
Parameters:
No parameters
Returns:
No return
Back to module description.
cryptobox_hash:hex()Finalizes hash and return it as hex string
Parameters:
No parameters
Returns:
{string}: hex value of hashBack to module description.
cryptobox_hash:base32()Finalizes hash and return it as zbase32 string
Parameters:
No parameters
Returns:
{string}: base32 value of hashBack to module description.
cryptobox_hash:base64()Finalizes hash and return it as base64 string
Parameters:
No parameters
Returns:
{string}: base64 value of hashBack to module description.
cryptobox_hash:bin()Finalizes hash and return it as raw string
Parameters:
No parameters
Returns:
{string}: raw value of hashBack to module description.
Back to top.