Fix comments on symmetric- and public-key encrypted session keys (#1120)
This commit is contained in:
parent
6a607c7567
commit
b9afd26912
|
@ -63,11 +63,7 @@ class PublicKeyEncryptedSessionKeyPacket {
|
||||||
/**
|
/**
|
||||||
* Parsing function for a publickey encrypted session key packet (tag 1).
|
* Parsing function for a publickey encrypted session key packet (tag 1).
|
||||||
*
|
*
|
||||||
* @param {Uint8Array} input Payload of a tag 1 packet
|
* @param {Uint8Array} bytes Payload of a tag 1 packet
|
||||||
* @param {Integer} position Position to start reading from the input string
|
|
||||||
* @param {Integer} len Length of the packet or the remaining length of
|
|
||||||
* input at position
|
|
||||||
* @returns {PublicKeyEncryptedSessionKeyPacket} Object representation
|
|
||||||
*/
|
*/
|
||||||
read(bytes) {
|
read(bytes) {
|
||||||
this.version = bytes[0];
|
this.version = bytes[0];
|
||||||
|
@ -86,7 +82,7 @@ class PublicKeyEncryptedSessionKeyPacket {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a string representation of a tag 1 packet
|
* Create a binary representation of a tag 1 packet
|
||||||
*
|
*
|
||||||
* @returns {Uint8Array} The Uint8Array representation
|
* @returns {Uint8Array} The Uint8Array representation
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -30,20 +30,17 @@ import enums from '../enums';
|
||||||
import util from '../util';
|
import util from '../util';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public-Key Encrypted Session Key Packets (Tag 1)
|
* Symmetric-Key Encrypted Session Key Packets (Tag 3)
|
||||||
*
|
*
|
||||||
* {@link https://tools.ietf.org/html/rfc4880#section-5.1|RFC4880 5.1}:
|
* {@link https://tools.ietf.org/html/rfc4880#section-5.3|RFC4880 5.3}:
|
||||||
* A Public-Key Encrypted Session Key packet holds the session key
|
* The Symmetric-Key Encrypted Session Key packet holds the
|
||||||
* used to encrypt a message. Zero or more Public-Key Encrypted Session Key
|
* symmetric-key encryption of a session key used to encrypt a message.
|
||||||
* packets and/or Symmetric-Key Encrypted Session Key packets may precede a
|
* Zero or more Public-Key Encrypted Session Key packets and/or
|
||||||
* Symmetrically Encrypted Data Packet, which holds an encrypted message. The
|
* Symmetric-Key Encrypted Session Key packets may precede a
|
||||||
* message is encrypted with the session key, and the session key is itself
|
* Symmetrically Encrypted Data packet that holds an encrypted message.
|
||||||
* encrypted and stored in the Encrypted Session Key packet(s). The
|
* The message is encrypted with a session key, and the session key is
|
||||||
* Symmetrically Encrypted Data Packet is preceded by one Public-Key Encrypted
|
* itself encrypted and stored in the Encrypted Session Key packet or
|
||||||
* Session Key packet for each OpenPGP key to which the message is encrypted.
|
* the Symmetric-Key Encrypted Session Key packet.
|
||||||
* 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.
|
|
||||||
* @memberof module:packet
|
* @memberof module:packet
|
||||||
*/
|
*/
|
||||||
class SymEncryptedSessionKeyPacket {
|
class SymEncryptedSessionKeyPacket {
|
||||||
|
@ -62,12 +59,7 @@ class SymEncryptedSessionKeyPacket {
|
||||||
/**
|
/**
|
||||||
* Parsing function for a symmetric encrypted session key packet (tag 3).
|
* Parsing function for a symmetric encrypted session key packet (tag 3).
|
||||||
*
|
*
|
||||||
* @param {Uint8Array} input Payload of a tag 1 packet
|
* @param {Uint8Array} bytes Payload of a tag 3 packet
|
||||||
* @param {Integer} position Position to start reading from the input string
|
|
||||||
* @param {Integer} len
|
|
||||||
* Length of the packet or the remaining length of
|
|
||||||
* input at position
|
|
||||||
* @returns {SymEncryptedSessionKeyPacket} Object representation
|
|
||||||
*/
|
*/
|
||||||
read(bytes) {
|
read(bytes) {
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
|
@ -105,6 +97,11 @@ class SymEncryptedSessionKeyPacket {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a binary representation of a tag 3 packet
|
||||||
|
*
|
||||||
|
* @returns {Uint8Array} The Uint8Array representation
|
||||||
|
*/
|
||||||
write() {
|
write() {
|
||||||
const algo = this.encrypted === null ?
|
const algo = this.encrypted === null ?
|
||||||
this.sessionKeyAlgorithm :
|
this.sessionKeyAlgorithm :
|
||||||
|
|
Loading…
Reference in New Issue
Block a user