Generate Leaf Cert From Public Key

  • How do I verify that a private key matches a certificate? To verify that an RSA private key matches the RSA public key in a certificate you need to i) verify the consistency of the private key and ii) compare the modulus of the public key in the certificate against the modulus of the private key.
  • Create a new certificate manually: This will create a public-private key pair and generate an X.509 certificate signing request. The signing request can be signed by your registration authority or certification authority. The signed x509 certificate can be merged with the pending key pair to complete the KV certificate in Key Vault.

As Zoredache said the entire point of public key cryptography is that you have two parts: A public half (.cert file) which encrypts data, and a private half (.key file) which lets you decrypt it again.The contents of the cert file are given to everyone who connects to your server. It would defeat the purpose of encrypting data if that information were usable to decrypt the traffic too.

General CSR Creation Guidelines

Linux generate cert

Before you can order an SSL certificate, it is recommended that you generate a Certificate Signing Request (CSR) from your server or device. Learn more about SSL certificates »

A CSR is an encoded file that provides you with a standardized way to send DigiCert your public key as well as some information that identifies your company and domain name. When you generate a CSR, most server software asks for the following information: common name (e.g., www.example.com), organization name and location (country, state/province, city/town), key type (typically RSA), and key size (2048-bit minimum).

If you aren't sure of the exact company name or location when you generate the CSR, don't worry; we can change and finalize that information during our review process before we issue the certificate.

Once your CSR is created, you'll need to copy and paste it into the online order form when you go to purchase your SSL certificate. Online Certificate Order Form »

Verify downloaded file
RSA Public Key pad and encrypt
Read ciphertext as Hex chars
Decrypt with RSA Private Key, from binary ciphertext
Decrypt with DES
Convert from ciphertext from hex to ciphertext
Base64 operations

Key Pairs

Convert private key file to PEM file
Print EC private key & extract public key

Generate Leaf Cert From Public Keyboard

Read EC public key
Print RSA private key & extract public key
Print the entire certificate

Certificates

Downloaded the leaf certificate from Stackoverflow.com.

Print the entire certificate
Create own cert from Private key

Use own private key to generate a self-signed certificate with it. This command creates a self-signed certificate (domain.crt) from an existing private key (domain.key):

Extract Public Key from Cert as PEM file
Print public key only
Strip the Generic Header and Footer
Generate Leaf Cert From Public Key
Extract Public Key from Cert in Hex format

Nginx Self-Signed Cert

Nginx needed the Leaf's Private Key the Leaf's Certificate or a certificate chain.

Whichever choice, I always found PEM files worked better with OpenSSL.

If you hit Expecting: TRUSTED CERTIFICATE error, check you actually chained the Certificates and NOT the Public Keys.

Apply the new Leaf Private Key and Certificate Chain:

Generate Leaf Cert From Public Keys

This all worked fine with Firefox and Safari on macOS. But Chrome gave: Error: 'Subject Alternative Name Missing'. Despite having a trusted Cert Chain (Root CA, Int CA), Chrome stopped the page loading.

To re-generate the files required by Nginx, I used the same Root CA, Int CA and focused on a new leaf that had a Subject Alternative Name. I used Keychain. See the picture below.

Generate Leaf Cert From Public Key Online

Reference