Asymmetric Cryptography using the Account Public/Private Key pair

Hello,

I was working on a project which requires encryption of the note data before using it in the note field. I was thinking of using asymmetric cryptography. I am also quiet new to cryptography.

But I am unsure how to proceed using the Public private key pair for such a solution using the JAVA SDK.Since the keys available has undegone transformation to make it human readable. I would like to receive just the public and private keys of type publicKey and privateKey respectively to be used .

Thanks for all the help.
Anup

While it would be technically possible, it is highly recommended not to use the same key for two purposes: signing transactions and encrypting data. Doing so can yield complex attack vectors that are difficult to foresee and mitigate.

To encrypt data in an asymmetric way, one of the simplest solution is to use https://libsodium.gitbook.io/doc/public-key_cryptography/sealed_boxes (using a different pair of public key / secret key than the ones used for the account).