Class: PublicKeyEncryptedSessionKeyPacket

PublicKeyEncryptedSessionKeyPacket()

Public-Key Encrypted Session Key Packets (Tag 1)

RFC4880 5.1: A Public-Key Encrypted Session Key packet holds the session key used to encrypt a message. Zero or more Public-Key Encrypted Session Key packets and/or Symmetric-Key Encrypted Session Key packets may precede a Symmetrically Encrypted Data Packet, which holds an encrypted message. The message is encrypted with the session key, and the session key is itself encrypted and stored in the Encrypted Session Key packet(s). The Symmetrically Encrypted Data Packet is preceded by one Public-Key Encrypted Session Key packet for each OpenPGP key to which the message is encrypted. The recipient of the message finds a session key that is encrypted to their public key, decrypts the session key, and then uses the session key to decrypt the message.

Constructor

new PublicKeyEncryptedSessionKeyPacket()

Source:

Members

encrypted :Object

Type:
  • Object
Source:

sessionKeyAlgorithm :enums.symmetric

Algorithm to encrypt the message with

Type:
  • enums.symmetric
Source:

Methods

(async) decrypt(key, randomSessionKeyopt)

Decrypts the session key (only for public key encrypted session key packets (tag 1)

Parameters:
Name Type Attributes Description
key SecretKeyPacket

decrypted private key

randomSessionKey Object <optional>

Bogus session key to use in case of sensitive decryption error, or if the decrypted session key is of a different type/size. This is needed for constant-time processing. Expected object of the form: { sessionKey: Uint8Array, sessionKeyAlgorithm: enums.symmetric }

Source:
Throws:

if decryption failed, unless randomSessionKey is given

Type
Error

(async) encrypt(key)

Encrypt session key packet

Parameters:
Name Type Description
key PublicKeyPacket

Public key

Source:
Throws:

if encryption failed

Type
Error

read(bytes)

Parsing function for a publickey encrypted session key packet (tag 1).

Parameters:
Name Type Description
bytes Uint8Array

Payload of a tag 1 packet

Source:

write() → {Uint8Array}

Create a binary representation of a tag 1 packet

Source:
Returns:

The Uint8Array representation.

Type
Uint8Array