Class: openpgp_packet_encryptedsessionkey

openpgp_packet_encryptedsessionkey

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.

new openpgp_packet_encryptedsessionkey()

Source:

Methods

<inner> decrypt(msg, key) → {String}

Decrypts the session key (only for public key encrypted session key packets (tag 1)
Parameters:
Name Type Description
msg openpgp_msg_message The message object (with member encryptedData
key openpgp_msg_privatekey Private key with secMPIs unlocked
Source:
Returns:
The unencrypted session key
Type
String

<inner> read_pub_key_packet(input, position, len) → {openpgp_packet_encrypteddata}

Parsing function for a publickey encrypted session key packet (tag 1).
Parameters:
Name Type Description
input String Payload of a tag 1 packet
position Integer Position to start reading from the input string
len Integer Length of the packet or the remaining length of input at position
Source:
Returns:
Object representation
Type
openpgp_packet_encrypteddata

<inner> read_symmetric_key_packet(input, position, len) → {openpgp_packet_encrypteddata}

Parsing function for a symmetric encrypted session key packet (tag 3).
Parameters:
Name Type Description
input String Payload of a tag 1 packet
position Integer Position to start reading from the input string
len Integer Length of the packet or the remaining length of input at position
Source:
Returns:
Object representation
Type
openpgp_packet_encrypteddata

<inner> toString() → {String}

Creates a string representation of this object (useful for debug purposes)
Source:
Returns:
The string containing a openpgp description
Type
String

<inner> write_pub_key_packet(publicKeyId, publicMPIs, pubalgo, symmalgo, sessionkey) → {String}

Create a string representation of a tag 1 packet
Parameters:
Name Type Description
publicKeyId String The public key id corresponding to publicMPIs key as string
publicMPIs openpgp_type_mpi[] Multiprecision integer objects describing the public key
pubalgo Integer The corresponding public key algorithm // See RFC4880 9.1
symmalgo Integer The symmetric cipher algorithm used to encrypt the data within an encrypteddatapacket or encryptedintegrity- protecteddatapacket following this packet //See RFC4880 9.2
sessionkey String A string of randombytes representing the session key
Source:
Returns:
The string representation
Type
String