Reputation: 409
I am a beginner in using Openssl in generating x509 certificates.
I would like to create a X509 certificate with my own RSA public key, i.e. own modulus and public exponent. Is it possible for me to do so? If yes, what is the procedure to that?
Upvotes: 1
Views: 2730
Reputation: 102246
If yes, what is the procedure to that?
There's a lot to it. My routines span 3 source files, so I know I can't easily copy/paste something. The answer is arguably too broad.
As a starting point, you should start with this OpenSSL command to generate a self signed certificate:
openssl req -config example-com.conf -new -x509 -sha256 \
-newkey rsa:2048 -nodes -keyout example-com.key.pem \
-days 365 -out example-com.cert.pem
That OpenSSL command creates a new self signed certificate. If you omit the -x509
option, then you generate a Certificate Signing Request (CSR).
Most options are self explanatory, The -nodes
means "no password on the private key". The other unknown is -config example-com.conf
, and you can find that at https://stackoverflow.com/a/26029695/608639.
Given you know the command and options, you should study the source code in <openssl src>/apps/req.c
. Its the source code for the openssl req ...
command. If you need the source code, you can download it from OpenSSL: Source, Tarballs.
Upvotes: 1