Closed sirpy closed 6 months ago
This is normal and expected. ECDH-1PU is not bidirectional. The shared secret is computed as a concatenation between 2 ECDH operations:
ephemeralSecret * recipientPublicKey || senderSecret * recipientPublicKey
recipientSecret * ephemeralPublicKey || recipientSecret * senderPublicKey
If you try to replace the recipient with the sender you would compute:
senderSecret * ephemeralPublicKey || senderSecret * recipientPublicKey
as the shared secret, but the first half would not match and therefore result in a different shared secret.
A similar situation happens with ECDH-ES, where the shared secret is computed between the recipient key pair and an ephemeral key pair (whose secret part is discarded by the sender).
Please close this issue if this information is sufficient.
ok thanks. is there an option to use regular ecdh?
For the moment, no. But you're free to try to create your own.
Prerequisites
Please answer the following questions for yourself before submitting an issue.
Current Behavior
The decrypter fails when trying to decode sender message with sender secretkey
Expected Behavior
Sender should be able to decrypt his own message since the shared secret should be the same in ecdh
Please provide detailed steps for reproducing the issue.