| Index: net/base/x509_certificate_mac.cc
|
| ===================================================================
|
| --- net/base/x509_certificate_mac.cc (revision 113824)
|
| +++ net/base/x509_certificate_mac.cc (working copy)
|
| @@ -812,7 +812,7 @@
|
| }
|
|
|
| CSSM_BOOL confirmRequired;
|
| - CSSM_TP_RESULT_SET *resultSet = NULL;
|
| + CSSM_TP_RESULT_SET* resultSet = NULL;
|
| crtn = CSSM_TP_RetrieveCredResult(tp_handle, &refId, NULL, &estTime,
|
| &confirmRequired, &resultSet);
|
| ScopedEncodedCertResults scopedResults(resultSet);
|
| @@ -1514,4 +1514,43 @@
|
| cert_data.Length);
|
| }
|
|
|
| +// static
|
| +void X509Certificate::GetPublicKeyInfo(OSCertHandle cert_handle,
|
| + size_t* size_bits,
|
| + PublicKeyType* type) {
|
| + SecKeyRef key;
|
| + OSStatus status = SecCertificateCopyPublicKey(cert_handle, &key);
|
| + if (status) {
|
| + NOTREACHED() << "SecCertificateCopyPublicKey failed: " << status;
|
| + return;
|
| + }
|
| + ScopedCFTypeRef<SecKeyRef> scoped_key;
|
| +
|
| + const CSSM_KEY* cssm_key;
|
| + status = SecKeyGetCSSMKey(key, &cssm_key);
|
| + if (status) {
|
| + NOTREACHED() << "SecKeyGetCSSMKey failed: " << status;
|
| + return;
|
| + }
|
| +
|
| + *size_bits = cssm_key->KeyHeader.LogicalKeySizeInBits;
|
| +
|
| + switch (cssm_key->KeyHeader.AlgorithmId) {
|
| + case CSSM_ALGID_RSA:
|
| + *type = kPublicKeyTypeRSA;
|
| + break;
|
| + case CSSM_ALGID_DSA:
|
| + *type = kPublicKeyTypeDSA;
|
| + break;
|
| + case CSSM_ALGID_ECDSA:
|
| + *type = kPublicKeyTypeECDSA;
|
| + break;
|
| + case CSSM_ALGID_DH:
|
| + *type = kPublicKeyTypeDH;
|
| + break;
|
| + default:
|
| + *type = kPublicKeyTypeUnknown;
|
| + }
|
| +}
|
| +
|
| } // namespace net
|
|
|