Changeset 82776 in webkit
- Timestamp:
- Apr 2, 2011 3:00:19 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r82773 r82776 1 2011-04-02 Jeff Miller <jeffm@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 WebKit2: Specify the certificate store in WKBundleSetClientCertificate() 6 https://bugs.webkit.org/show_bug.cgi?id=57707 7 8 Include the name of the system certificate store that the client certificate came from in WKBundleSetClientCertificate(). 9 10 The PCCERT_CONTEXT for the client certificate we create from 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). 11 12 * WebProcess/InjectedBundle/API/c/win/WKBundlePrivateWin.cpp: 13 (WKBundleSetClientCertificate): Add certificateSystemStoreName to parameters. 14 * WebProcess/InjectedBundle/API/c/win/WKBundlePrivateWin.h: Add certificateSystemStoreName to WKBundleSetClientCertificate() parameters. 15 * WebProcess/InjectedBundle/InjectedBundle.h: Add certificateSystemStoreName to setClientCertificate() parameters. 16 * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp: 17 (WebKit::InjectedBundle::setClientCertificate): Read the real certificate from the certificate store. 18 1 19 2011-04-02 Sam Weinig <sam@webkit.org> 2 20 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/win/WKBundlePrivateWin.cpp
r82370 r82776 38 38 } 39 39 40 void WKBundleSetClientCertificate(WKBundleRef bundleRef, WKStringRef host, WK CertificateInfoRef certificateInfoRef)40 void WKBundleSetClientCertificate(WKBundleRef bundleRef, WKStringRef host, WKStringRef certificateSystemStoreName, WKCertificateInfoRef certificateInfoRef) 41 41 { 42 toImpl(bundleRef)->setClientCertificate(toWTFString(host), to Impl(certificateInfoRef));42 toImpl(bundleRef)->setClientCertificate(toWTFString(host), toWTFString(certificateSystemStoreName), toImpl(certificateInfoRef)); 43 43 } -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/win/WKBundlePrivateWin.h
r82370 r82776 34 34 35 35 WK_EXPORT void WKBundleSetHostAllowsAnyHTTPSCertificate(WKBundleRef bundle, WKStringRef host); 36 WK_EXPORT void WKBundleSetClientCertificate(WKBundleRef bundle, WKStringRef host, WK CertificateInfoRef certificateInfo);36 WK_EXPORT void WKBundleSetClientCertificate(WKBundleRef bundle, WKStringRef host, WKStringRef certificateSystemStoreName, WKCertificateInfoRef certificateInfo); 37 37 38 38 #ifdef __cplusplus -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
r82710 r82776 83 83 #if PLATFORM(WIN) 84 84 void setHostAllowsAnyHTTPSCertificate(const String&); 85 void setClientCertificate(const String& , const WebCertificateInfo*);85 void setClientCertificate(const String& host, const String& certificateSystemStoreName, const WebCertificateInfo*); 86 86 #endif 87 87 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp
r82309 r82776 32 32 #include <WebCore/ResourceHandle.h> 33 33 #include <WebCore/SimpleFontData.h> 34 #include <wtf/text/CString.h> 34 35 35 36 #include <windows.h> … … 100 101 } 101 102 102 void InjectedBundle::setClientCertificate(const String& host, const WebCertificateInfo* certificateInfo)103 void InjectedBundle::setClientCertificate(const String& host, const String& certificateSystemStoreName, const WebCertificateInfo* certificateInfo) 103 104 { 104 105 #if USE(CFNETWORK) 105 ASSERT (certificateInfo);106 ASSERT_ARG(certificateInfo, certificateInfo); 106 107 if (!certificateInfo) 107 108 return; … … 112 113 return; 113 114 114 ResourceHandle::setClientCertificate(host, WebCore::copyCertificateToData(certificateChain.first()).get()); 115 ASSERT_ARG(certificateSystemStoreName, !certificateSystemStoreName.isEmpty()); 116 if (certificateSystemStoreName.isEmpty()) 117 return; 118 119 // The PCCERT_CONTEXT in the WebCertificateInfo we created using the message from the UI process doesn't contain enough information 120 // to actually use it in a request, we need to get the real certificate from the certificate store (which is typically the "MY" store). 121 String mutableCertificateSystemStoreName = certificateSystemStoreName; 122 HCERTSTORE certStore = ::CertOpenSystemStore(0, mutableCertificateSystemStoreName.charactersWithNullTermination()); 123 if (!certStore) { 124 LOG_ERROR("Could not open system certificate store %s", certificateSystemStoreName.ascii().data()); 125 return; 126 } 127 128 PCCERT_CONTEXT realCert = ::CertFindCertificateInStore(certStore, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, CERT_FIND_EXISTING, certificateChain.first(), 0); 129 if (!realCert) { 130 LOG_ERROR("Could not find certificate in system certificate store"); 131 return; 132 } 133 134 ResourceHandle::setClientCertificate(host, WebCore::copyCertificateToData(realCert).get()); 135 CertFreeCertificateContext(realCert); 136 137 // We can't close certStore here, since the certificate is still in use. 115 138 #endif 116 139 }
Note: See TracChangeset
for help on using the changeset viewer.