Index: net/cert/x509_certificate_ios.cc |
diff --git a/net/cert/x509_certificate_ios.cc b/net/cert/x509_certificate_ios.cc |
index ee10381953717316f7fc49590645fb0d4d608886..1e63cb6fd173adfbdf1a5aede422abbd17893377 100644 |
--- a/net/cert/x509_certificate_ios.cc |
+++ b/net/cert/x509_certificate_ios.cc |
@@ -184,6 +184,22 @@ SHA1HashValue X509Certificate::CalculateFingerprint( |
} |
// static |
+SHA256HashValue X509Certificate::CalculateFingerprint256(OSCertHandle cert) { |
+ SHA256HashValue sha256; |
+ memset(sha256.data, 0, sizeof(sha256.data)); |
+ |
+ ScopedCFTypeRef<CFDataRef> cert_data(SecCertificateCopyData(cert)); |
+ if (!cert_data) |
+ return sha256; |
+ DCHECK(CFDataGetBytePtr(cert_data)); |
+ DCHECK_NE(0, CFDataGetLength(cert_data)); |
+ CC_SHA256( |
+ CFDataGetBytePtr(cert_data), CFDataGetLength(cert_data), sha256.data); |
+ |
+ return sha256; |
+} |
+ |
+// static |
SHA1HashValue X509Certificate::CalculateCAFingerprint( |
const OSCertHandles& intermediates) { |
SHA1HashValue sha1; |