Commit 5ce21734 authored by jeffm@apple.com's avatar jeffm@apple.com

Add PlatformCertificateInfo::PlatformCertificateInfo(PCCERT_CONTEXT) constructor on Windows

https://bugs.webkit.org/show_bug.cgi?id=57152
        
Reviewed by Steve Falkenburg.

We're going to need to create a PlatformCertificateInfo with a single certificate on Windows to support client certificates.
Also, stop relying on the fact that the Win32 API CertDuplicateCertificateContext() currently returns the same PCCERT_CONTEXT that you pass to it, since that may change in the future.

* Shared/win/PlatformCertificateInfo.cpp:
(WebKit::PlatformCertificateInfo::PlatformCertificateInfo): Added PlatformCertificateInfo(PCCERT_CONTEXT) construtor. Use return value from CertDuplicateCertificateContext().
(WebKit::PlatformCertificateInfo::operator=): Use return value from CertDuplicateCertificateContext().
* Shared/win/PlatformCertificateInfo.h: Added PlatformCertificateInfo(PCCERT_CONTEXT) construtor.



git-svn-id: svn://svn.chromium.org/blink/trunk@82049 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent a207da3a
2011-03-26 Jeff Miller <jeffm@apple.com>
Reviewed by Steve Falkenburg.
Add PlatformCertificateInfo::PlatformCertificateInfo(PCCERT_CONTEXT) constructor on Windows
https://bugs.webkit.org/show_bug.cgi?id=57152
We're going to need to create a PlatformCertificateInfo with a single certificate on Windows to support client certificates.
Also, stop relying on the fact that the Win32 API CertDuplicateCertificateContext() currently returns the same PCCERT_CONTEXT that you pass to it, since that may change in the future.
* Shared/win/PlatformCertificateInfo.cpp:
(WebKit::PlatformCertificateInfo::PlatformCertificateInfo): Added PlatformCertificateInfo(PCCERT_CONTEXT) construtor. Use return value from CertDuplicateCertificateContext().
(WebKit::PlatformCertificateInfo::operator=): Use return value from CertDuplicateCertificateContext().
* Shared/win/PlatformCertificateInfo.h: Added PlatformCertificateInfo(PCCERT_CONTEXT) construtor.
2011-03-26 Anders Carlsson <andersca@apple.com>
Reviewed by Sam Weinig.
......
......@@ -65,14 +65,24 @@ PlatformCertificateInfo::PlatformCertificateInfo(const ResourceResponse& respons
PCERT_SIMPLE_CHAIN firstSimpleChain = chainContext->rgpChain[0];
for (unsigned i = 0; i < firstSimpleChain->cElement; ++i) {
PCCERT_CONTEXT certificateContext = firstSimpleChain->rgpElement[i]->pCertContext;
::CertDuplicateCertificateContext(certificateContext);
m_certificateChain.append(certificateContext);
PCCERT_CONTEXT certificateContextCopy = ::CertDuplicateCertificateContext(certificateContext);
m_certificateChain.append(certificateContextCopy);
}
#else
// FIXME: WinCairo implementation
#endif
}
PlatformCertificateInfo::PlatformCertificateInfo(PCCERT_CONTEXT certificateContext)
{
ASSERT(certificateContext);
if (!certificateContext)
return;
PCCERT_CONTEXT certificateContextCopy = ::CertDuplicateCertificateContext(certificateContext);
m_certificateChain.append(certificateContextCopy);
}
PlatformCertificateInfo::~PlatformCertificateInfo()
{
clearCertificateChain();
......@@ -81,8 +91,8 @@ PlatformCertificateInfo::~PlatformCertificateInfo()
PlatformCertificateInfo::PlatformCertificateInfo(const PlatformCertificateInfo& other)
{
for (size_t i = 0; i < other.m_certificateChain.size(); ++i) {
::CertDuplicateCertificateContext(other.m_certificateChain[i]);
m_certificateChain.append(other.m_certificateChain[i]);
PCCERT_CONTEXT certificateContextCopy = ::CertDuplicateCertificateContext(other.m_certificateChain[i]);
m_certificateChain.append(certificateContextCopy);
}
}
......@@ -90,8 +100,8 @@ PlatformCertificateInfo& PlatformCertificateInfo::operator=(const PlatformCertif
{
clearCertificateChain();
for (size_t i = 0; i < other.m_certificateChain.size(); ++i) {
::CertDuplicateCertificateContext(other.m_certificateChain[i]);
m_certificateChain.append(other.m_certificateChain[i]);
PCCERT_CONTEXT certificateContextCopy = ::CertDuplicateCertificateContext(other.m_certificateChain[i]);
m_certificateChain.append(certificateContextCopy);
}
return *this;
}
......
......@@ -43,6 +43,7 @@ class PlatformCertificateInfo {
public:
PlatformCertificateInfo();
explicit PlatformCertificateInfo(const WebCore::ResourceResponse&);
explicit PlatformCertificateInfo(PCCERT_CONTEXT);
~PlatformCertificateInfo();
PlatformCertificateInfo(const PlatformCertificateInfo&);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment