stefanocasazza / ULib

C++ application development framework, to help developers create and deploy applications quickly and simply
GNU Lesser General Public License v3.0
947 stars 107 forks source link

TLS_SPKI_PIN #79

Closed victorstewart closed 4 years ago

victorstewart commented 4 years ago

added the ability to pin SPKI hashes

use the below terminal command to generate a SHA256 hash of the SPKI (subject public key info) section of the certificate... which pins to not only the public key but also the algo etc.

openssl x509 -in /path/to/root/cert.pem -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64

pinning to just the public key is insecure, and pinning to certificates as a whole doesn't allow for the ability to refresh certificates while utilizing the same public key.

the point of this is to specify that only specific CAs are allowed to issue certificates for your domain, to protect against bad actors compromising some trusted root CA and issuing "valid" certificates for your domain.