Class: Subkey

Subkey(subkeyPacket, mainKey)

Class that represents a subkey packet and the relevant signatures.

Constructor

new Subkey(subkeyPacket, mainKey)

Parameters:
Name Type Description
subkeyPacket SecretSubkeyPacket | PublicSubkeyPacket

subkey packet to hold in the Subkey

mainKey Key

reference to main Key object, containing the primary key packet corresponding to the subkey

Source:

Methods

clone() → {Subkey}

Shallow clone

Source:
Returns:
Type
Subkey

getAlgorithmInfo() → {Object}

Returns algorithm information

Overrides:
Source:
Returns:

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

Type
Object

getAlgorithmInfo() → {Object}

Returns algorithm information

Overrides:
Source:
Returns:

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

Type
Object

getCreationTime() → {Date}

Returns the creation time of the key

Overrides:
Source:
Returns:
Type
Date

getCreationTime() → {Date}

Returns the creation time of the key

Overrides:
Source:
Returns:
Type
Date

(async) getExpirationTime(date, configopt) → {Promise.<(Date|Infinity|null)>}

Returns the expiration time of the subkey or Infinity if key does not expire. Returns null if the subkey is invalid.

Parameters:
Name Type Attributes Description
date Date

Use the given date instead of the current time

config Object <optional>

Full configuration, defaults to openpgp.config

Source:
Returns:
Type
Promise.<(Date|Infinity|null)>

getFingerprint() → {String}

Calculates and returns the fingerprint of the key, as a string

Overrides:
Source:
Returns:

A string containing the fingerprint in lowercase hex

Type
String

getFingerprint() → {String}

Calculates and returns the fingerprint of the key, as a string

Overrides:
Source:
Returns:

A string containing the fingerprint in lowercase hex

Type
String

getKeyID() → {module:type/keyid~KeyID}

Return the key ID of the key

Overrides:
Source:
Returns:

The 8-byte key ID

Type
module:type/keyid~KeyID

getKeyID() → {module:type/keyid~KeyID}

Return the key ID of the key

Overrides:
Source:
Returns:

The 8-byte key ID

Type
module:type/keyid~KeyID

hasSameFingerprintAs() → {Boolean}

Calculates whether two keys have the same fingerprint without actually calculating the fingerprint

Overrides:
Source:
Returns:

Whether the two keys have the same version and public key data.

Type
Boolean

hasSameFingerprintAs() → {Boolean}

Calculates whether two keys have the same fingerprint without actually calculating the fingerprint

Overrides:
Source:
Returns:

Whether the two keys have the same version and public key data.

Type
Boolean

isDecrypted() → {Boolean|null}

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

Overrides:
Source:
Returns:
Type
Boolean | null

isDecrypted() → {Boolean|null}

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

Overrides:
Source:
Returns:
Type
Boolean | null

(async) isRevoked(signature, key,, dateopt, configopt) → {Promise.<Boolean>}

Checks if a binding signature of a subkey is revoked

Parameters:
Name Type Attributes Description
signature SignaturePacket

The binding signature to verify

key, PublicSubkeyPacket | SecretSubkeyPacket | PublicKeyPacket | SecretKeyPacket

optional The key to verify the signature

date Date <optional>

Use the given date for verification instead of the current time

config Object <optional>

Full configuration, defaults to openpgp.config

Source:
Returns:

True if the binding signature is revoked.

Type
Promise.<Boolean>

(async) revoke(primaryKey, reasonForRevocation, date, configopt) → {Promise.<Subkey>}

Revokes the subkey

Parameters:
Name Type Attributes Description
primaryKey SecretKeyPacket

decrypted private primary key for revocation

reasonForRevocation Object

optional, object indicating the reason for revocation

Properties
Name Type Description
flag module:enums.reasonForRevocation

optional, flag indicating the reason for revocation

string String

optional, string explaining the reason for revocation

date Date

optional, override the creationtime of the revocation signature

config Object <optional>

Full configuration, defaults to openpgp.config

Source:
Returns:

New subkey with revocation signature.

Type
Promise.<Subkey>

toPacketList() → {PacketList}

Transforms structured subkey data to packetlist

Source:
Returns:
Type
PacketList

(async) update(subkey, dateopt, configopt)

Update subkey with new components from specified subkey

Parameters:
Name Type Attributes Description
subkey Subkey

Source subkey to merge

date Date <optional>

Date to verify validity of signatures

config Object <optional>

Full configuration, defaults to openpgp.config

Source:
Throws:

if update failed

Type
Error

(async) verify(date, configopt) → {Promise.<SignaturePacket>}

Verify subkey. Checks for revocation signatures, expiration time and valid binding signature.

Parameters:
Name Type Attributes Description
date Date

Use the given date instead of the current time

config Object <optional>

Full configuration, defaults to openpgp.config

Source:
Throws:

if the subkey is invalid.

Type
Error
Returns:
Type
Promise.<SignaturePacket>