--- /dev/null
+/*
+ * Copyright (c) 2006-2010 Apple Inc. All Rights Reserved.
+ */
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <Security/SecCertificate.h>
+#include <Security/SecCertificatePriv.h>
+#include <Security/SecPolicy.h>
+#include <Security/SecTrustPriv.h>
+#include <utilities/array_size.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "Security_regressions.h"
+
+/*
+ subject= /C=US/ST=California/L=Cupertino/O=Apple Computer, Inc./OU=Apple Internet Services/OU=Terms of use at www.verisign.com/rpa (c)00/CN=store.apple.com
+ issuer= /O=VeriSign Trust Network/OU=VeriSign, Inc./OU=VeriSign International Server CA - Class 3/OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign
+ serial=4450E623F57E734FF85C1DEEFB976C86
+*/
+static const uint8_t _c0[] = {
+ 0x30, 0x82, 0x04, 0x82, 0x30, 0x82, 0x03, 0xeb,
+ 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x44,
+ 0x50, 0xe6, 0x23, 0xf5, 0x7e, 0x73, 0x4f, 0xf8,
+ 0x5c, 0x1d, 0xee, 0xfb, 0x97, 0x6c, 0x86, 0x30,
+ 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
+ 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x81,
+ 0xba, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03, 0x55,
+ 0x04, 0x0a, 0x13, 0x16, 0x56, 0x65, 0x72, 0x69,
+ 0x53, 0x69, 0x67, 0x6e, 0x20, 0x54, 0x72, 0x75,
+ 0x73, 0x74, 0x20, 0x4e, 0x65, 0x74, 0x77, 0x6f,
+ 0x72, 0x6b, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03,
+ 0x55, 0x04, 0x0b, 0x13, 0x0e, 0x56, 0x65, 0x72,
+ 0x69, 0x53, 0x69, 0x67, 0x6e, 0x2c, 0x20, 0x49,
+ 0x6e, 0x63, 0x2e, 0x31, 0x33, 0x30, 0x31, 0x06,
+ 0x03, 0x55, 0x04, 0x0b, 0x13, 0x2a, 0x56, 0x65,
+ 0x72, 0x69, 0x53, 0x69, 0x67, 0x6e, 0x20, 0x49,
+ 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65, 0x72,
+ 0x76, 0x65, 0x72, 0x20, 0x43, 0x41, 0x20, 0x2d,
+ 0x20, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x20, 0x33,
+ 0x31, 0x49, 0x30, 0x47, 0x06, 0x03, 0x55, 0x04,
+ 0x0b, 0x13, 0x40, 0x77, 0x77, 0x77, 0x2e, 0x76,
+ 0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e, 0x2e,
+ 0x63, 0x6f, 0x6d, 0x2f, 0x43, 0x50, 0x53, 0x20,
+ 0x49, 0x6e, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x62,
+ 0x79, 0x20, 0x52, 0x65, 0x66, 0x2e, 0x20, 0x4c,
+ 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59,
+ 0x20, 0x4c, 0x54, 0x44, 0x2e, 0x28, 0x63, 0x29,
+ 0x39, 0x37, 0x20, 0x56, 0x65, 0x72, 0x69, 0x53,
+ 0x69, 0x67, 0x6e, 0x30, 0x1e, 0x17, 0x0d, 0x30,
+ 0x35, 0x30, 0x33, 0x30, 0x32, 0x30, 0x30, 0x30,
+ 0x30, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x30, 0x37,
+ 0x30, 0x34, 0x30, 0x31, 0x32, 0x33, 0x35, 0x39,
+ 0x35, 0x39, 0x5a, 0x30, 0x81, 0xc6, 0x31, 0x0b,
+ 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
+ 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06,
+ 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x43, 0x61,
+ 0x6c, 0x69, 0x66, 0x6f, 0x72, 0x6e, 0x69, 0x61,
+ 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04,
+ 0x07, 0x14, 0x09, 0x43, 0x75, 0x70, 0x65, 0x72,
+ 0x74, 0x69, 0x6e, 0x6f, 0x31, 0x1d, 0x30, 0x1b,
+ 0x06, 0x03, 0x55, 0x04, 0x0a, 0x14, 0x14, 0x41,
+ 0x70, 0x70, 0x6c, 0x65, 0x20, 0x43, 0x6f, 0x6d,
+ 0x70, 0x75, 0x74, 0x65, 0x72, 0x2c, 0x20, 0x49,
+ 0x6e, 0x63, 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06,
+ 0x03, 0x55, 0x04, 0x0b, 0x14, 0x17, 0x41, 0x70,
+ 0x70, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x74, 0x65,
+ 0x72, 0x6e, 0x65, 0x74, 0x20, 0x53, 0x65, 0x72,
+ 0x76, 0x69, 0x63, 0x65, 0x73, 0x31, 0x33, 0x30,
+ 0x31, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x14, 0x2a,
+ 0x54, 0x65, 0x72, 0x6d, 0x73, 0x20, 0x6f, 0x66,
+ 0x20, 0x75, 0x73, 0x65, 0x20, 0x61, 0x74, 0x20,
+ 0x77, 0x77, 0x77, 0x2e, 0x76, 0x65, 0x72, 0x69,
+ 0x73, 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d,
+ 0x2f, 0x72, 0x70, 0x61, 0x20, 0x28, 0x63, 0x29,
+ 0x30, 0x30, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03,
+ 0x55, 0x04, 0x03, 0x14, 0x0f, 0x73, 0x74, 0x6f,
+ 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65,
+ 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x81, 0x9f, 0x30,
+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30,
+ 0x00, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f,
+ 0x04, 0x04, 0x03, 0x02, 0x05, 0xa0, 0x30, 0x46,
+ 0x06, 0x03, 0x55, 0x1d, 0x1f, 0x04, 0x3f, 0x30,
+ 0x3d, 0x30, 0x3b, 0xa0, 0x39, 0xa0, 0x37, 0x86,
+ 0x35, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f,
+ 0x63, 0x72, 0x6c, 0x2e, 0x76, 0x65, 0x72, 0x69,
+ 0x73, 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d,
+ 0x2f, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x33, 0x49,
+ 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x65, 0x72, 0x76,
+ 0x65, 0x72, 0x2e, 0x63, 0x72, 0x6c, 0x30, 0x44,
+ 0x06, 0x03, 0x55, 0x1d, 0x20, 0x04, 0x3d, 0x30,
+ 0x3b, 0x30, 0x39, 0x06, 0x0b, 0x60, 0x86, 0x48,
+ 0x01, 0x86, 0xf8, 0x45, 0x01, 0x07, 0x17, 0x03,
+ 0x30, 0x2a, 0x30, 0x28, 0x06, 0x08, 0x2b, 0x06,
+ 0x01, 0x05, 0x05, 0x07, 0x02, 0x01, 0x16, 0x1c,
+ 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f,
+ 0x77, 0x77, 0x77, 0x2e, 0x76, 0x65, 0x72, 0x69,
+ 0x73, 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d,
+ 0x2f, 0x72, 0x70, 0x61, 0x30, 0x28, 0x06, 0x03,
+ 0x55, 0x1d, 0x25, 0x04, 0x21, 0x30, 0x1f, 0x06,
+ 0x09, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42,
+ 0x04, 0x01, 0x06, 0x08, 0x2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Trust Network/OU=VeriSign, Inc./OU=VeriSign International Server CA - Class 3/OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign
+ issuer= /C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority
+ serial=254B8A853842CCE358F8C5DDAE226EA4
+*/
+static const uint8_t _c1[] = {
+ 0x30, 0x82, 0x03, 0x83, 0x30, 0x82, 0x02, 0xec,
+ 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x25,
+ 0x4b, 0x8a, 0x85, 0x38, 0x42, 0xcc, 0xe3, 0x58,
+ 0xf8, 0xc5, 0xdd, 0xae, 0x22, 0x6e, 0xa4, 0x30,
+ 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
+ 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x5f,
+ 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
+ 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x17, 0x30,
+ 0x15, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0e,
+ 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6e,
+ 0x2c, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x31, 0x37,
+ 0x30, 0x35, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13,
+ 0x2e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x20, 0x33,
+ 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
+ 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x20,
+ 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63,
+ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x41, 0x75,
+ 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x30,
+ 0x1e, 0x17, 0x0d, 0x39, 0x37, 0x30, 0x34, 0x31,
+ 0x37, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a,
+ 0x17, 0x0d, 0x31, 0x31, 0x31, 0x30, 0x32, 0x34,
+ 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30,
+ 0x81, 0xba, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03,
+ 0x55, 0x04, 0x0a, 0x13, 0x16, 0x56, 0x65, 0x72,
+ 0x69, 0x53, 0x69, 0x67, 0x6e, 0x20, 0x54, 0x72,
+ 0x75, 0x73, 0x74, 0x20, 0x4e, 0x65, 0x74, 0x77,
+ 0x6f, 0x72, 0x6b, 0x31, 0x17, 0x30, 0x15, 0x06,
+ 0x03, 0x55, 0x04, 0x0b, 0x13, 0x0e, 0x56, 0x65,
+ 0x72, 0x69, 0x53, 0x69, 0x67, 0x6e, 0x2c, 0x20,
+ 0x49, 0x6e, 0x63, 0x2e, 0x31, 0x33, 0x30, 0x31,
+ 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x2a, 0x56,
+ 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6e, 0x20,
+ 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65,
+ 0x72, 0x76, 0x65, 0x72, 0x20, 0x43, 0x41, 0x20,
+ 0x2d, 0x20, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x20,
+ 0x33, 0x31, 0x49, 0x30, 0x47, 0x06, 0x03, 0x55,
+ 0x04, 0x0b, 0x13, 0x40, 0x77, 0x77, 0x77, 0x2e,
+ 0x76, 0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e,
+ 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x43, 0x50, 0x53,
+ 0x20, 0x49, 0x6e, 0x63, 0x6f, 0x72, 0x70, 0x2e,
+ 0x62, 0x79, 0x20, 0x52, 0x65, 0x66, 0x2e, 0x20,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, 0x53,
+ 0x9c, 0x4f, 0x34, 0xe7, 0xab, 0x04, 0xb2, 0x7b,
+ 0x6f, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81,
+ 0xe3, 0x30, 0x81, 0xe0, 0x30, 0x0f, 0x06, 0x03,
+ 0x55, 0x1d, 0x13, 0x04, 0x08, 0x30, 0x06, 0x01,
+ 0x01, 0xff, 0x02, 0x01, 0x00, 0x30, 0x44, 0x06,
+ 0x03, 0x55, 0x1d, 0x20, 0x04, 0x3d, 0x30, 0x3b,
+ 0x30, 0x39, 0x06, 0x0b, 0x60, 0x86, 0x48, 0x01,
+ 0x86, 0xf8, 0x45, 0x01, 0x07, 0x01, 0x01, 0x30,
+ 0x2a, 0x30, 0x28, 0x06, 0x08, 0x2b, 0x06, 0x01,
+ 0x05, 0x05, 0x07, 0x02, 0x01, 0x16, 0x1c, 0x68,
+ 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77,
+ 0x77, 0x77, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x73,
+ 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
+ 0x43, 0x50, 0x53, 0x30, 0x34, 0x06, 0x03, 0x55,
+ 0x1d, 0x25, 0x04, 0x2d, 0x30, 0x2b, 0x06, 0x08,
+ 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01,
+ 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07,
+ 0x03, 0x02, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01,
+ 0x86, 0xf8, 0x42, 0x04, 0x01, 0x06, 0x0a, 0x60,
+ 0x86, 0x48, 0x01, 0x86, 0xf8, 0x45, 0x01, 0x08,
+ 0x01, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f,
+ 0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x11,
+ 0x06, 0x09, 0x60, 0x86, 0x48, 0x01,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d,
+ 0x9e, 0x82, 0x2e, 0x52, 0x5f, 0xbc, 0x3e, 0xc6,
+ 0x66, 0x29, 0x01, 0x8e, 0x4e, 0x92, 0x2c, 0xbc,
+ 0x46, 0x75, 0x03, 0x82, 0xac, 0x73, 0xe9, 0xd9,
+ 0x7e, 0x0b, 0x67, 0xef, 0x54, 0x52, 0x1a
+};
+
+#define CFReleaseSafe(CF) { CFTypeRef _cf = (CF); if (_cf) CFRelease(_cf); }
+
+/* Test basic add delete update copy matching stuff. */
+static void tests(void)
+{
+ SecTrustRef trust;
+ SecCertificateRef cert0, cert1;
+ isnt(cert0 = SecCertificateCreateWithBytes(NULL, _c0, sizeof(_c0)),
+ NULL, "create cert0");
+ isnt(cert1 = SecCertificateCreateWithBytes(NULL, _c1, sizeof(_c1)),
+ NULL, "create cert1");
+ const void *v_certs[] = {
+ cert0,
+ cert1
+ };
+ SecPolicyRef policy = SecPolicyCreateSSL(false, CFSTR("store.apple.com"));
+ CFArrayRef certs = CFArrayCreate(NULL, v_certs,
+ array_size(v_certs), NULL);
+ ok_status(SecTrustCreateWithCertificates(certs, policy, &trust), "create trust");
+ /* Jan 1st 2006. */
+ CFDateRef date = CFDateCreate(NULL, 157680000.0);
+ ok_status(SecTrustSetVerifyDate(trust, date), "set date");
+
+ SecTrustResultType trustResult;
+ ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
+ is_status(trustResult, kSecTrustResultUnspecified,
+ "trust is kSecTrustResultUnspecified");
+ CFDataRef exceptions;
+ ok(exceptions = SecTrustCopyExceptions(trust), "create an exceptions");
+ ok(SecTrustSetExceptions(trust, exceptions), "set exceptions");
+ ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
+ is_status(trustResult, kSecTrustResultProceed, "trust is kSecTrustResultProceed");
+
+ CFReleaseSafe(trust);
+ CFReleaseSafe(policy);
+ policy = SecPolicyCreateSSL(false, CFSTR("badstore.apple.com"));
+ ok_status(SecTrustCreateWithCertificates(certs, policy, &trust), "create trust with hostname mismatch");
+ ok_status(SecTrustSetVerifyDate(trust, date), "set date");
+ ok(SecTrustSetExceptions(trust, exceptions), "set old exceptions");
+ ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
+ is_status(trustResult, kSecTrustResultRecoverableTrustFailure, "trust is kSecTrustResultRecoverableTrustFailure");
+ CFReleaseSafe(exceptions);
+ ok(exceptions = SecTrustCopyExceptions(trust), "create a new exceptions");
+ ok(SecTrustSetExceptions(trust, exceptions), "set exceptions");
+ ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
+ is_status(trustResult, kSecTrustResultProceed, "trust is kSecTrustResultProceed");
+
+ CFReleaseSafe(trust);
+ ok_status(SecTrustCreateWithCertificates(certs, policy, &trust), "create trust");
+ ok_status(SecTrustSetVerifyDate(trust, date), "set date");
+ ok(SecTrustSetExceptions(trust, exceptions), "set exceptions");
+ ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
+ is_status(trustResult, kSecTrustResultProceed, "trust is kSecTrustResultProceed");
+ CFArrayRef anchors = CFArrayCreate(kCFAllocatorDefault, NULL, 0, &kCFTypeArrayCallBacks);
+ ok_status(SecTrustSetAnchorCertificates(trust, anchors), "set empty anchor list");
+ ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
+ is_status(trustResult, kSecTrustResultRecoverableTrustFailure, "trust is kSecTrustResultRecoverableTrustFailure");
+
+ ok_status(SecTrustSetAnchorCertificatesOnly(trust, false), "trust passed in anchors and system anchors");
+ ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
+ is_status(trustResult, kSecTrustResultProceed, "trust is now kSecTrustResultProceed");
+
+ ok_status(SecTrustSetAnchorCertificatesOnly(trust, true), "only trust passed in anchors (default)");
+ ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
+ is_status(trustResult, kSecTrustResultRecoverableTrustFailure, "trust is kSecTrustResultRecoverableTrustFailure again");
+
+ CFReleaseSafe(exceptions);
+ ok(exceptions = SecTrustCopyExceptions(trust), "create a new exceptions");
+ ok(SecTrustSetExceptions(trust, exceptions), "set exceptions");
+ ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
+ is_status(trustResult, kSecTrustResultProceed, "trust is kSecTrustResultProceed");
+ CFReleaseSafe(date);
+ date = CFDateCreate(NULL, 667680000.0);
+ ok_status(SecTrustSetVerifyDate(trust, date), "set date to far future so certs are expired");
+ ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
+ is_status(trustResult, kSecTrustResultRecoverableTrustFailure, "trust is kSecTrustResultRecoverableTrustFailure");
+
+ CFReleaseSafe(anchors);
+ CFReleaseSafe(exceptions);
+ CFReleaseSafe(trust);
+ CFReleaseSafe(policy);
+ CFReleaseSafe(certs);
+ CFReleaseSafe(cert0);
+ CFReleaseSafe(cert1);
+ CFReleaseSafe(date);
+}
+
+int si_27_sectrust_exceptions(int argc, char *const *argv)
+{
+ plan_tests(40);
+
+
+ tests();
+
+ return 0;
+}