Class: SubKey

SubKey()

Class that represents a subkey packet and the relevant signatures.

Constructor

new SubKey()

Source:

Methods

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(primaryKey, date, config) → {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 Description
primaryKey SecretKeyPacket | PublicKeyPacket

The primary key packet

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 the fingerprint of the key

Overrides:
Source:
Returns:

A string containing the fingerprint in lowercase hex

Type
String

getFingerprint() → {String}

Calculates the fingerprint of the key

Overrides:
Source:
Returns:

A string containing the fingerprint in lowercase hex

Type
String

getKeyId() → {module:type/keyid~Keyid}

Calculates the key id of the key

Overrides:
Source:
Returns:

A 8 byte key id

Type
module:type/keyid~Keyid

getKeyId() → {module:type/keyid~Keyid}

Calculates the key id of the key

Overrides:
Source:
Returns:

A 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(primaryKey, signature, key,, date, config) → {Promise.<Boolean>}

Checks if a binding signature of a subkey is revoked

Parameters:
Name Type Description
primaryKey SecretKeyPacket | PublicKeyPacket

The primary key packet

signature SignaturePacket

The binding signature to verify

key, PublicSubkeyPacket | SecretSubkeyPacket | PublicKeyPacket | SecretKeyPacket

optional The key to verify the signature

date Date

Use the given date 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, config) → {Promise.<SubKey>}

Revokes the subkey

Parameters:
Name Type 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, primaryKey, config)

Update subkey with new components from specified subkey

Parameters:
Name Type Description
subKey SubKey

Source subkey to merge

primaryKey SecretKeyPacket | SecretSubkeyPacket

primary key used for validation

config Object

(optional) full configuration, defaults to openpgp.config

Source:
Throws:

if update failed

Type
Error

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

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

Parameters:
Name Type Description
primaryKey SecretKeyPacket | PublicKeyPacket

The primary key packet

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>