]> git.saurik.com Git - apple/security.git/blobdiff - SecurityTests/clxutils/threadTest/copyRoots.cpp
Security-57031.1.35.tar.gz
[apple/security.git] / SecurityTests / clxutils / threadTest / copyRoots.cpp
diff --git a/SecurityTests/clxutils/threadTest/copyRoots.cpp b/SecurityTests/clxutils/threadTest/copyRoots.cpp
new file mode 100644 (file)
index 0000000..f0d4fa1
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * DER decode test
+ */
+#include "testParams.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+#include <string.h>
+#include <utilLib/common.h>
+#include <utilLib/cspwrap.h>   
+#include <Security/Security.h>
+#include <Security/SecTrustSettingsPriv.h>
+#include <stddef.h>
+#include <unistd.h>
+
+int copyRootsInit(
+       TestParams *testParams)
+{
+    /* nothing for now */
+    return 0;
+}
+
+int copyRootsTest(TestParams *testParams)
+{
+       for(unsigned loop=0; loop<testParams->numLoops; loop++) {
+               if(testParams->verbose) {
+                       printf("derDecode thread %d: loop %d\n", 
+                               testParams->threadNum, loop);
+               }
+               else if(!testParams->quiet) {
+                       printChar(testParams->progressChar);
+               }
+        
+        CFArrayRef theArray = NULL;
+        OSStatus ortn = SecTrustSettingsCopyQualifiedCerts(&CSSMOID_APPLE_TP_SSL,
+            "localhost", 10,        // policyString
+            CSSM_KEYUSE_ENCRYPT,    // wrong key use type but that's what ST passes
+            &theArray);
+        if(ortn) {
+            cssmPerror("SecTrustSettingsCopyQualifiedCerts", ortn);
+            return 1;
+        }
+        CFRelease(theArray);
+    }
+    return 0;
+}