Class: PublicKeyPacket

PublicKeyPacket(dateopt, configopt)

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.

A Public-Key packet starts a series of packets that forms an OpenPGP key (sometimes called an OpenPGP certificate).

Constructor

new PublicKeyPacket(dateopt, configopt)

Parameters:
Name Type Attributes Description
date Date <optional>

Creation date

config Object <optional>

Full configuration, defaults to openpgp.config

Source:

Members

algorithm :enums.publicKey

Public key algorithm.

Type:
  • enums.publicKey
Source:

created :Date

Key creation date.

Type:
  • Date
Source:

expirationTimeV3 :Integer

Time until expiration in days (V3 only)

Type:
  • Integer
Source:

fingerprint :Uint8Array

Fingerprint bytes

Type:
  • Uint8Array
Source:

keyID :module:type/keyid~KeyID

KeyID

Type:
Source:

publicParams :Object

Algorithm specific public params

Type:
  • Object
Source:

readPublicKey

Alias of read()

Source:
See:

version :Integer

Packet version

Type:
  • Integer
Source:

writePublicKey

Alias of write()

Source:
See:

Methods

(static) fromSecretKeyPacket(secretKeyPacket) → {PublicKeyPacket}

Create a PublicKeyPacket from a SecretKeyPacket

Parameters:
Name Type Description
secretKeyPacket SecretKeyPacket

key packet to convert

Source:
Returns:

public key packet

Type
PublicKeyPacket

(async) computeFingerprint()

Computes and set the fingerprint of the key

Source:

(async) computeFingerprintAndKeyID()

Computes and set the key ID and fingerprint of the key

Source:

getAlgorithmInfo() → {Object}

Returns algorithm information

Source:
Returns:

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

Type
Object

getCreationTime() → {Date}

Returns the creation time of the key

Source:
Returns:
Type
Date

getFingerprint() → {String}

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

Source:
Returns:

A string containing the fingerprint in lowercase hex

Type
String

getFingerprintBytes() → {Uint8Array}

Returns the fingerprint of the key, as an array of bytes

Source:
Returns:

A Uint8Array containing the fingerprint

Type
Uint8Array

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

Return the key ID of the key

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

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.

Source:
Returns:
Type
Boolean | null

(async) read(bytes) → {Object}

Internal Parser for public keys as specified in RFC 4880 section 5.5.2 Public-Key Packet Formats

Parameters:
Name Type Description
bytes Uint8Array

Input array to read the packet from

Source:
Returns:

This object with attributes set by the parser

Type
Object

write() → {Uint8Array}

Creates an OpenPGP public key packet for the given key.

Source:
Returns:

Bytes encoding the public key OpenPGP packet.

Type
Uint8Array

writeForHash(version)

Write packet in order to be hashed; either for a signature or a fingerprint

Parameters:
Name Type Description
version Integer

target version of signature or key

Source: