Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/base/x509_certificate.h" | 5 #include "net/base/x509_certificate.h" |
| 6 | 6 |
| 7 #include <openssl/asn1.h> | 7 #include <openssl/asn1.h> |
| 8 #include <openssl/crypto.h> | 8 #include <openssl/crypto.h> |
| 9 #include <openssl/obj_mac.h> | 9 #include <openssl/obj_mac.h> |
| 10 #include <openssl/pem.h> | 10 #include <openssl/pem.h> |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 612 Pickle* pickle) { | 612 Pickle* pickle) { |
| 613 DERCache der_cache; | 613 DERCache der_cache; |
| 614 if (!GetDERAndCacheIfNeeded(cert_handle, &der_cache)) | 614 if (!GetDERAndCacheIfNeeded(cert_handle, &der_cache)) |
| 615 return false; | 615 return false; |
| 616 | 616 |
| 617 return pickle->WriteData( | 617 return pickle->WriteData( |
| 618 reinterpret_cast<const char*>(der_cache.data), | 618 reinterpret_cast<const char*>(der_cache.data), |
| 619 der_cache.data_length); | 619 der_cache.data_length); |
| 620 } | 620 } |
| 621 | 621 |
| 622 //static | |
|
agl
2011/11/16 15:57:55
space before "static"
| |
| 623 void X509Certificate::GetPublicKeyInfo(OSCertHandle cert_handle, | |
| 624 size_t* size_bits, | |
| 625 PublicKeyType* type) { | |
| 626 EVP_PKEY* key = X509_get_pubkey(cert_handle); | |
| 627 *size_bits = EVP_PKEY_size(key) * 8; | |
| 628 | |
| 629 switch (key->type) { | |
| 630 case EVP_PKEY_RSA: | |
| 631 *type = PublicKeyType::RSA; | |
| 632 break; | |
| 633 case EVP_PKEY_DSA: | |
| 634 *type = PublicKeyType::DSA; | |
| 635 break; | |
| 636 case EVP_PKEY_EC: | |
| 637 *type = PublicKeyType::EC; | |
| 638 break; | |
| 639 case EVP_PKEY_DH: | |
| 640 *type = PublicKeyType::DH; | |
| 641 break; | |
| 642 default: | |
| 643 *type = PublicKeyType::NONE; | |
| 644 } | |
| 645 } | |
| 646 | |
| 622 } // namespace net | 647 } // namespace net |
| OLD | NEW |