diff options
author | Ben Murdoch <benm@google.com> | 2011-06-02 12:07:03 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-10 10:47:21 +0100 |
commit | 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch) | |
tree | e4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp | |
parent | 87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff) | |
download | external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2 |
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp')
-rw-r--r-- | Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp b/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp index 4b415a4..08c9a93 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp @@ -31,6 +31,7 @@ #include "WebCertificateInfo.h" #include <WebCore/ResourceHandle.h> #include <WebCore/SimpleFontData.h> +#include <wtf/text/CString.h> #include <windows.h> #include <winbase.h> @@ -99,10 +100,10 @@ void InjectedBundle::setHostAllowsAnyHTTPSCertificate(const String& host) #endif } -void InjectedBundle::setClientCertificate(const String& host, const WebCertificateInfo* certificateInfo) +void InjectedBundle::setClientCertificate(const String& host, const String& certificateSystemStoreName, const WebCertificateInfo* certificateInfo) { #if USE(CFNETWORK) - ASSERT(certificateInfo); + ASSERT_ARG(certificateInfo, certificateInfo); if (!certificateInfo) return; @@ -111,7 +112,29 @@ void InjectedBundle::setClientCertificate(const String& host, const WebCertifica if (certificateChain.size() != 1) return; - ResourceHandle::setClientCertificate(host, WebCore::copyCertificateToData(certificateChain.first()).get()); + ASSERT_ARG(certificateSystemStoreName, !certificateSystemStoreName.isEmpty()); + if (certificateSystemStoreName.isEmpty()) + return; + + // The PCCERT_CONTEXT in the WebCertificateInfo we created using the message from the UI process doesn't contain enough information + // to actually use it in a request, we need to get the real certificate from the certificate store (which is typically the "MY" store). + String mutableCertificateSystemStoreName = certificateSystemStoreName; + HCERTSTORE certStore = ::CertOpenSystemStore(0, mutableCertificateSystemStoreName.charactersWithNullTermination()); + if (!certStore) { + LOG_ERROR("Could not open system certificate store %s", certificateSystemStoreName.ascii().data()); + return; + } + + PCCERT_CONTEXT realCert = ::CertFindCertificateInStore(certStore, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, CERT_FIND_EXISTING, certificateChain.first(), 0); + if (!realCert) { + LOG_ERROR("Could not find certificate in system certificate store"); + return; + } + + ResourceHandle::setClientCertificate(host, WebCore::copyCertificateToData(realCert).get()); + CertFreeCertificateContext(realCert); + + // We can't close certStore here, since the certificate is still in use. #endif } |