cURL

#!/usr/bin/env bash


# Failing certificate pinning example
$ curl --pinnedpubkey "sha256//$(curl https://api.cert.ist/wordpress.com -sq | jq -r .openssl.pubkey.der_sha256)" https://urip.io; echo $?
curl: (90) SSL: public key does not match pinned public key!
90
# note the exit status of 90.  This corresponds with the libcurl error code: CURLE_SSL_PINNEDPUBKEYNOTMATCH
# refrerence: https://curl.haxx.se/libcurl/c/libcurl-errors.html#CURLESSLPINNEDPUBKEYNOTMATCH


# Successful certificate pinning example
$ curl --pinnedpubkey "sha256//$(curl https://api.cert.ist/urip.io -sq | jq -r .openssl.pubkey.der_sha256)" https://urip.io; echo $?
1.2.3.4
0