X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/b04fe171f0375ecd5d8a24747ca1dff85720a0ca..6b200bc335dc93c5516ccb52f14bd896d8c7fad7:/SecurityTests/clxutils/certChain/certChain.cpp?ds=inline diff --git a/SecurityTests/clxutils/certChain/certChain.cpp b/SecurityTests/clxutils/certChain/certChain.cpp deleted file mode 100644 index 92bf38e4..00000000 --- a/SecurityTests/clxutils/certChain/certChain.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Given a cert, produce a complete ordered cert chain back to a root. - * Intermediate certs can be in any user keychain. - */ -#include -#include -#include /* private */ -#include /* private */ -#include -#include /* private */ - -static void usage(char **argv) -{ - printf("Usage:\n"); - printf(" %s certFileName [d(isable intermediates) [f filebase] [n(o cert dump)]\n", argv[0]); - exit(1); -} - -int main(int argc, char **argv) -{ - unsigned char *certData = NULL; // subject cert, raw data - unsigned certDataLen = 0; - OSStatus ortn; - SecTrustRef secTrust = NULL; - CFMutableArrayRef subjCerts = NULL; - SecPolicyRef policy = NULL; - SecPolicySearchRef policySearch = NULL; - SecTrustResultType secTrustResult; - CSSM_RETURN crtn = CSSM_OK; - CSSM_TP_APPLE_EVIDENCE_INFO *dummyEv; // not used - CFArrayRef certChain = NULL; // constructed chain - CFIndex numCerts; - bool disableLocalIntermediates = false; - char *fileBase = NULL; - bool enableCertDump = true; - - if(argc < 2) { - usage(argv); - } - if(readFile(argv[1], &certData, &certDataLen)) { - printf("***Error reading cert from %s. Aborting.\n", argv[1]); - exit(1); - } - for(int arg=2; arg 0)) { - char fname[200]; - sprintf(fname, "%s_%u", fileBase, i); - if(writeFile(fname, cd.Data, cd.Length)) { - printf("***Error writing to %s\n", fname); - } - else { - printf("...write %lu bytes to %s\n", cd.Length, fname); - } - } - } - } -errOut: - if(certData) { - /* mallocds by readFile() */ - free(certData); - } - if(secTrust) { - CFRelease(secTrust); - } - if(subjCerts) { - CFRelease(subjCerts); - } - if(policy) { - CFRelease(policy); - } - if(policySearch) { - CFRelease(policySearch); - } - return (int)ortn; -}