DEV Community

Discussion on: Certificate Pinning your Android and iOS apps.

Collapse
 
silentsudo profile image
Ashish Agre • Edited

HI Daniel, this is great blog post, i was thinking to write one, but found this one, so instead creating new one i would append my post content here :),

Along with the content metioned by Daniel, we can also generate sha key from terminal using public certificate received from openssl s_connect command.

First create a file using touch command say touch test.crt, then run openssl s_client -connect www.google.com:443 copy content beginning from -----BEGIN CERTIFICATE----- to... -----END CERTIFICATE----- in test.crt after that run this command openssl x509 -in test.crt -pubkey -noout | openssl rsa -pubin -outform der | openssl dgst -sha256 -binary | \
openssl enc -base64
this most probably should give you correct value. For more information please refer this page developer.mozilla.org/en-US/docs/W...