keybase / saltpack

a modern crypto messaging format
https://saltpack.org/
BSD 3-Clause "New" or "Revised" License
989 stars 62 forks source link

No function to create a `saltpack.BoxPublicKey` without possession of the secret key #101

Open antonis19 opened 7 months ago

antonis19 commented 7 months ago

I am trying to use the EncryptArmor62Seal function to encrypt a message for another party. I am following the example here:

https://pkg.go.dev/github.com/keybase/saltpack@v0.0.0-20231213211625-726bb684c617#EncryptArmor62Seal

The issue with the example is that the public key for the receiver is obtained based on the secret key of the receiver. So the conversion process is:

saltpack.BoxSecretKey -> saltpack.BoxPublicKey

However in a real world application you don't have (and shouldn't have) the private key of the recipient. You only have the raw bytes of the public key. But going through the documentation I found that every constructor function or import function presupposes the possession of the private key, which we don't have.

So how can I encrypt a message when all I have is my own private key and the 32 byte array raw public key of the recipient?