Changeset 64903 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Dec 16, 2016 12:12:05 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 112312
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/asn1/oiddb.cfg
r64867 r64903 117 117 1.3.6.1.4.1.311.3.3.1 = Ms-CounterSign 118 118 1.3.6.1.4.1.311.3.3.2 = Ms-??-3.2 119 1.3.6.1.4.1.311.10.3.1 = Ms-CertTrustListSigning 120 1.3.6.1.4.1.311.10.3.2 = Ms-TimeStampSigning 119 1.3.6.1.4.1.311.10.1 = Ms-CertTrustList 120 1.3.6.1.4.1.311.10.1.1 = Ms-SortedCertTrustList 121 1.3.6.1.4.1.311.10.3.1 = Ms-kp-CertTrustListSigning 122 1.3.6.1.4.1.311.10.3.2 = Ms-kp-TimeStampSigning 121 123 1.3.6.1.4.1.311.10.3.4 = Ms-EncryptedFileSystem 122 124 1.3.6.1.4.1.311.10.3.5 = Ms-WhqlCrypto -
trunk/src/VBox/Runtime/tools/RTSignTool.cpp
r64897 r64903 180 180 * @returns IPRT status code (error message already shown on failure). 181 181 * @param pThis The PKCS\#7 signature to decode. 182 */ 183 static int SignToolPkcs7_Decode(PSIGNTOOLPKCS7 pThis) 182 * @param fCatalog Set if catalog file, clear if executable. 183 */ 184 static int SignToolPkcs7_Decode(PSIGNTOOLPKCS7 pThis, bool fCatalog) 184 185 { 185 186 RTERRINFOSTATIC ErrInfo; … … 211 212 | RTCRPKCS7SIGNEDDATA_SANITY_F_SIGNING_CERT_PRESENT, 212 213 RTErrInfoInitStatic(&ErrInfo), "SD"); 213 if (RT_FAILURE(rc))214 RTMsgError("PKCS#7 sanity check failed for '%s': %Rrc - %s\n", pThis->pszFilename, rc, ErrInfo.szMsg);215 214 if (RT_SUCCESS(rc)) 216 215 { … … 223 222 pThis->pszFilename, rc, ErrInfo.szMsg); 224 223 } 224 else 225 RTMsgError("PKCS#7 sanity check failed for '%s': %Rrc - %s\n", pThis->pszFilename, rc, ErrInfo.szMsg); 225 226 } 226 else 227 else if (!fCatalog) 227 228 RTMsgError("Unexpected the signed content in '%s': %s (expected %s)", pThis->pszFilename, 228 229 pThis->pSignedData->ContentInfo.ContentType.szObjId, RTCRSPCINDIRECTDATACONTENT_OID); 229 230 } 230 231 else 231 RTMsgError("PKCS#7 content is inside '%s' is not 'signedData': %s\n", 232 pThis->pszFilename, pThis->ContentInfo.ContentType.szObjId); 232 rc = RTMsgErrorRc(VERR_CR_PKCS7_NOT_SIGNED_DATA, 233 "PKCS#7 content is inside '%s' is not 'signedData': %s\n", 234 pThis->pszFilename, pThis->ContentInfo.ContentType.szObjId); 233 235 } 234 236 else 235 237 RTMsgError("RTCrPkcs7ContentInfo_DecodeAsn1 failed on '%s': %Rrc - %s\n", pThis->pszFilename, rc, ErrInfo.szMsg); 236 238 return rc; 239 } 240 241 242 /** 243 * Reads and decodes PKCS\#7 signature from the given cat file. 244 * 245 * @returns RTEXITCODE_SUCCESS on success, RTEXITCODE_FAILURE with error message 246 * on failure. 247 * @param pThis The structure to initialize. 248 * @param pszFilename The catalog (or any other DER PKCS\#7) filename. 249 * @param cVerbosity The verbosity. 250 */ 251 static RTEXITCODE SignToolPkcs7_InitFromFile(PSIGNTOOLPKCS7 pThis, const char *pszFilename, unsigned cVerbosity) 252 { 253 /* 254 * Init the return structure. 255 */ 256 RT_ZERO(*pThis); 257 pThis->pszFilename = pszFilename; 258 259 /* 260 * Lazy bird uses RTFileReadAll and duplicates the allocation. 261 */ 262 void *pvFile; 263 int rc = RTFileReadAll(pszFilename, &pvFile, &pThis->cbBuf); 264 if (RT_SUCCESS(rc)) 265 { 266 pThis->pbBuf = (uint8_t *)RTMemDup(pvFile, pThis->cbBuf); 267 RTFileReadAllFree(pvFile, pThis->cbBuf); 268 if (pThis->pbBuf) 269 { 270 if (cVerbosity > 2) 271 RTPrintf("PKCS#7 signature: %u bytes\n", pThis->cbBuf); 272 273 /* 274 * Decode it. 275 */ 276 rc = SignToolPkcs7_Decode(pThis, true /*fCatalog*/); 277 if (RT_SUCCESS(rc)) 278 return RTEXITCODE_SUCCESS; 279 } 280 else 281 RTMsgError("Out of memory!"); 282 } 283 else 284 RTMsgError("Error reading '%s' into memory: %Rrc", pszFilename, rc); 285 286 SignToolPkcs7_Delete(pThis); 287 return RTEXITCODE_FAILURE; 237 288 } 238 289 … … 358 409 } 359 410 411 412 /** 413 * Writes the signature to the file. 414 * 415 * Caller must have called SignToolPkcs7_Encode() prior to this function. 416 * 417 * @returns RTEXITCODE_SUCCESS on success, RTEXITCODE_FAILURE with error 418 * message on failure. 419 * @param pThis The file which to write. 420 * @param cVerbosity The verbosity. 421 */ 422 static RTEXITCODE SignToolPkcs7_WriteSignatureToFile(PSIGNTOOLPKCS7 pThis, const char *pszFilename, unsigned cVerbosity) 423 { 424 AssertReturn(pThis->cbNewBuf && pThis->pbNewBuf, RTEXITCODE_FAILURE); 425 426 /* 427 * Open+truncate file, write new signature, close. Simple. 428 */ 429 RTFILE hFile; 430 int rc = RTFileOpen(&hFile, pszFilename, RTFILE_O_WRITE | RTFILE_O_OPEN_CREATE | RTFILE_O_TRUNCATE | RTFILE_O_DENY_WRITE); 431 if (RT_SUCCESS(rc)) 432 { 433 rc = RTFileWrite(hFile, pThis->pbNewBuf, pThis->cbNewBuf, NULL); 434 if (RT_SUCCESS(rc)) 435 { 436 rc = RTFileClose(hFile); 437 if (RT_SUCCESS(rc)) 438 { 439 if (cVerbosity > 0) 440 RTMsgInfo("Wrote %u bytes to %s", pThis->cbNewBuf, pszFilename); 441 return RTEXITCODE_SUCCESS; 442 } 443 444 RTMsgError("RTFileClose failed on %s: %Rrc", pszFilename, rc); 445 } 446 else 447 RTMsgError("Write error on %s: %Rrc", pszFilename, rc); 448 } 449 else 450 RTMsgError("Failed to open %s for writing: %Rrc", pszFilename, rc); 451 return RTEXITCODE_FAILURE; 452 } 360 453 361 454 … … 428 521 * Decode it. 429 522 */ 430 rc = SignToolPkcs7_Decode(pThis );523 rc = SignToolPkcs7_Decode(pThis, false /*fCatalog*/); 431 524 if (RT_SUCCESS(rc)) 432 525 return RTEXITCODE_SUCCESS; … … 445 538 SignToolPkcs7Exe_Delete(pThis); 446 539 return RTEXITCODE_FAILURE; 447 448 540 } 449 541 … … 812 904 { 813 905 RT_NOREF_PV(enmLevel); 814 RTStrmPrintf(pStrm, "add-nested-exe-signature [-v|--verbose] <destination-exe> <source-exe>\n"); 906 RTStrmPrintf(pStrm, "add-nested-exe-signature [-v|--verbose] [-d|--debug] <destination-exe> <source-exe>\n"); 907 if (enmLevel == RTSIGNTOOLHELP_FULL) 908 RTStrmPrintf(pStrm, 909 "\n" 910 "The --debug option allows the source-exe to be omitted in order to test the\n" 911 "encoding and PE file modification.\n"); 815 912 return RTEXITCODE_SUCCESS; 816 913 } … … 825 922 { 826 923 { "--verbose", 'v', RTGETOPT_REQ_NOTHING }, 924 { "--debug", 'd', RTGETOPT_REQ_NOTHING }, 827 925 }; 828 926 829 const char *pszDst = NULL;830 const char *pszSrc = NULL;927 const char *pszDst = NULL; 928 const char *pszSrc = NULL; 831 929 unsigned cVerbosity = 0; 930 bool fDebug = false; 832 931 833 932 RTGETOPTSTATE GetState; … … 841 940 { 842 941 case 'v': cVerbosity++; break; 942 case 'd': fDebug = pszSrc == NULL; break; 843 943 case 'V': return HandleVersion(cArgs, papszArgs); 844 944 case 'h': return HelpAddNestedExeSignature(g_pStdOut, RTSIGNTOOLHELP_FULL); … … 848 948 pszDst = ValueUnion.psz; 849 949 else if (!pszSrc) 950 { 850 951 pszSrc = ValueUnion.psz; 952 fDebug = false; 953 } 851 954 else 852 955 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Too many file arguments: %s", ValueUnion.psz); … … 858 961 } 859 962 if (!pszDst) 860 return RTMsgErrorExit(RTEXITCODE_FAILURE, "No destination ex cutable given.");861 if (!pszSrc )963 return RTMsgErrorExit(RTEXITCODE_FAILURE, "No destination executable given."); 964 if (!pszSrc && !fDebug) 862 965 return RTMsgErrorExit(RTEXITCODE_FAILURE, "No source executable file given."); 863 966 … … 867 970 /* Read & decode the source PKCS#7 signature. */ 868 971 SIGNTOOLPKCS7EXE Src; 869 RTEXITCODE rcExit = SignToolPkcs7Exe_InitFromFile(&Src, pszSrc, cVerbosity);972 RTEXITCODE rcExit = pszSrc ? SignToolPkcs7Exe_InitFromFile(&Src, pszSrc, cVerbosity) : RTEXITCODE_SUCCESS; 870 973 if (rcExit == RTEXITCODE_SUCCESS) 871 974 { … … 876 979 { 877 980 /* Do the signature manipulation. */ 878 rcExit = SignToolPkcs7_AddNestedSignature(&Dst, &Src, cVerbosity); 981 if (pszSrc) 982 rcExit = SignToolPkcs7_AddNestedSignature(&Dst, &Src, cVerbosity); 879 983 if (rcExit == RTEXITCODE_SUCCESS) 880 984 rcExit = SignToolPkcs7_Encode(&Dst, cVerbosity); … … 886 990 SignToolPkcs7Exe_Delete(&Dst); 887 991 } 888 SignToolPkcs7Exe_Delete(&Src); 992 if (pszSrc) 993 SignToolPkcs7Exe_Delete(&Src); 994 } 995 996 return rcExit; 997 } 998 999 1000 /* 1001 * The 'add-nested-cat-signature' command. 1002 */ 1003 static RTEXITCODE HelpAddNestedCatSignature(PRTSTREAM pStrm, RTSIGNTOOLHELP enmLevel) 1004 { 1005 RT_NOREF_PV(enmLevel); 1006 RTStrmPrintf(pStrm, "add-nested-cat-signature [-v|--verbose] <destination-cat> <source-cat>\n"); 1007 if (enmLevel == RTSIGNTOOLHELP_FULL) 1008 RTStrmPrintf(pStrm, 1009 "\n" 1010 "The --debug option allows the source-cat to be omitted in order to test the\n" 1011 "ASN.1 re-encoding of the destination catalog file.\n"); 1012 return RTEXITCODE_SUCCESS; 1013 } 1014 1015 1016 static RTEXITCODE HandleAddNestedCatSignature(int cArgs, char **papszArgs) 1017 { 1018 /* 1019 * Parse arguments. 1020 */ 1021 static const RTGETOPTDEF s_aOptions[] = 1022 { 1023 { "--verbose", 'v', RTGETOPT_REQ_NOTHING }, 1024 { "--debug", 'd', RTGETOPT_REQ_NOTHING }, 1025 }; 1026 1027 const char *pszDst = NULL; 1028 const char *pszSrc = NULL; 1029 unsigned cVerbosity = 0; 1030 bool fDebug = false; 1031 1032 RTGETOPTSTATE GetState; 1033 int rc = RTGetOptInit(&GetState, cArgs, papszArgs, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST); 1034 AssertRCReturn(rc, RTEXITCODE_FAILURE); 1035 RTGETOPTUNION ValueUnion; 1036 int ch; 1037 while ((ch = RTGetOpt(&GetState, &ValueUnion))) 1038 { 1039 switch (ch) 1040 { 1041 case 'v': cVerbosity++; break; 1042 case 'd': fDebug = pszSrc == NULL; break; 1043 case 'V': return HandleVersion(cArgs, papszArgs); 1044 case 'h': return HelpAddNestedCatSignature(g_pStdOut, RTSIGNTOOLHELP_FULL); 1045 1046 case VINF_GETOPT_NOT_OPTION: 1047 if (!pszDst) 1048 pszDst = ValueUnion.psz; 1049 else if (!pszSrc) 1050 { 1051 pszSrc = ValueUnion.psz; 1052 fDebug = false; 1053 } 1054 else 1055 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Too many file arguments: %s", ValueUnion.psz); 1056 break; 1057 1058 default: 1059 return RTGetOptPrintError(ch, &ValueUnion); 1060 } 1061 } 1062 if (!pszDst) 1063 return RTMsgErrorExit(RTEXITCODE_FAILURE, "No destination catalog file given."); 1064 if (!pszSrc && !fDebug) 1065 return RTMsgErrorExit(RTEXITCODE_FAILURE, "No source catalog file given."); 1066 1067 /* 1068 * Do it. 1069 */ 1070 /* Read & decode the source PKCS#7 signature. */ 1071 SIGNTOOLPKCS7 Src; 1072 RTEXITCODE rcExit = pszSrc ? SignToolPkcs7_InitFromFile(&Src, pszSrc, cVerbosity) : RTEXITCODE_SUCCESS; 1073 if (rcExit == RTEXITCODE_SUCCESS) 1074 { 1075 /* Ditto for the destination PKCS#7 signature. */ 1076 SIGNTOOLPKCS7EXE Dst; 1077 rcExit = SignToolPkcs7_InitFromFile(&Dst, pszDst, cVerbosity); 1078 if (rcExit == RTEXITCODE_SUCCESS) 1079 { 1080 /* Do the signature manipulation. */ 1081 if (pszSrc) 1082 rcExit = SignToolPkcs7_AddNestedSignature(&Dst, &Src, cVerbosity); 1083 if (rcExit == RTEXITCODE_SUCCESS) 1084 rcExit = SignToolPkcs7_Encode(&Dst, cVerbosity); 1085 1086 /* Update the destination executable file. */ 1087 if (rcExit == RTEXITCODE_SUCCESS) 1088 rcExit = SignToolPkcs7_WriteSignatureToFile(&Dst, pszDst, cVerbosity); 1089 1090 SignToolPkcs7_Delete(&Dst); 1091 } 1092 if (pszSrc) 1093 SignToolPkcs7_Delete(&Src); 889 1094 } 890 1095 … … 1275 1480 1276 1481 /* 1277 * The 'show-exe' command. 1278 */ 1279 static RTEXITCODE HelpShowExe(PRTSTREAM pStrm, RTSIGNTOOLHELP enmLevel) 1280 { 1281 RT_NOREF_PV(enmLevel); 1282 RTStrmPrintf(pStrm, 1283 "show-exe [--verbose|-v] [--quiet|-q] <exe1> [exe2 [..]]\n"); 1284 return RTEXITCODE_SUCCESS; 1285 } 1286 1482 * common code for show-exe and show-cat: 1483 */ 1287 1484 1288 1485 /** … … 1665 1862 */ 1666 1863 RTPrintf("%sDigestAlgorithms: ", pThis->szPrefix); 1864 if (pSignedData->DigestAlgorithms.cItems == 0) 1865 RTPrintf("none"); 1667 1866 for (unsigned i = 0; i < pSignedData->DigestAlgorithms.cItems; i++) 1668 1867 { … … 1697 1896 { 1698 1897 RTPrintf("%s Certificates: %u\n", pThis->szPrefix, pSignedData->Certificates.cItems); 1699 for (uint32_t i = 0; i < pSignedData->Certificates.cItems; i++) 1700 { 1701 if (i != 0) 1702 RTPrintf("\n"); 1703 RTPrintf("%s Certificate #%u:\n", pThis->szPrefix, i); 1704 RTAsn1Dump(RTCrPkcs7Cert_GetAsn1Core(pSignedData->Certificates.papItems[i]), 0, 1705 ((uint32_t)offPrefix + 9) / 2, RTStrmDumpPrintfV, g_pStdOut); 1898 if (pThis->cVerbosity >= 2) 1899 { 1900 for (uint32_t i = 0; i < pSignedData->Certificates.cItems; i++) 1901 { 1902 if (i != 0) 1903 RTPrintf("\n"); 1904 RTPrintf("%s Certificate #%u:\n", pThis->szPrefix, i); 1905 RTAsn1Dump(RTCrPkcs7Cert_GetAsn1Core(pSignedData->Certificates.papItems[i]), 0, 1906 ((uint32_t)offPrefix + 9) / 2, RTStrmDumpPrintfV, g_pStdOut); 1907 } 1706 1908 } 1707 1909 /** @todo display certificates properly. */ … … 1714 1916 * Show signatures (SignerInfos). 1715 1917 */ 1716 RTPrintf("%s SignerInfos:\n", pThis->szPrefix);1717 1918 unsigned const cSigInfos = pSignedData->SignerInfos.cItems; 1919 if (cSigInfos != 1) 1920 RTPrintf("%s SignerInfos: %u signers\n", pThis->szPrefix, cSigInfos); 1921 else 1922 RTPrintf("%s SignerInfos:\n", pThis->szPrefix); 1718 1923 for (unsigned i = 0; i < cSigInfos; i++) 1719 1924 { … … 1786 1991 1787 1992 1788 /** 1789 * Shows the signing info for one executable. 1790 * 1791 * @returns RTEXITCODE_SUCCESS on success, RTEXITCODE_FAILURE on failure. 1792 * @param pszFilename The path to the executable. 1793 * @param cVerbosity The verbosity level. 1794 * @param enmLdrArch Sub image selector. 1795 */ 1796 static RTEXITCODE HandleShowExeWorker(const char *pszFilename, unsigned cVerbosity, RTLDRARCH enmLdrArch) 1797 { 1798 SHOWEXEPKCS7 This; 1799 RT_ZERO(This); 1800 This.cVerbosity = cVerbosity; 1801 1802 RTEXITCODE rcExit = SignToolPkcs7Exe_InitFromFile(&This, pszFilename, cVerbosity, enmLdrArch); 1803 if (rcExit == RTEXITCODE_SUCCESS) 1804 { 1805 int rc = HandleShowExeWorkerPkcs7Display(&This, This.pSignedData, 0, &This.ContentInfo); 1806 if (RT_FAILURE(rc)) 1807 rcExit = RTEXITCODE_FAILURE; 1808 SignToolPkcs7Exe_Delete(&This); 1809 } 1810 1811 return rcExit; 1993 /* 1994 * The 'show-exe' command. 1995 */ 1996 static RTEXITCODE HelpShowExe(PRTSTREAM pStrm, RTSIGNTOOLHELP enmLevel) 1997 { 1998 RT_NOREF_PV(enmLevel); 1999 RTStrmPrintf(pStrm, 2000 "show-exe [--verbose|-v] [--quiet|-q] <exe1> [exe2 [..]]\n"); 2001 return RTEXITCODE_SUCCESS; 1812 2002 } 1813 2003 … … 1815 2005 static RTEXITCODE HandleShowExe(int cArgs, char **papszArgs) 1816 2006 { 1817 /* Note! This code does not try to clean up the crypto stores on failure.1818 This is intentional as the code is only expected to be used in a1819 one-command-per-process environment where we do exit() upon1820 returning from this function. */1821 1822 2007 /* 1823 2008 * Parse arguments. … … 1829 2014 }; 1830 2015 1831 unsigned cVerbos e= 0;2016 unsigned cVerbosity = 0; 1832 2017 RTLDRARCH enmLdrArch = RTLDRARCH_WHATEVER; 1833 2018 … … 1841 2026 switch (ch) 1842 2027 { 1843 case 'v': cVerbos e++; break;1844 case 'q': cVerbos e= 0; break;2028 case 'v': cVerbosity++; break; 2029 case 'q': cVerbosity = 0; break; 1845 2030 case 'V': return HandleVersion(cArgs, papszArgs); 1846 2031 case 'h': return HelpShowExe(g_pStdOut, RTSIGNTOOLHELP_FULL); … … 1859 2044 { 1860 2045 RTPrintf(iFile == 0 ? "%s:\n" : "\n%s:\n", ValueUnion.psz); 1861 RTEXITCODE rcExitThis = HandleShowExeWorker(ValueUnion.psz, cVerbose, enmLdrArch); 2046 2047 SHOWEXEPKCS7 This; 2048 RT_ZERO(This); 2049 This.cVerbosity = cVerbosity; 2050 2051 RTEXITCODE rcExitThis = SignToolPkcs7Exe_InitFromFile(&This, ValueUnion.psz, cVerbosity, enmLdrArch); 2052 if (rcExitThis == RTEXITCODE_SUCCESS) 2053 { 2054 int rc = HandleShowExeWorkerPkcs7Display(&This, This.pSignedData, 0, &This.ContentInfo); 2055 if (RT_FAILURE(rc)) 2056 rcExit = RTEXITCODE_FAILURE; 2057 SignToolPkcs7Exe_Delete(&This); 2058 } 1862 2059 if (rcExitThis != RTEXITCODE_SUCCESS && rcExit == RTEXITCODE_SUCCESS) 1863 2060 rcExit = rcExitThis; 2061 2062 iFile++; 2063 } while ((ch = RTGetOpt(&GetState, &ValueUnion)) == VINF_GETOPT_NOT_OPTION); 2064 if (ch != 0) 2065 return RTGetOptPrintError(ch, &ValueUnion); 2066 2067 return rcExit; 2068 } 2069 2070 2071 /* 2072 * The 'show-cat' command. 2073 */ 2074 static RTEXITCODE HelpShowCat(PRTSTREAM pStrm, RTSIGNTOOLHELP enmLevel) 2075 { 2076 RT_NOREF_PV(enmLevel); 2077 RTStrmPrintf(pStrm, 2078 "show-cat [--verbose|-v] [--quiet|-q] <cat1> [cat2 [..]]\n"); 2079 return RTEXITCODE_SUCCESS; 2080 } 2081 2082 2083 static RTEXITCODE HandleShowCat(int cArgs, char **papszArgs) 2084 { 2085 /* 2086 * Parse arguments. 2087 */ 2088 static const RTGETOPTDEF s_aOptions[] = 2089 { 2090 { "--verbose", 'v', RTGETOPT_REQ_NOTHING }, 2091 { "--quiet", 'q', RTGETOPT_REQ_NOTHING }, 2092 }; 2093 2094 unsigned cVerbosity = 0; 2095 2096 RTGETOPTSTATE GetState; 2097 int rc = RTGetOptInit(&GetState, cArgs, papszArgs, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST); 2098 AssertRCReturn(rc, RTEXITCODE_FAILURE); 2099 RTGETOPTUNION ValueUnion; 2100 int ch; 2101 while ((ch = RTGetOpt(&GetState, &ValueUnion)) && ch != VINF_GETOPT_NOT_OPTION) 2102 { 2103 switch (ch) 2104 { 2105 case 'v': cVerbosity++; break; 2106 case 'q': cVerbosity = 0; break; 2107 case 'V': return HandleVersion(cArgs, papszArgs); 2108 case 'h': return HelpShowCat(g_pStdOut, RTSIGNTOOLHELP_FULL); 2109 default: return RTGetOptPrintError(ch, &ValueUnion); 2110 } 2111 } 2112 if (ch != VINF_GETOPT_NOT_OPTION) 2113 return RTMsgErrorExit(RTEXITCODE_FAILURE, "No executable given."); 2114 2115 /* 2116 * Do it. 2117 */ 2118 unsigned iFile = 0; 2119 RTEXITCODE rcExit = RTEXITCODE_SUCCESS; 2120 do 2121 { 2122 RTPrintf(iFile == 0 ? "%s:\n" : "\n%s:\n", ValueUnion.psz); 2123 2124 SHOWEXEPKCS7 This; 2125 RT_ZERO(This); 2126 This.cVerbosity = cVerbosity; 2127 2128 RTEXITCODE rcExitThis = SignToolPkcs7_InitFromFile(&This, ValueUnion.psz, cVerbosity); 2129 if (rcExitThis == RTEXITCODE_SUCCESS) 2130 { 2131 This.hLdrMod = NIL_RTLDRMOD; 2132 2133 int rc = HandleShowExeWorkerPkcs7Display(&This, This.pSignedData, 0, &This.ContentInfo); 2134 if (RT_FAILURE(rc)) 2135 rcExit = RTEXITCODE_FAILURE; 2136 SignToolPkcs7Exe_Delete(&This); 2137 } 2138 if (rcExitThis != RTEXITCODE_SUCCESS && rcExit == RTEXITCODE_SUCCESS) 2139 rcExit = rcExitThis; 2140 1864 2141 iFile++; 1865 2142 } while ((ch = RTGetOpt(&GetState, &ValueUnion)) == VINF_GETOPT_NOT_OPTION); … … 2133 2410 { "extract-exe-signer-cert", HandleExtractExeSignerCert, HelpExtractExeSignerCert }, 2134 2411 { "add-nested-exe-signature", HandleAddNestedExeSignature, HelpAddNestedExeSignature }, 2412 { "add-nested-cat-signature", HandleAddNestedCatSignature, HelpAddNestedCatSignature }, 2135 2413 #ifndef IPRT_IN_BUILD_TOOL 2136 2414 { "verify-exe", HandleVerifyExe, HelpVerifyExe }, 2137 2415 { "show-exe", HandleShowExe, HelpShowExe }, 2416 { "show-cat", HandleShowCat, HelpShowCat }, 2138 2417 #endif 2139 2418 { "make-tainfo", HandleMakeTaInfo, HelpMakeTaInfo },
Note:
See TracChangeset
for help on using the changeset viewer.