Class: SecretSubkey

packet.SecretSubkey()

new SecretSubkey()

A Secret-Subkey packet (tag 7) is the subkey analog of the Secret Key packet and has exactly the same format.

Source:

Extends

Members

created :Date

Key creation date.

Type:
  • Date
Inherited From:
Source:

encrypted

Encrypted secret-key data

Inherited From:
Source:

expirationTimeV3 :Integer

Time until expiration in days (V3 only)

Type:
  • Integer
Inherited From:
Source:

fingerprint :String

Fingerprint in lowercase hex

Type:
  • String
Inherited From:
Source:

isEncrypted

Indicator if secret-key data is encrypted. this.isEncrypted === false means data is available in decrypted form.

Inherited From:
Source:

keyid :module:type/keyid

Keyid

Type:
Inherited From:
Source:

params :Array.<Object>

Algorithm specific params

Type:
  • Array.<Object>
Inherited From:
Source:

readPublicKey

Alias of read()

Inherited From:
Source:
See:

tag :module:enums.packet

Packet type

Type:
Overrides:
Source:

version :Integer

Packet version

Type:
  • Integer
Inherited From:
Source:

writePublicKey

Alias of write()

Inherited From:
Source:
See:

Methods

clearPrivateParams()

Clear private params, return to initial state

Inherited From:
Source:

(async) decrypt(passphrase) → {Promise.<Boolean>}

Decrypts the private key params which are needed to use the key. module:packet.SecretKey.isDecrypted should be false, as otherwise calls to this function will throw an error.

Parameters:
Name Type Description
passphrase String

The passphrase for this private key as string

Inherited From:
Source:
Returns:
Type
Promise.<Boolean>

(async) encrypt(passphrase) → {Promise.<Boolean>}

Encrypt the payload. By default, we use aes256 and iterated, salted string to key specifier. If the key is in a decrypted state (isEncrypted === false) and the passphrase is empty or undefined, the key will be set as not encrypted. This can be used to remove passphrase protection after calling decrypt().

Parameters:
Name Type Description
passphrase String
Inherited From:
Source:
Returns:
Type
Promise.<Boolean>

getAlgorithmInfo() → {Object}

Returns algorithm information

Inherited From:
Source:
Returns:

An object of the form {algorithm: String, bits:int, curve:String}

Type
Object

getCreationTime() → {Date}

Returns the creation time of the key

Inherited From:
Source:
Returns:
Type
Date

getFingerprint() → {String}

Calculates the fingerprint of the key

Inherited From:
Source:
Returns:

A string containing the fingerprint in lowercase hex

Type
String

getFingerprintBytes() → {Uint8Array}

Calculates the fingerprint of the key

Inherited From:
Source:
Returns:

A Uint8Array containing the fingerprint

Type
Uint8Array

getKeyId() → {String}

Calculates the key id of the key

Inherited From:
Source:
Returns:

A 8 byte key id

Type
String

isDecrypted() → {Boolean|null}

Check whether secret-key data is available in decrypted form. Returns null for public keys.

Inherited From:
Source:
Returns:
Type
Boolean | null

postCloneTypeFix()

Fix custom types after cloning

Inherited From:
Source:

read(bytes)

Internal parser for private keys as specified in RFC4880bis-04 section 5.5.3

Parameters:
Name Type Description
bytes String

Input string to read the packet from

Inherited From:
Source:

write() → {String}

Creates an OpenPGP key packet for the given key.

Inherited From:
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: