0

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.

Ashutosh B Bodake
  • 1,304
  • 1
  • 19
  • 31
  • https://blog.lextudio.com/simple-public-private-key-signing-sample-code-6f95d19fdbc If you can sign data, you can use similar approach to encrypt and decrypt. – Lex Li Jun 22 '17 at 14:46
  • 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 Jun 22 '17 at 15:16
  • 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 Jun 22 '17 at 15:19

1 Answers1

0

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

Rana
  • 53
  • 1
  • 8
  • It would be useful if you provide the guide in your answer as text and not in a video/link format as they may stop working in the future. – Cray Jun 23 '19 at 13:07