<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[169655] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/169655">169655</a></dd>
<dt>Author</dt> <dd>mitz@apple.com</dd>
<dt>Date</dt> <dd>2014-06-06 12:04:10 -0700 (Fri, 06 Jun 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>
Source/WebCore: WebCore part of <rdar://problem/17095692> [iOS] Client-certificate authentication isn’t working
https://bugs.webkit.org/show_bug.cgi?id=133527
Reviewed by Darin Adler.
* WebCore.exp.in: Exported some Credential member functions.
Source/WebKit2: <rdar://problem/17095692> [iOS] Client-certificate authentication isn’t working
https://bugs.webkit.org/show_bug.cgi?id=133527
Reviewed by Darin Adler.
* Configurations/Network-iOS.entitlements: Enabled the Network process to access the keys
needed to create identities to authenticate with.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<Credential>::encode): Encode the credential type, and if it is a client
certificate, encode the identity and the certificates.
(IPC::ArgumentCoder<Credential>::decode): Decode the credential type. If it is a client
certificate, decode the identity and the certificates and use the proper Credential
constructor.
* Shared/cf/ArgumentCodersCF.cpp:
(IPC::typeFromCFTypeRef): Handle SecIdentityRef.
(IPC::encode): Encode an identity by encoding its certificate and a persistent reference to
its key.
(IPC::decode): Decode a certificate and a persistent reference to a key, find the key, and
create an identity.
* Shared/cf/ArgumentCodersCF.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2ConfigurationsNetworkiOSentitlements">trunk/Source/WebKit2/Configurations/Network-iOS.entitlements</a></li>
<li><a href="#trunkSourceWebKit2SharedWebCoreArgumentCoderscpp">trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedcfArgumentCodersCFcpp">trunk/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedcfArgumentCodersCFh">trunk/Source/WebKit2/Shared/cf/ArgumentCodersCF.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (169654 => 169655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-06-06 18:37:08 UTC (rev 169654)
+++ trunk/Source/WebCore/ChangeLog        2014-06-06 19:04:10 UTC (rev 169655)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2014-06-06 Dan Bernstein <mitz@apple.com>
+
+ WebCore part of <rdar://problem/17095692> [iOS] Client-certificate authentication isn’t working
+ https://bugs.webkit.org/show_bug.cgi?id=133527
+
+ Reviewed by Darin Adler.
+
+ * WebCore.exp.in: Exported some Credential member functions.
+
</ins><span class="cx"> 2014-06-06 Dean Jackson <dino@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS WebGL] Float texture extension has a slightly different name
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (169654 => 169655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-06-06 18:37:08 UTC (rev 169654)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-06-06 19:04:10 UTC (rev 169655)
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx"> __ZN7WebCore10ClientRectC1ERKNS_7IntRectE
</span><span class="cx"> __ZN7WebCore10ClientRectC1ERKNS_9FloatRectE
</span><span class="cx"> __ZN7WebCore10ClientRectC1Ev
</span><ins>+__ZN7WebCore10CredentialC1EP13__SecIdentityPK9__CFArrayNS_21CredentialPersistenceE
</ins><span class="cx"> __ZN7WebCore10CredentialC1ERKN3WTF6StringES4_NS_21CredentialPersistenceE
</span><span class="cx"> __ZN7WebCore10CredentialC1Ev
</span><span class="cx"> __ZN7WebCore10FloatPointC1ERK7CGPoint
</span><span class="lines">@@ -1505,8 +1506,11 @@
</span><span class="cx"> __ZNK3WTF6String14createCFStringEv
</span><span class="cx"> __ZNK7WebCore10Credential11hasPasswordEv
</span><span class="cx"> __ZNK7WebCore10Credential11persistenceEv
</span><ins>+__ZNK7WebCore10Credential12certificatesEv
+__ZNK7WebCore10Credential4typeEv
</ins><span class="cx"> __ZNK7WebCore10Credential4userEv
</span><span class="cx"> __ZNK7WebCore10Credential7isEmptyEv
</span><ins>+__ZNK7WebCore10Credential8identityEv
</ins><span class="cx"> __ZNK7WebCore10Credential8passwordEv
</span><span class="cx"> __ZNK7WebCore10FloatPointcv7CGPointEv
</span><span class="cx"> __ZNK7WebCore10FontGlyphs17realizeFontDataAtERKNS_15FontDescriptionEj
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (169654 => 169655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-06-06 18:37:08 UTC (rev 169654)
+++ trunk/Source/WebKit2/ChangeLog        2014-06-06 19:04:10 UTC (rev 169655)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-06-06 Dan Bernstein <mitz@apple.com>
+
+ <rdar://problem/17095692> [iOS] Client-certificate authentication isn’t working
+ https://bugs.webkit.org/show_bug.cgi?id=133527
+
+ Reviewed by Darin Adler.
+
+ * Configurations/Network-iOS.entitlements: Enabled the Network process to access the keys
+ needed to create identities to authenticate with.
+
+ * Shared/WebCoreArgumentCoders.cpp:
+ (IPC::ArgumentCoder<Credential>::encode): Encode the credential type, and if it is a client
+ certificate, encode the identity and the certificates.
+ (IPC::ArgumentCoder<Credential>::decode): Decode the credential type. If it is a client
+ certificate, decode the identity and the certificates and use the proper Credential
+ constructor.
+
+ * Shared/cf/ArgumentCodersCF.cpp:
+ (IPC::typeFromCFTypeRef): Handle SecIdentityRef.
+ (IPC::encode): Encode an identity by encoding its certificate and a persistent reference to
+ its key.
+ (IPC::decode): Decode a certificate and a persistent reference to a key, find the key, and
+ create an identity.
+ * Shared/cf/ArgumentCodersCF.h:
+
</ins><span class="cx"> 2014-06-05 Benjamin Poulain <bpoulain@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS][WK2] WebPage sometimes forces two resize events on animated resize
</span></span></pre></div>
<a id="trunkSourceWebKit2ConfigurationsNetworkiOSentitlements"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Configurations/Network-iOS.entitlements (169654 => 169655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Configurations/Network-iOS.entitlements        2014-06-06 18:37:08 UTC (rev 169654)
+++ trunk/Source/WebKit2/Configurations/Network-iOS.entitlements        2014-06-06 19:04:10 UTC (rev 169655)
</span><span class="lines">@@ -4,5 +4,9 @@
</span><span class="cx"> <dict>
</span><span class="cx">         <key>com.apple.private.network.socket-delegate</key>
</span><span class="cx">         <true/>
</span><ins>+        <key>keychain-access-groups</key>
+        <array>
+                <string>com.apple.identities</string>
+        </array>
</ins><span class="cx"> </dict>
</span><span class="cx"> </plist>
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebCoreArgumentCoderscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (169654 => 169655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2014-06-06 18:37:08 UTC (rev 169654)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2014-06-06 19:04:10 UTC (rev 169655)
</span><span class="lines">@@ -69,6 +69,10 @@
</span><span class="cx"> #include <wtf/text/CString.h>
</span><span class="cx"> #include <wtf/text/StringHash.h>
</span><span class="cx">
</span><ins>+#if PLATFORM(COCOA)
+#include "ArgumentCodersCF.h"
+#endif
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> #include <WebCore/FloatQuad.h>
</span><span class="cx"> #include <WebCore/Pasteboard.h>
</span><span class="lines">@@ -467,12 +471,57 @@
</span><span class="cx">
</span><span class="cx"> void ArgumentCoder<Credential>::encode(ArgumentEncoder& encoder, const Credential& credential)
</span><span class="cx"> {
</span><ins>+#if CERTIFICATE_CREDENTIALS_SUPPORTED
+ encoder.encodeEnum(credential.type());
+
+ if (credential.type() == CredentialTypeClientCertificate) {
+ IPC::encode(encoder, credential.identity());
+
+ encoder << !!credential.certificates();
+ if (credential.certificates())
+ IPC::encode(encoder, credential.certificates());
+
+ encoder.encodeEnum(credential.persistence());
+ return;
+ }
+#endif
</ins><span class="cx"> encoder << credential.user() << credential.password();
</span><ins>+
</ins><span class="cx"> encoder.encodeEnum(credential.persistence());
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool ArgumentCoder<Credential>::decode(ArgumentDecoder& decoder, Credential& credential)
</span><span class="cx"> {
</span><ins>+#if CERTIFICATE_CREDENTIALS_SUPPORTED
+ CredentialType type;
+
+ if (!decoder.decodeEnum(type))
+ return false;
+
+ if (type == CredentialTypeClientCertificate) {
+ RetainPtr<SecIdentityRef> identity;
+ if (!IPC::decode(decoder, identity))
+ return false;
+
+ bool hasCertificates;
+ if (!decoder.decode(hasCertificates))
+ return false;
+
+ RetainPtr<CFArrayRef> certificates;
+ if (hasCertificates) {
+ if (!IPC::decode(decoder, certificates))
+ return false;
+ }
+
+ CredentialPersistence persistence;
+ if (!decoder.decodeEnum(persistence))
+ return false;
+
+ credential = Credential(identity.get(), certificates.get(), persistence);
+ return true;
+ }
+#endif
+
</ins><span class="cx"> String user;
</span><span class="cx"> if (!decoder.decode(user))
</span><span class="cx"> return false;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedcfArgumentCodersCFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp (169654 => 169655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp        2014-06-06 18:37:08 UTC (rev 169654)
+++ trunk/Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp        2014-06-06 19:04:10 UTC (rev 169655)
</span><span class="lines">@@ -36,6 +36,19 @@
</span><span class="cx"> #import <Foundation/Foundation.h>
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if defined(__has_include) && __has_include(<Security/SecIdentityPriv.h>)
+#include <Security/SecIdentityPriv.h>
+#endif
+
+extern "C" SecIdentityRef SecIdentityCreate(CFAllocatorRef allocator, SecCertificateRef certificate, SecKeyRef privateKey);
+
+#if defined(__has_include) && __has_include(<Security/SecKeyPriv.h>)
+#include <Security/SecKeyPriv.h>
+#endif
+
+extern "C" OSStatus SecKeyCopyPersistentRef(SecKeyRef key, CFDataRef* persistentRef);
+extern "C" OSStatus SecKeyFindWithPersistentRef(CFDataRef persistentRef, SecKeyRef* lookedUpData);
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> namespace IPC {
</span><span class="lines">@@ -57,6 +70,7 @@
</span><span class="cx"> CFString,
</span><span class="cx"> CFURL,
</span><span class="cx"> SecCertificate,
</span><ins>+ SecIdentity,
</ins><span class="cx"> #if HAVE(SEC_KEYCHAIN)
</span><span class="cx"> SecKeychainItem,
</span><span class="cx"> #endif
</span><span class="lines">@@ -92,6 +106,8 @@
</span><span class="cx"> return CFURL;
</span><span class="cx"> if (typeID == SecCertificateGetTypeID())
</span><span class="cx"> return SecCertificate;
</span><ins>+ if (typeID == SecIdentityGetTypeID())
+ return SecIdentity;
</ins><span class="cx"> #if HAVE(SEC_KEYCHAIN)
</span><span class="cx"> if (typeID == SecKeychainItemGetTypeID())
</span><span class="cx"> return SecKeychainItem;
</span><span class="lines">@@ -136,6 +152,9 @@
</span><span class="cx"> case SecCertificate:
</span><span class="cx"> encode(encoder, (SecCertificateRef)typeRef);
</span><span class="cx"> return;
</span><ins>+ case SecIdentity:
+ encode(encoder, (SecIdentityRef)(typeRef));
+ return;
</ins><span class="cx"> #if HAVE(SEC_KEYCHAIN)
</span><span class="cx"> case SecKeychainItem:
</span><span class="cx"> encode(encoder, (SecKeychainItemRef)typeRef);
</span><span class="lines">@@ -223,6 +242,13 @@
</span><span class="cx"> result = adoptCF(certificate.leakRef());
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><ins>+ case SecIdentity: {
+ RetainPtr<SecIdentityRef> identity;
+ if (!decode(decoder, identity))
+ return false;
+ result = adoptCF(identity.leakRef());
+ return true;
+ }
</ins><span class="cx"> #if HAVE(SEC_KEYCHAIN)
</span><span class="cx"> case SecKeychainItem: {
</span><span class="cx"> RetainPtr<SecKeychainItemRef> keychainItem;
</span><span class="lines">@@ -555,6 +581,54 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void encode(ArgumentEncoder& encoder, SecIdentityRef identity)
+{
+ SecCertificateRef certificate = nullptr;
+ SecIdentityCopyCertificate(identity, &certificate);
+ encode(encoder, certificate);
+ CFRelease(certificate);
+
+ SecKeyRef key = nullptr;
+ SecIdentityCopyPrivateKey(identity, &key);
+
+ CFDataRef keyData = nullptr;
+ SecKeyCopyPersistentRef(key, &keyData);
+ CFRelease(key);
+
+ encoder << !!keyData;
+ if (keyData) {
+ encode(encoder, keyData);
+ CFRelease(keyData);
+ }
+}
+
+bool decode(ArgumentDecoder& decoder, RetainPtr<SecIdentityRef>& result)
+{
+ RetainPtr<SecCertificateRef> certificate;
+ if (!decode(decoder, certificate))
+ return false;
+
+ bool hasKey;
+ if (!decoder.decode(hasKey))
+ return false;
+
+ if (!hasKey)
+ return true;
+
+ RetainPtr<CFDataRef> keyData;
+ if (!decode(decoder, keyData))
+ return false;
+
+ SecKeyRef key = nullptr;
+ SecKeyFindWithPersistentRef(keyData.get(), &key);
+ if (key) {
+ result = adoptCF(SecIdentityCreate(kCFAllocatorDefault, certificate.get(), key));
+ CFRelease(key);
+ }
+
+ return true;
+}
+
</ins><span class="cx"> #if HAVE(SEC_KEYCHAIN)
</span><span class="cx"> void encode(ArgumentEncoder& encoder, SecKeychainItemRef keychainItem)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedcfArgumentCodersCFh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/cf/ArgumentCodersCF.h (169654 => 169655)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/cf/ArgumentCodersCF.h        2014-06-06 18:37:08 UTC (rev 169654)
+++ trunk/Source/WebKit2/Shared/cf/ArgumentCodersCF.h        2014-06-06 19:04:10 UTC (rev 169655)
</span><span class="lines">@@ -78,6 +78,10 @@
</span><span class="cx"> void encode(ArgumentEncoder&, SecCertificateRef);
</span><span class="cx"> bool decode(ArgumentDecoder&, RetainPtr<SecCertificateRef>& result);
</span><span class="cx">
</span><ins>+// SecIdentityRef
+void encode(ArgumentEncoder&, SecIdentityRef);
+bool decode(ArgumentDecoder&, RetainPtr<SecIdentityRef>& result);
+
</ins><span class="cx"> #if HAVE(SEC_KEYCHAIN)
</span><span class="cx"> // SecKeychainItemRef
</span><span class="cx"> void encode(ArgumentEncoder&, SecKeychainItemRef);
</span></span></pre>
</div>
</div>
</body>
</html>