Generates a new OpenPGP subkey, and returns a clone of the Key object with the new subkey added.
-Supports RSA and ECC keys. Defaults to the algorithm and bit size/curve of the primary key. DSA primary keys default to RSA subkeys.
-
-
-
-
-
-
-
-
-
-
-
Parameters:
-
-
-
-
-
-
-
Name
-
-
-
Type
-
-
-
-
-
-
Description
-
-
-
-
-
-
-
-
-
options.type
-
-
-
-
-
-ecc
-|
-
-rsa
-
-
-
-
-
-
-
-
-
-
The subkey algorithm: ECC or RSA
-
-
-
-
-
-
-
options.curve
-
-
-
-
-
-String
-
-
-
-
-
-
-
-
-
-
(optional) Elliptic curve for ECC keys
-
-
-
-
-
-
-
options.rsaBits
-
-
-
-
-
-Integer
-
-
-
-
-
-
-
-
-
-
(optional) Number of bits for RSA subkeys
-
-
-
-
-
-
-
options.keyExpirationTime
-
-
-
-
-
-Number
-
-
-
-
-
-
-
-
-
-
(optional) Number of seconds from the key creation time after which the key expires
-
-
-
-
-
-
-
options.date
-
-
-
-
-
-Date
-
-
-
-
-
-
-
-
-
-
(optional) Override the creation date of the key and the key signatures
-
-
-
-
-
-
-
options.sign
-
-
-
-
-
-Boolean
-
-
-
-
-
-
-
-
-
-
(optional) Indicates whether the subkey should sign rather than encrypt. Defaults to false
-
-
-
-
-
-
-
options.config
-
-
-
-
-
-Object
-
-
-
-
-
-
-
-
-
-
(optional) custom configuration settings to overwrite those in config
@@ -6132,8 +3990,8 @@ A dummy key is considered encrypted.
Update key with new components from specified key with same key ID:
users, subkeys, certificates are merged into the destination key,
duplicates and expired signatures are ignored.
-
If the specified key is a private key and the destination key is public,
-the destination key is transformed to a private key.
+
If the source key is a private key and the destination key is public,
+a private key is returned.
@@ -6171,7 +4029,7 @@ the destination key is transformed to a private key.
-
key
+
sourceKey
@@ -6271,7 +4129,7 @@ the destination key is transformed to a private key.
@@ -6325,190 +4187,6 @@ the destination key is transformed to a private key.
-
(async) validate(configopt)
-
-
-
-
-
-
-
-
Check whether the private and public primary key parameters correspond
-Together with verification of binding signatures, this guarantees key integrity
-In case of gnu-dummy primary key, it is enough to validate any signing subkeys
-otherwise all encryption subkeys are validated
-If only gnu-dummy keys are found, we cannot properly validate so we throw an error
@@ -1605,7 +1605,7 @@ will be normalized to \r\n and by default text is converted to UTF8
diff --git a/docs/MarkerPacket.html b/docs/MarkerPacket.html
index a6173698..811ed826 100644
--- a/docs/MarkerPacket.html
+++ b/docs/MarkerPacket.html
@@ -36,7 +36,12 @@ An experimental version of PGP used this packet as the Literal
packet, but no released version of PGP generated Literal packets with this
tag. With PGP 5.x, this packet has been reassigned and is reserved for use as
the Marker packet.
-
Such a packet MUST be ignored when received.
+
The body of this packet consists of:
+The three octets 0x50, 0x47, 0x50 (which spell "PGP" in UTF-8).
+
Such a packet MUST be ignored when received. It may be placed at the
+beginning of a message that uses features not available in PGP
+version 2.6 in order to cause that version to report that newer
+software is necessary to process the message.
@@ -846,7 +846,7 @@ Signature types are described in
diff --git a/docs/PacketList.html b/docs/PacketList.html
index ce15ca72..a138d589 100644
--- a/docs/PacketList.html
+++ b/docs/PacketList.html
@@ -97,7 +97,7 @@ are stored as numerical indices.
Generates a new OpenPGP subkey, and returns a clone of the Key object with the new subkey added.
+Supports RSA and ECC keys. Defaults to the algorithm and bit size/curve of the primary key. DSA primary keys default to RSA subkeys.
+
+
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
options.type
+
+
+
+
+
+ecc
+|
+
+rsa
+
+
+
+
+
+
+
+
+
+
The subkey algorithm: ECC or RSA
+
+
+
+
+
+
+
options.curve
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
(optional) Elliptic curve for ECC keys
+
+
+
+
+
+
+
options.rsaBits
+
+
+
+
+
+Integer
+
+
+
+
+
+
+
+
+
+
(optional) Number of bits for RSA subkeys
+
+
+
+
+
+
+
options.keyExpirationTime
+
+
+
+
+
+Number
+
+
+
+
+
+
+
+
+
+
(optional) Number of seconds from the key creation time after which the key expires
+
+
+
+
+
+
+
options.date
+
+
+
+
+
+Date
+
+
+
+
+
+
+
+
+
+
(optional) Override the creation date of the key and the key signatures
+
+
+
+
+
+
+
options.sign
+
+
+
+
+
+Boolean
+
+
+
+
+
+
+
+
+
+
(optional) Indicates whether the subkey should sign rather than encrypt. Defaults to false
+
+
+
+
+
+
+
options.config
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+
(optional) custom configuration settings to overwrite those in config
Check whether the private and public primary key parameters correspond
+Together with verification of binding signatures, this guarantees key integrity
+In case of gnu-dummy primary key, it is enough to validate any signing subkeys
+otherwise all encryption subkeys are validated
+If only gnu-dummy keys are found, we cannot properly validate so we throw an error
@@ -2172,7 +2571,7 @@ called by read_tag<num>
diff --git a/docs/SecretKeyPacket.html b/docs/SecretKeyPacket.html
index 0fb8dee8..9971d485 100644
--- a/docs/SecretKeyPacket.html
+++ b/docs/SecretKeyPacket.html
@@ -191,7 +191,7 @@ includes the secret-key material after all the public-key fields.
@@ -3501,7 +3740,7 @@ The resulting key cannot be used for signing/decrypting but can still verify sig
diff --git a/docs/SecretSubkeyPacket.html b/docs/SecretSubkeyPacket.html
index 2f67e505..b30bb05c 100644
--- a/docs/SecretSubkeyPacket.html
+++ b/docs/SecretSubkeyPacket.html
@@ -190,7 +190,7 @@ Key packet and has exactly the same format.
@@ -3565,7 +3804,7 @@ The resulting key cannot be used for signing/decrypting but can still verify sig
diff --git a/docs/Signature.html b/docs/Signature.html
index da3b3abd..4bb1f435 100644
--- a/docs/Signature.html
+++ b/docs/Signature.html
@@ -144,7 +144,7 @@
@@ -502,7 +502,7 @@
diff --git a/docs/SignaturePacket.html b/docs/SignaturePacket.html
index 3a0a6cae..402ca222 100644
--- a/docs/SignaturePacket.html
+++ b/docs/SignaturePacket.html
@@ -148,7 +148,7 @@ block of text, and a signature that is a certification of a User ID.
@@ -1591,7 +1591,7 @@ block of text, and a signature that is a certification of a User ID.
diff --git a/docs/SymEncryptedIntegrityProtectedDataPacket.html b/docs/SymEncryptedIntegrityProtectedDataPacket.html
index a5ea6f5c..0f6e8c78 100644
--- a/docs/SymEncryptedIntegrityProtectedDataPacket.html
+++ b/docs/SymEncryptedIntegrityProtectedDataPacket.html
@@ -101,7 +101,7 @@ packet.
@@ -795,7 +795,7 @@ See RFC 4880 9.2 f
diff --git a/docs/TrustPacket.html b/docs/TrustPacket.html
index cd54e56f..80c54ec2 100644
--- a/docs/TrustPacket.html
+++ b/docs/TrustPacket.html
@@ -105,7 +105,7 @@ other than local keyring files.
@@ -311,7 +262,7 @@ Currently not implemented as we ignore trust packets
diff --git a/docs/UserAttributePacket.html b/docs/UserAttributePacket.html
index 3984d09e..24642114 100644
--- a/docs/UserAttributePacket.html
+++ b/docs/UserAttributePacket.html
@@ -107,7 +107,7 @@ an implementation may use any method desired.
@@ -585,7 +585,7 @@ an implementation may use any method desired.
diff --git a/docs/UserIDPacket.html b/docs/UserIDPacket.html
index 06b7bbaa..0052d4c7 100644
--- a/docs/UserIDPacket.html
+++ b/docs/UserIDPacket.html
@@ -100,7 +100,7 @@ specifies the length of the User ID.
@@ -1552,8 +1725,8 @@ a session key or a password must be specified.
Object containing decrypted and verified message in the form:
{
- data: String|ReadableStream<String>|NodeStream, (if format was 'utf8', the default)
- data: Uint8Array|ReadableStream<Uint8Array>|NodeStream, (if format was 'binary')
+ data: MaybeStream<String>, (if format was 'utf8', the default)
+ data: MaybeStream<Uint8Array>, (if format was 'binary')
filename: String,
signatures: [
{
@@ -1591,7 +1764,7 @@ a session key or a password must be specified.
-
@@ -2215,8 +2399,8 @@ or 'undefined' if no key packets found
-
Encrypts message text/data with public keys, passwords or both at once. At least either public keys or passwords
-must be specified. If private keys are specified, those will be used to sign the message.
+
Encrypts message text/data with public keys, passwords or both at once. At least either encryption keys or passwords
+must be specified. If signing keys are specified, those will be used to sign the message.
@@ -2333,16 +2517,16 @@ must be specified. If private keys are specified, those will be used to sign the
-
publicKeys
+
encryptionKeys
-Key
+PublicKey
|
-Array.<Key>
+Array.<PublicKey>
@@ -2373,16 +2557,16 @@ must be specified. If private keys are specified, those will be used to sign the
-
privateKeys
+
signingKeys
-Key
+PrivateKey
|
-Array.<Key>
+Array.<PrivateKey>
@@ -2637,7 +2821,7 @@ must be specified. If private keys are specified, those will be used to sign the
-
Array of key IDs to use for signing. Each signingKeyIDs[i] corresponds to privateKeys[i]
+
Array of key IDs to use for signing. Each signingKeyIDs[i] corresponds to signingKeys[i]
@@ -2676,7 +2860,7 @@ must be specified. If private keys are specified, those will be used to sign the
-
Array of key IDs to use for encryption. Each encryptionKeyIDs[i] corresponds to publicKeys[i]
+
Array of key IDs to use for encryption. Each encryptionKeyIDs[i] corresponds to encryptionKeys[i]
@@ -2722,7 +2906,7 @@ must be specified. If private keys are specified, those will be used to sign the
-
fromUserIDs
+
signingUserIDs
@@ -2754,14 +2938,14 @@ must be specified. If private keys are specified, those will be used to sign the
-
Array of user IDs to sign with, one per key in privateKeys, e.g. [{ name: 'Steve Sender', email: 'steve@openpgp.org' }]
+
Array of user IDs to sign with, one per key in signingKeys, e.g. [{ name: 'Steve Sender', email: 'steve@openpgp.org' }]
-
toUserIDs
+
encryptionUserIDs
@@ -2793,7 +2977,7 @@ must be specified. If private keys are specified, those will be used to sign the
-
Array of user IDs to encrypt for, one per key in publicKeys, e.g. [{ name: 'Robert Receiver', email: 'robert@openpgp.org' }]
+
Array of user IDs to encrypt for, one per key in encryptionKeys, e.g. [{ name: 'Robert Receiver', email: 'robert@openpgp.org' }]
@@ -2880,7 +3064,7 @@ must be specified. If private keys are specified, those will be used to sign the
@@ -4039,7 +4223,7 @@ or passwords must be specified.
-
The passphrase used to encrypt the generated private key
+
The passphrase used to encrypt the generated private key. If omitted, the key won't be encrypted.
@@ -4236,8 +4420,8 @@ brainpoolP256r1, brainpoolP384r1, or brainpoolP512r1
-
Options for each subkey, default to main key options. e.g. [{sign: true, passphrase: '123'}]
-sign parameter defaults to false, and indicates whether the subkey should sign rather than encrypt
+
Options for each subkey e.g. [{sign: true, passphrase: '123'}]
+default to main key options, except for sign parameter that defaults to false, and indicates whether the subkey should sign rather than encrypt
@@ -4324,7 +4508,7 @@ sign parameter defaults to false, and indicates whether the subkey should sign r
@@ -4473,16 +4657,16 @@ sign parameter defaults to false, and indicates whether the subkey should sign r
-
publicKeys
+
encryptionKeys
-Key
+PublicKey
|
-Array.<Key>
+Array.<PublicKey>
@@ -4550,7 +4734,7 @@ sign parameter defaults to false, and indicates whether the subkey should sign r
-
toUserIDs
+
encryptionUserIDs
@@ -4669,7 +4853,7 @@ sign parameter defaults to false, and indicates whether the subkey should sign r
@@ -7102,8 +7899,8 @@ If a revocation certificate is passed, the reasonForRevocation parameter will be
The revoked key object in the form:
-{ privateKey:Key, privateKeyArmored:String, publicKey:Key, publicKeyArmored:String }
-(if private key is passed) or { publicKey:Key, publicKeyArmored:String } (otherwise)
+{ privateKey:PrivateKey, privateKeyArmored:String, publicKey:PublicKey, publicKeyArmored:String }
+(if private key is passed) or { publicKey:PublicKey, publicKeyArmored:String } (otherwise)
@@ -7132,7 +7929,7 @@ If a revocation certificate is passed, the reasonForRevocation parameter will be
-
@@ -7260,16 +8057,16 @@ If a revocation certificate is passed, the reasonForRevocation parameter will be
-
privateKeys
+
signingKeys
-Key
+PrivateKey
|
-Array.<Key>
+Array.<PrivateKey>
@@ -7408,7 +8205,7 @@ If a revocation certificate is passed, the reasonForRevocation parameter will be
-
Array of key IDs to use for signing. Each signingKeyIDs[i] corresponds to privateKeys[i]
+
Array of key IDs to use for signing. Each signingKeyIDs[i] corresponds to signingKeys[i]
@@ -7454,7 +8251,7 @@ If a revocation certificate is passed, the reasonForRevocation parameter will be
-
fromUserIDs
+
signingUserIDs
@@ -7486,7 +8283,7 @@ If a revocation certificate is passed, the reasonForRevocation parameter will be
-
Array of user IDs to sign with, one per key in privateKeys, e.g. [{ name: 'Steve Sender', email: 'steve@openpgp.org' }]
+
Array of user IDs to sign with, one per key in signingKeys, e.g. [{ name: 'Steve Sender', email: 'steve@openpgp.org' }]
@@ -7573,7 +8370,7 @@ If a revocation certificate is passed, the reasonForRevocation parameter will be
@@ -8228,8 +9025,8 @@ an attribute "data" containing a stream of bytes and "type"
Object containing verified message in the form:
{
- data: String|ReadableStream<String>|NodeStream, (if `message` was a CleartextMessage)
- data: Uint8Array|ReadableStream<Uint8Array>|NodeStream, (if `message` was a Message)
+ data: MaybeStream<String>, (if `message` was a CleartextMessage)
+ data: MaybeStream<Uint8Array>, (if `message` was a Message)
signatures: [
{
keyID: module:type/keyid~KeyID,
@@ -8276,7 +9073,7 @@ an attribute "data" containing a stream of bytes and "type"
@@ -410,7 +410,7 @@ It's possible to change that behaviour by enabling compression through the confi
Streaming encrypt Uint8Array data with a password
(async () => {
- const readableStream = new openpgp.stream.ReadableStream({
+ const readableStream = new ReadableStream({
start(controller) {
controller.enqueue(new Uint8Array([0x01, 0x02, 0x03]));
controller.close();
@@ -427,22 +427,17 @@ It's possible to change that behaviour by enabling compression through the confi
// Either pipe the above stream somewhere, pass it to another function,
// or read it manually as follows:
- const reader = openpgp.stream.getReader(encrypted);
- while (true) {
- const { done, value } = await reader.read();
- if (done) break;
- console.log('new chunk:', value); // Uint8Array
+ for await (const chunk of encrypted) {
+ console.log('new chunk:', chunk); // Uint8Array
}
-
- // Or, in Node.js, you can pipe the above stream as follows:
- const nodeStream = openpgp.stream.webToNode(encrypted);
- nodeStream.pipe(nodeWritableStream);
})();
You can also pass a Node.js Readable
+stream, in
+which case OpenPGP.js will return a Node.js Readable stream as well, which you
+can .pipe() to a Writable stream, for example.
Streaming encrypt and decrypt String data with PGP keys
(async () => {
const publicKeyArmored = `-----BEGIN PGP PUBLIC KEY BLOCK-----
@@ -460,7 +455,7 @@ its Reader classReader class
@@ -614,7 +613,7 @@ and a subkey for encryption using Curve25519.
Streaming sign and verify Uint8Array data
(async () => {
- var readableStream = new openpgp.stream.ReadableStream({
+ var readableStream = new ReadableStream({
start(controller) {
controller.enqueue(new Uint8Array([0x01, 0x02, 0x03]));
controller.close();
@@ -646,7 +645,7 @@ and a subkey for encryption using Curve25519.
publicKeys: await openpgp.readKey({ armoredKey: publicKeyArmored }) // for verification
});
- await openpgp.stream.readToEnd(verified.data);
+ for await (const chunk of verified.data) {}
// Note: you *have* to read `verified.data` in some way or other,
// even if you don't need it, as that is what triggers the
// verification of the data.
@@ -687,7 +686,7 @@ and a subkey for encryption using Curve25519.
diff --git a/docs/module-config.html b/docs/module-config.html
index 8853f602..90f3d7b1 100644
--- a/docs/module-config.html
+++ b/docs/module-config.html
@@ -89,7 +89,7 @@
@@ -3380,7 +3380,7 @@ Note: not all OpenPGP implementations are compatible with this option.
diff --git a/docs/module-crypto_random-RandomBuffer.html b/docs/module-crypto_random-RandomBuffer.html
index 685f8e8f..6d565c43 100644
--- a/docs/module-crypto_random-RandomBuffer.html
+++ b/docs/module-crypto_random-RandomBuffer.html
@@ -95,7 +95,7 @@