I recently started using HKPK Public Key Pinning.
I have an automated script that generates my csr, certificate, and installs into apache2 on opensuse leap 42.3
I'm looking for a way to add spki fingerprints to the Public Key Pin header in my VirtualHost file.
I generate the fingerprint with:
openssl x509 -pubkey < certificate.crt | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | base64
I need to auto add:
pin-sha256=\"spki_fingerprint_here\";
I need to do this without completely rewriting the whole line so the pin-sha256 values in front stay and the config:
max-age=345600; includeSubDomains"
...at the end stays where it is ^^.
The whole line looks like:
Header set Public-Key-Pins "pin-sha256=\"spki_fingerprint1\"; pin-sha256=\"spki_fingerprint2\"; pin-sha256=\"new_spki_fingerprint_added_here\"; max-age=2592000; includeSubDomains"
I'm not a programmer or linux 'expert'
Any advice that can lead me in the right direction would be very helpful. Thank you in advance.