summaryrefslogtreecommitdiffstats
path: root/net/cert/x509_certificate.cc
diff options
context:
space:
mode:
authorpneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-18 13:30:36 +0000
committerpneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-18 13:30:36 +0000
commit38e2860572389123e81ab7b87d6b6e0a7328e700 (patch)
tree7f8ca2dec7d6059381ceb12aef6490926e928775 /net/cert/x509_certificate.cc
parent4caf7f86c0e9e26b0a3d3b56dc46c3944379d410 (diff)
downloadchromium_src-38e2860572389123e81ab7b87d6b6e0a7328e700.zip
chromium_src-38e2860572389123e81ab7b87d6b6e0a7328e700.tar.gz
chromium_src-38e2860572389123e81ab7b87d6b6e0a7328e700.tar.bz2
Refactor certificate reference resolving in ONC.
In ONC certificates are referenced by GUIDs. The resolve code replaces these by the certs' PEM encoding. After this change the resolve function is - separated from the actual certificate import. - doesn't require the creation of any X509Certificate. BUG=208986 R=eroman@chromium.org, rsleevi@chromium.org, stevenjb@chromium.org Review URL: https://codereview.chromium.org/18190005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212341 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/cert/x509_certificate.cc')
-rw-r--r--net/cert/x509_certificate.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/net/cert/x509_certificate.cc b/net/cert/x509_certificate.cc
index 97b00c3..36e806e 100644
--- a/net/cert/x509_certificate.cc
+++ b/net/cert/x509_certificate.cc
@@ -656,10 +656,9 @@ bool X509Certificate::VerifyNameMatch(const std::string& hostname) const {
}
// static
-bool X509Certificate::GetPEMEncoded(OSCertHandle cert_handle,
- std::string* pem_encoded) {
- std::string der_encoded;
- if (!GetDEREncoded(cert_handle, &der_encoded) || der_encoded.empty())
+bool X509Certificate::GetPEMEncodedFromDER(const std::string& der_encoded,
+ std::string* pem_encoded) {
+ if (der_encoded.empty())
return false;
std::string b64_encoded;
if (!base::Base64Encode(der_encoded, &b64_encoded) || b64_encoded.empty())
@@ -679,6 +678,15 @@ bool X509Certificate::GetPEMEncoded(OSCertHandle cert_handle,
return true;
}
+// static
+bool X509Certificate::GetPEMEncoded(OSCertHandle cert_handle,
+ std::string* pem_encoded) {
+ std::string der_encoded;
+ if (!GetDEREncoded(cert_handle, &der_encoded))
+ return false;
+ return GetPEMEncodedFromDER(der_encoded, pem_encoded);
+}
+
bool X509Certificate::GetPEMEncodedChain(
std::vector<std::string>* pem_encoded) const {
std::vector<std::string> encoded_chain;