How to Generate an RSA Keypair?
To integrate the API endpoints with signature.
First you need to generate an RSA keypair. After you generate the RSA keypair, you will get PrivateKey
and PublicKey
.
- The
PrivateKey
is used to sign the request. - The
PublicKey
is used to verify the signature.
Then you keep the PrivateKey
in a secure place and share the PublicKey
with the API provider.
Getting Started
This guide will show the step by step process of generating an RSA keypair using the openssl
command.
Install openssl
Please make sure you have openssl
installed on your system.
There is many ways to install openssl
on your system.
Generate RSA Keypair
To generate an RSA keypair, run the following command:
openssl genrsa -out {{name}}_private.pem 2048
openssl rsa -in {{name}}_private.pem -pubout -out {{name}}_public.pem
openssl rsa -in {{name}}_private.pem -out {{name}}_private_t.pem -traditional
You can replace the {{name}}
to any name you want.
You will get these 3 files:
{{name}}_private_t.pem
: Private key file in traditional format{{name}}_public.pem
: Public key file{{name}}_private.pem
: Private key file
We need to exchange PrivateKey(1) and PublicKey(2) for the API integration with signature.