You first need to convert your cert from .p12 (pkcs12) to binary .der (DER) format to achieve this. The simplest method I can find is to use this tool.
Alternatively, you can do this yourself by first generating a PEM cert and then the DER cert using these commands:
openssl pkcs12 -in your_certificate.p12 -out your_certificate.pem
openssl rsa -inform PEM -outform DER -in your_certificate.pem -out your_certificate.der
Once you have your DER you can generate the SHA1 like this:
openssl dgst -sha1 your_certificate.der