0
votes

I want to create certificate with public and private key. Then I want to extract public key from it and with the help of public key I want to encrypt data.

On the receiver side I want to decrypt data.

How can i create required certificate? Sample code for encryption and decryption.

1
blog.lextudio.com/… If you can sign data, you can use similar approach to encrypt and decrypt. - Lex Li
Public/private key encryption (asymmetric encryption such as RSA and ECC) is limited in the size of the data that can be encrypted to less than the size of the key. It is also very slow. For these reasons data is generally encrypted with symmetric key encryption such as AES. If the key attributes of asymmetric encryption are required generally hybrid encryption is used. That means that a random key is created for encryption of the data with symmetric key encryption and that key is encrypted with asymmetric key encryption. These two encrypted results are then packaged together. - zaph
The answer is to hire a cryptographic domain expert in the same way a general practitioner doctor refers to a specialist for areas out of his field of expertise. Getting a cryptography correct, by that I mean secure, is hard and requires substantial expertise. - zaph

1 Answers

0
votes

You can use OpenSSL for creating a certificate with public and private keys.

Using that certificate you can generate the public from it.

The following video series will guide you in that process

https://www.youtube.com/watch?v=1xtBkukWiek