Module: packet/secret_key

packet/secret_key

Implementation of the Key Material Packet (Tag 5,6,7,14)

RFC4480 5.5: A key material packet contains all the information about a public or private key. There are four variants of this packet type, and two major versions. Consequently, this section is complex.

new (require("packet/secret_key"))()

Source:
Source:

Requires

Members

algorithm :module:enums.publicKey

Public key algorithm
Type:
Inherited From:
Source:

created :Date

Key creation date.
Type:
  • Date
Inherited From:
Source:

Methods

decrypt(str_passphrase) → {Boolean}

Decrypts the private key MPIs which are needed to use the key.
Parameters:
Name Type Description
str_passphrase String The passphrase for this private key as string
Source:
Returns:
True if the passphrase was correct or MPI already decrypted; false if not
Type
Boolean

encrypt(passphrase)

Encrypt the payload. By default, we use aes256 and iterated, salted string to key specifier
Parameters:
Name Type Description
passphrase String
Source:

getFingerprint() → {String}

Calculates the fingerprint of the key
Inherited From:
Source:
Returns:
A string containing the fingerprint
Type
String

getKeyId() → {String}

Calculates the key id of the key
Inherited From:
Source:
Returns:
A 8 byte key id
Type
String

read(bytes)

Internal parser for private keys as specified in RFC 4880 section 5.5.3
Parameters:
Name Type Description
bytes String Input string to read the packet from
Source:

readPublicKey()

Alias of read()
Inherited From:
Source:
See:

write() → {String}

Creates an OpenPGP key packet for the given key.
Source:
Returns:
A string of bytes containing the secret key OpenPGP packet
Type
String

writeOld()

Write an old version packet - it's used by some of the internal routines.
Inherited From:
Source:

writePublicKey()

Alias of write()
Inherited From:
Source:
See: