microsoft / SEAL

Microsoft SEAL is an easy-to-use and powerful homomorphic encryption library.
https://www.microsoft.com/en-us/research/group/cryptography-research/
MIT License
3.51k stars 702 forks source link

Sharing a private key #534

Open patriciaOrtuno28 opened 2 years ago

patriciaOrtuno28 commented 2 years ago

Hello, I wanted to find a way to share a private key between devices safely. I thought about encrypting a 0 in device A and sending that ciphertext to device B. In this location, I wanted to add that encrypted 0 to B's private key and, back in A's device, substract it. I don't think a ciphertext can be added to a private key, but it was the closest representation of an XOR I could think of. I was wondering if anybody knew a way to share that private key safely between devices, maybe wrapping it inside another key, or if the sum between ciphertexts and keys is viable. Thank you in advance.

fionser commented 2 years ago

For example to encrypt the SEAL's key using other symmetric/asymmetric crypto (AES or RSA)?

patriciaOrtuno28 commented 2 years ago

For example to encrypt the SEAL's key using other symmetric/asymmetric crypto (AES or RSA)?

I was trying to avoid that. What I was thinking of was the addition between the Ciphertext of a 0 with the Plaintext of a secret key. The issue would be the size of that Plaintext. I'm not sure how to split the key into chunks that fit the maximum size of the Plaintext. The size is so large that I get an error of "plain is not valid for encryption parameters".

gelintonx commented 2 years ago

Hello, I wanted to find a way to share a private key between devices safely. I thought about encrypting a 0 in device A and sending that ciphertext to device B. In this location, I wanted to add that encrypted 0 to B's private key and, back in A's device, substract it. I don't think a ciphertext can be added to a private key, but it was the closest representation of an XOR I could think of. I was wondering if anybody knew a way to share that private key safely between devices, maybe wrapping it inside another key, or if the sum between ciphertexts and keys is viable. Thank you in advance.

In my opinion, the best way to share a private key is using Shamir's Secret Sharing algorithm https://www.geeksforgeeks.org/shamirs-secret-sharing-algorithm-cryptography/ I hope it helps you.

WeiDaiWD commented 2 years ago

You can take a look at how key switching keys, i.e., relinearization keys and Galois keys, are generated. That could be your example of encrypting a secret key using SEAL. But overall for communication and computation efficiency, one would use AES to encrypt data if no homomorphic functionality is planned.