Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of field plaintext_original #8

Open
claudefalbriard opened this issue Aug 3, 2022 · 5 comments
Open

Use of field plaintext_original #8

claudefalbriard opened this issue Aug 3, 2022 · 5 comments

Comments

@claudefalbriard
Copy link

I would like to clarify a conceptual doubt regarding use of the "encrypt" function described in the sample section of "Key Encapsulation". The execution confirms successful execution of the "assert" command, confirming encrypt and decrypt operations. When validating the field named plaintext_original with a Python print command, I get a binary field which does not match any standard decode methods like: UTF-8, or ISO-8859-1. After calling the encrypt function, the plaintext_original gets unreadable, likely the field gets modified by the C language processing. Is there a way to set a value for plaintext_original and keep it unmodified and validate it at the end of the encode/decode process?

@kpdemetriou
Copy link
Owner

No, and this is intentional. That said, you can use the "plaintext" as a key to a symmetric cipher to achieve the desired effect.

@neomn
Copy link

neomn commented Oct 15, 2023

@kpdemetriou in some cases , this is required to encrypt a custom message(plain_text) using public key , so there is no way to do that ? or should i implement it myself ?

@kpdemetriou
Copy link
Owner

The KEMs provided in this module are not meant to encrypt arbitrary plaintext directly. Rather, you can use plaintext_original and plaintext_recovered to key a symmetric cipher like AES to achieve bulk encryption of content.

@neomn
Copy link

neomn commented Oct 16, 2023

@kpdemetriou
then what about asymmetric ? what if i want to encrypt a message using public key such that could be decrypted only using private key ?

@Artucuno
Copy link

The KEMs provided in this module are not meant to encrypt arbitrary plaintext directly. Rather, you can use plaintext_original and plaintext_recovered to key a symmetric cipher like AES to achieve bulk encryption of content.

Are you able to give an example of how this is done?

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

No branches or pull requests

4 participants