Score:2

Is it possible to encrypt data with two public keys?

US flag
eric su

Can we encrypt data with two public keys and the encrypted data only needs one private key to decrypt once encrypted?

poncho avatar
my flag
Is there anything wrong with the traditional approach of producing a ciphertext that consists of two separate encryptions (one with the first public key, one with the second)?
Score:4
ng flag

Yes, we can encrypt with two public keys $\text{Pub}_0$ and $\text{Pub}_1$, then decipher with one private key $\text{Pub}_i$ matching either one of the two public keys. As noted in comment, the simplest method is to encipher to both keys, at the expense of doubling the ciphertext size.

But for large plaintext, we'll be using hybrid encryption, and then there's a bounded size penalty for each recipient. For two keys key pairs $(\text{Pub}_0,\operatorname{Priv}_0)$ and $(\text{Pub}_1,\operatorname{Priv}_1)$, and assuming recipients know if they are recipient $0$ or $1$, the encryption goes:

  • draw a random symmetric key $K$
  • asymmetrically encrypt $K$ with each public key forming the two $C_i=\operatorname{Enc}(\operatorname{Pub}_i,K)$
  • put the results $C_0\mathbin\|C_1$ at start of ciphertext
  • symmetrically encrypt the data using $K$ (e.g. with AES-GCM), forming the rest of the ciphertext.

Decryption by recipient $i$ goes

  • from the start of the ciphertext $C_0\mathbin\|C_1$ extract $C_i=\operatorname{Enc}(\operatorname{Pub}_i,K)$
  • asymmetrically decrypt $K=\operatorname{Dec}(\operatorname{Priv}_i,C_i)$
  • symmetrically decrypt the rest of the ciphertext data using $K$, getting the plaintext.

Extensions are possible so that recipients do not need to know their index (by adding a public key identifier to each $C_i$). This is common, e.g. with (Open)PGP/GPG asymmetric encryption, when it sends encrypted to several recipients.

A slightly more complex extension allows that while hiding who are the recipients.

Maarten Bodewes avatar
in flag
I understand from the question that there should be one private key with multiple public keys, but maybe that's me.
fgrieu avatar
ng flag
The question's _"only needs one private key to decrypt"_ does not imply a single private key. And to me, the question's _"two public keys"_ suggests two matching private keys.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.