Skip to content

Conversation

@RandomEngy
Copy link

Made some changes to the example code so it compiles.

  • It's necessary to call keypair.raw_components() and pass the EcKeyComponents instance to the decrypt methods. Passing in the keypair directly to the decrypt methods does not work. Updated the usage notes accordingly.
  • AesGcmEncryptedBlock was moved to the legacy module, reflected that.
  • Fixed parameter order on AesGcmEncryptedBlock::new

Made some changes to the example code so it compiles.

* It's necessary to call `keypair.raw_components()` and pass the `EcKeyComponents` instance to the decrypt methods. Passing in the keypair directly to the decrypt methods does not work. Updated the usage notes accordingly.
* AesGcmEncryptedBlock was moved to the `legacy` module, reflected that.
* Fixed parameter order on `AesGcmEncryptedBlock::new`
// You'll need to consult the spec for how to do this; we might add some helpers one day.
let encrypted_block = ece::AesGcmEncryptedBlock::new(dh, rs, salt, ciphertext);
let plaintext = ece::legacy::decrypt_aesgcm(keypair, auth_secret, encrypted_block)?;
let encrypted_block = ece::legacy::AesGcmEncryptedBlock::new(dh, salt, rs, ciphertext);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it doesn't matter for the complier, but why did you change the order of salt and rs?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the order of the parameters in AesGcmEncryptedBlock::new. The code doesn't compile if you use the old order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants