<!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>[15436] OSXFrameworks/trunk</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.calendarserver.org//changeset/15436">15436</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2016-01-11 13:19:50 -0800 (Mon, 11 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add more APIs for Security CMS processing.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#OSXFrameworkstrunkosx_corefoundation_cffi_buildpy">OSXFrameworks/trunk/osx/_corefoundation_cffi_build.py</a></li>
<li><a href="#OSXFrameworkstrunkosxcorefoundationpy">OSXFrameworks/trunk/osx/corefoundation.py</a></li>
<li><a href="#OSXFrameworkstrunkosxframeworks__init__py">OSXFrameworks/trunk/osx/frameworks/__init__.py</a></li>
<li><a href="#OSXFrameworkstrunkosxframeworks_security_cffipy">OSXFrameworks/trunk/osx/frameworks/_security_cffi.py</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#OSXFrameworkstrunkosxframeworks_security_cms_cffipy">OSXFrameworks/trunk/osx/frameworks/_security_cms_cffi.py</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#OSXFrameworkstrunk">OSXFrameworks/trunk/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="OSXFrameworkstrunk"></a>
<div class="propset"><h4>Property changes: OSXFrameworks/trunk</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnignore"></a>
<div class="modfile"><h4>Modified: svn:ignore</h4></div>
<span class="cx">.pydevproject
</span><span class="cx">   + .project
</span><span class="cx">.pydevproject
</span><span class="cx">build
</span><a id="OSXFrameworkstrunkosx_corefoundation_cffi_buildpy"></a>
<div class="modfile"><h4>Modified: OSXFrameworks/trunk/osx/_corefoundation_cffi_build.py (15435 => 15436)</h4>
<pre class="diff"><span>
<span class="info">--- OSXFrameworks/trunk/osx/_corefoundation_cffi_build.py        2016-01-11 18:42:25 UTC (rev 15435)
+++ OSXFrameworks/trunk/osx/_corefoundation_cffi_build.py        2016-01-11 21:19:50 UTC (rev 15436)
</span><span class="lines">@@ -23,6 +23,7 @@
</span><span class="cx">     &quot;_corefoundation_cffi&quot;,
</span><span class="cx">     &quot;_opendirectory_cffi&quot;,
</span><span class="cx">     &quot;_security_cffi&quot;,
</span><ins>+    &quot;_security_cms_cffi&quot;,
</ins><span class="cx">     &quot;_utils_cffi&quot;,
</span><span class="cx"> )]
</span><span class="cx"> 
</span></span></pre></div>
<a id="OSXFrameworkstrunkosxcorefoundationpy"></a>
<div class="modfile"><h4>Modified: OSXFrameworks/trunk/osx/corefoundation.py (15435 => 15436)</h4>
<pre class="diff"><span>
<span class="info">--- OSXFrameworks/trunk/osx/corefoundation.py        2016-01-11 18:42:25 UTC (rev 15435)
+++ OSXFrameworks/trunk/osx/corefoundation.py        2016-01-11 21:19:50 UTC (rev 15436)
</span><span class="lines">@@ -254,7 +254,7 @@
</span><span class="cx"> 
</span><span class="cx">     def count(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        The number of items in the wrapped CFArrayRef.
</del><ins>+        The length of the data in the CFDataRef.
</ins><span class="cx"> 
</span><span class="cx">         @return: the count
</span><span class="cx">         @rtype: L{int}
</span></span></pre></div>
<a id="OSXFrameworkstrunkosxframeworks__init__py"></a>
<div class="modfile"><h4>Modified: OSXFrameworks/trunk/osx/frameworks/__init__.py (15435 => 15436)</h4>
<pre class="diff"><span>
<span class="info">--- OSXFrameworks/trunk/osx/frameworks/__init__.py        2016-01-11 18:42:25 UTC (rev 15435)
+++ OSXFrameworks/trunk/osx/frameworks/__init__.py        2016-01-11 21:19:50 UTC (rev 15436)
</span><span class="lines">@@ -18,5 +18,6 @@
</span><span class="cx">     &quot;_corefoundation_cffi&quot;,
</span><span class="cx">     &quot;_opendirectory_cffi&quot;,
</span><span class="cx">     &quot;_security_cffi&quot;,
</span><ins>+    &quot;_security_cms_cffi&quot;,
</ins><span class="cx">     &quot;_utils_cffi&quot;,
</span><span class="cx"> ]
</span></span></pre></div>
<a id="OSXFrameworkstrunkosxframeworks_security_cffipy"></a>
<div class="modfile"><h4>Modified: OSXFrameworks/trunk/osx/frameworks/_security_cffi.py (15435 => 15436)</h4>
<pre class="diff"><span>
<span class="info">--- OSXFrameworks/trunk/osx/frameworks/_security_cffi.py        2016-01-11 18:42:25 UTC (rev 15435)
+++ OSXFrameworks/trunk/osx/frameworks/_security_cffi.py        2016-01-11 21:19:50 UTC (rev 15436)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> typedef struct OpaqueSecCertificateRef *SecCertificateRef;
</span><span class="cx"> typedef struct OpaqueSecIdentityRef *SecIdentityRef;
</span><span class="cx"> typedef struct OpaqueSecKeychainRef *SecKeychainRef;
</span><ins>+typedef struct OpaqueSecPolicyRef *SecPolicyRef;
</ins><span class="cx"> 
</span><span class="cx"> // SecImportExport.h
</span><span class="cx"> typedef enum
</span><span class="lines">@@ -102,6 +103,9 @@
</span><span class="cx"> 
</span><span class="cx"> typedef OSStatus (*SSLReadFunc) ( SSLConnectionRef connection, void *data, size_t *dataLength );
</span><span class="cx"> typedef OSStatus (*SSLWriteFunc) ( SSLConnectionRef connection, const void *data, size_t *dataLength );
</span><ins>+
+// SecTrust.h
+typedef struct __SecTrust *SecTrustRef;
</ins><span class="cx"> &quot;&quot;&quot;
</span><span class="cx"> 
</span><span class="cx"> CONSTANTS = &quot;&quot;&quot;
</span><span class="lines">@@ -406,6 +410,11 @@
</span><span class="cx"> // SecKeychain.h
</span><span class="cx"> OSStatus SecKeychainSetUserInteractionAllowed ( Boolean state );
</span><span class="cx"> 
</span><ins>+// SecPolicy.h
+SecPolicyRef SecPolicyCreateBasicX509(void);
+SecPolicyRef SecPolicyCreateSSL(Boolean server, CFStringRef hostname);
+
+
</ins><span class="cx"> // SecTransform.h
</span><span class="cx"> SecTransformRef SecSignTransformCreate( SecKeyRef key, CFErrorRef *error ) ;
</span><span class="cx"> Boolean SecTransformSetAttribute(SecTransformRef transformRef,
</span></span></pre></div>
<a id="OSXFrameworkstrunkosxframeworks_security_cms_cffipy"></a>
<div class="addfile"><h4>Added: OSXFrameworks/trunk/osx/frameworks/_security_cms_cffi.py (0 => 15436)</h4>
<pre class="diff"><span>
<span class="info">--- OSXFrameworks/trunk/osx/frameworks/_security_cms_cffi.py                                (rev 0)
+++ OSXFrameworks/trunk/osx/frameworks/_security_cms_cffi.py        2016-01-11 21:19:50 UTC (rev 15436)
</span><span class="lines">@@ -0,0 +1,163 @@
</span><ins>+##
+# Copyright (c) 2016 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+
+INCLUDES = &quot;&quot;&quot;
+#include &lt;Security/Security.h&gt;
+&quot;&quot;&quot;
+
+EXTRA_LINKS = []
+
+TYPES = &quot;&quot;&quot;
+
+// CMSDecoder.h
+typedef struct _CMSDecoder *CMSDecoderRef;
+
+typedef enum
+{
+    kCMSSignerUnsigned = 0,                /* message was not signed */
+    kCMSSignerValid,                       /* message was signed and signature verify OK */
+    kCMSSignerNeedsDetachedContent,        /* message was signed but needs detached content
+                                            *   to verify */
+    kCMSSignerInvalidSignature,            /* message was signed but had a signature error */
+    kCMSSignerInvalidCert,                 /* message was signed but an error occurred in verifying
+                                            *   the signer's certificate */
+    kCMSSignerInvalidIndex                 /* specified signer index out of range */
+} CMSSignerStatus;
+
+// CMSEncoder.h
+typedef struct _CMSEncoder *CMSEncoderRef;
+
+typedef enum {
+    kCMSAttrNone                        = 0x0000,
+    /*
+     * S/MIME Capabilities - identifies supported signature, encryption, and
+     * digest algorithms.
+     */
+    kCMSAttrSmimeCapabilities            = 0x0001,
+    /*
+     * Indicates that a cert is the preferred cert for S/MIME encryption.
+     */
+    kCMSAttrSmimeEncryptionKeyPrefs        = 0x0002,
+    /*
+     * Same as kCMSSmimeEncryptionKeyPrefs, using an attribute OID preferred
+     * by Microsoft.
+     */
+    kCMSAttrSmimeMSEncryptionKeyPrefs    = 0x0004,
+    /*
+     * Include the signing time.
+     */
+    kCMSAttrSigningTime                    = 0x0008
+} CMSSignedAttributes;
+
+typedef enum {
+    kCMSCertificateNone = 0,        /* don't include any certificates */
+    kCMSCertificateSignerOnly,        /* only include signer certificate(s) */
+    kCMSCertificateChain,            /* signer certificate chain up to but not
+                                     *   including root certiticate */
+    kCMSCertificateChainWithRoot    /* signer certificate chain including root */
+} CMSCertificateChainMode;
+&quot;&quot;&quot;
+
+CONSTANTS = &quot;&quot;&quot;
+// CMSEncoder.h
+extern const CFStringRef kCMSEncoderDigestAlgorithmSHA1;
+extern const CFStringRef kCMSEncoderDigestAlgorithmSHA256;
+&quot;&quot;&quot;
+
+FUNCTIONS = &quot;&quot;&quot;
+
+// CMSDecoder.h
+CFTypeID CMSDecoderGetTypeID(void);
+
+OSStatus CMSDecoderCreate(CMSDecoderRef *cmsDecoderOut);
+OSStatus CMSDecoderUpdateMessage(
+    CMSDecoderRef        cmsDecoder,
+    const void            *msgBytes,
+    size_t                msgBytesLen);
+OSStatus CMSDecoderFinalizeMessage(
+    CMSDecoderRef        cmsDecoder);
+
+OSStatus CMSDecoderGetNumSigners(
+    CMSDecoderRef        cmsDecoder,
+    size_t                *numSignersOut);
+OSStatus CMSDecoderCopySignerStatus(
+    CMSDecoderRef               cmsDecoder,
+    size_t                      signerIndex,
+    CFTypeRef                   policyOrArray,
+    Boolean                     evaluateSecTrust,
+    CMSSignerStatus *signerStatusOut,
+    SecTrustRef *secTrustOut,
+    OSStatus *certVerifyResultCodeOut);
+OSStatus CMSDecoderCopySignerCert(
+    CMSDecoderRef        cmsDecoder,
+    size_t                signerIndex,
+    SecCertificateRef *signerCertOut);
+
+OSStatus CMSDecoderIsContentEncrypted(
+    CMSDecoderRef        cmsDecoder,
+    Boolean                *isEncryptedOut);
+OSStatus CMSDecoderCopyEncapsulatedContentType(
+    CMSDecoderRef        cmsDecoder,
+    CFDataRef *eContentTypeOut);
+OSStatus CMSDecoderCopyContent(
+    CMSDecoderRef        cmsDecoder,
+    CFDataRef *contentOut);
+
+// CMSEncoder.h
+CFTypeID CMSEncoderGetTypeID(void);
+
+OSStatus CMSEncoderCreate(CMSEncoderRef * cmsEncoderOut);
+OSStatus CMSEncoderSetSignerAlgorithm(
+    CMSEncoderRef        cmsEncoder,
+    CFStringRef        digestAlgorithm);
+OSStatus CMSEncoderAddSigners(
+    CMSEncoderRef        cmsEncoder,
+    CFTypeRef            signerOrArray);
+OSStatus CMSEncoderAddRecipients(
+    CMSEncoderRef        cmsEncoder,
+    CFTypeRef            recipientOrArray);
+OSStatus CMSEncoderSetEncapsulatedContentTypeOID(
+    CMSEncoderRef        cmsEncoder,
+    CFTypeRef            eContentTypeOID);
+
+OSStatus CMSEncoderAddSignedAttributes(
+    CMSEncoderRef        cmsEncoder,
+    CMSSignedAttributes    signedAttributes);
+OSStatus CMSEncoderSetCertificateChainMode(
+    CMSEncoderRef            cmsEncoder,
+    CMSCertificateChainMode    chainMode);
+
+OSStatus CMSEncoderUpdateContent(
+    CMSEncoderRef        cmsEncoder,
+    const void            *content,
+    size_t                contentLen);
+
+OSStatus CMSEncoderCopyEncodedContent(
+    CMSEncoderRef        cmsEncoder,
+    CFDataRef *encodedContentOut);
+
+OSStatus CMSEncodeContent(
+    CFTypeRef    signers,
+    CFTypeRef    recipients,
+    CFTypeRef    eContentTypeOID,
+    Boolean                 detachedContent,
+    CMSSignedAttributes     signedAttributes,
+    const void              *content,
+    size_t                  contentLen,
+    CFDataRef *encodedContentOut);
+
+&quot;&quot;&quot;
</ins></span></pre>
</div>
</div>

</body>
</html>