Generate ECC Private Key. We will be generating a private key using the prime256v1 ECC curve. Openssl ecparam -out private.key -name prime256v1 -genkey Generate Certificate Request. Now, use OpenSSL to generate a CSR (Certificate Signing Request) for signing the certificate. We will generate the CSR with 512-bit SHA2.
The example 'C' program eckeycreate.c demonstrates how to generate elliptic curve cryptography (ECC) key pairs, using the OpenSSL library functions.
Compile the test program with:
The program will create and display a new elliptic curve cryptography (ECC) key pair, similar to the output shown below:
Note: The list of possible ECC key types (curves) can be shown using the command openssl ecparam -list_curves.
Generate ssh key mac for gitlab. Using ECC keys for certificate generation can also be seen and tested in WebCert.
How to generate keys in PEM formatusing the OpenSSL command line tools?
The JOSE standard recommends a minimum RSA key size of 2048 bits.
To generate a 2048-bit RSA private + public key pair for use in RSxxx and PSxxxsignatures:
To generate an EC key pair the curve designation must be specified. Note thatJOSE ESxxx signatures require P-256, P-384 and P-521 curves (see theircorresponding OpenSSL identifiers below).
Elliptic Curve private + public key pair for use with ES256 signatures:
Elliptic Curve private + public key pair for use with ES384 signatures:
Elliptic Curve private + public key pair for use with ES512 signatures:
The BouncyCastle library provides a simpleutility to parse PEM-encoded keys in Java, to use them for JWS or JWE later.
For Maven you should include the following BouncyCastle dependencies (where1.52 is the latest stable version as of May 2015):
Example parsing of an PEM-encoded EC key in Java: