Sharing a PGP message that is already encrypted #1705
Replies: 1 comment 5 replies
-
There is const [sessionKey] = await decryptSessionKeys({ message, decryptionKeys: <originalRecipientKeys> });
const reEncryptedSessionKey = await encryptSessionKey({
...sessionKey,
encryptionKeys: <newRecipientPublicKeys>,
format: 'binary'
});
const finalBinaryMessage = new Uint8Array([...reEncryptedSessionKey, ...message.write()]);
const finalArmoredMessage = await openpgp.readMessage({ binaryMessage: finalBinaryMessage }).then(parsed => parsed.armor()); If you want to filter out the original encrypted session keys, you can use e.g. PS: if the original message is signed, and includes an |
Beta Was this translation helpful? Give feedback.
-
Hey!
I'm trying to share an encrypted PGP message with multiple users.
To do this I need to:
session key
packets from the PGP message usingdecryptSessionKeys
.session key
usingencrypt
and passing as encryption key thereceiver PGP public key
.encrypted data packets
and theencrypted key packets
from step 2.The problem I'm having, is that I don't know how to get only the
encrypted data packets
from the PGP message to avoid having to encrypt again the data to be shared.Is this possible? Or I have to create a new
passphrase
to encrypt the PGP message, and then encrypt thepassphrase
with thereceiver PGP public key
?Thank you!
Beta Was this translation helpful? Give feedback.
All reactions