Module: type/s2k

type/s2k

Implementation of the String-to-key specifier (RFC4880 3.7)

String-to-key (S2K) specifiers are used to convert passphrase strings into symmetric-key encryption/decryption keys. They are used in two places, currently: to encrypt the secret part of private keys in the private keyring, and to convert passphrases to encryption keys for symmetrically encrypted messages.

new (require("type/s2k"))()

Source:
Source:

Requires

Members

algorithm :module:enums.hash

Type:
Source:

salt :String

Eight bytes of salt in a binary string.
Type:
  • String
Source:

type :module:enums.s2k

Type:
Source:

Methods

produce_key(passphrase) → {String}

Produces a key using the specified passphrase and the defined hashAlgorithm
Parameters:
Name Type Description
passphrase String Passphrase containing user input
Source:
Returns:
Produced key with a length corresponding to hashAlgorithm hash length
Type
String

read(input) → {Integer}

Parsing function for a string-to-key specifier (RFC 4880 3.7).
Parameters:
Name Type Description
input String Payload of string-to-key specifier
Source:
Returns:
Actual length of the object
Type
Integer

write() → {String}

writes an s2k hash based on the inputs.
Source:
Returns:
Produced key of hashAlgorithm hash length
Type
String