Get Certificate SHA1 Fingerprint

Hello,

How do I go about getting the SHA1 fingerprint from a PEM certificate I have on disk?


I tried using SecCertificateCreateWithData and getting the SHA1Digest but it dones not match whats in the certificate.


Thanks!

How do I go about getting the SHA1 fingerprint from a PEM certificate I have on disk?

What platform are you working on?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hi Quinn, I'm using macOS.

macOS can import PEM certificates directly (using

SecItemImport
). Once you have a certificate object you can get a SHA1 fingerprint by getting the certificate in DER form (
SecCertificateCopyData
) and then doing a SHA1 of that data (with
CC_SHA1
).

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Get Certificate SHA1 Fingerprint
 
 
Q