Changeset 64886 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Dec 15, 2016 3:32:37 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 112293
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/tools/RTSignTool.cpp
r64884 r64886 913 913 914 914 /** 915 * Decodes the PKCS #7 blob pointed to by pThis->pbBuf.916 *917 * @returns IPRT status code.918 * @param pThis The show exe instance data.919 */920 static int HandleShowExeWorkerPkcs7Decode(PSHOWEXEPKCS7 pThis)921 {922 RTERRINFOSTATIC ErrInfo;923 RTASN1CURSORPRIMARY PrimaryCursor;924 RTAsn1CursorInitPrimary(&PrimaryCursor, pThis->pbBuf, (uint32_t)pThis->cbBuf, RTErrInfoInitStatic(&ErrInfo),925 &g_RTAsn1DefaultAllocator, 0, "WinCert");926 927 int rc = RTCrPkcs7ContentInfo_DecodeAsn1(&PrimaryCursor.Cursor, 0, &pThis->ContentInfo, "CI");928 if (RT_SUCCESS(rc))929 {930 if (RTCrPkcs7ContentInfo_IsSignedData(&pThis->ContentInfo))931 {932 pThis->pSignedData = pThis->ContentInfo.u.pSignedData;933 934 /*935 * Decode the authenticode bits.936 */937 if (!strcmp(pThis->pSignedData->ContentInfo.ContentType.szObjId, RTCRSPCINDIRECTDATACONTENT_OID))938 {939 pThis->pIndData = pThis->pSignedData->ContentInfo.u.pIndirectDataContent;940 Assert(pThis->pIndData);941 942 /*943 * Check that things add up.944 */945 rc = RTCrPkcs7SignedData_CheckSanity(pThis->pSignedData,946 RTCRPKCS7SIGNEDDATA_SANITY_F_AUTHENTICODE947 | RTCRPKCS7SIGNEDDATA_SANITY_F_ONLY_KNOWN_HASH948 | RTCRPKCS7SIGNEDDATA_SANITY_F_SIGNING_CERT_PRESENT,949 RTErrInfoInitStatic(&ErrInfo), "SD");950 if (RT_FAILURE(rc))951 RTMsgError("PKCS#7 sanity check failed for '%s': %Rrc - %s\n", pThis->pszFilename, rc, ErrInfo.szMsg);952 if (RT_SUCCESS(rc))953 {954 rc = RTCrSpcIndirectDataContent_CheckSanityEx(pThis->pIndData,955 pThis->pSignedData,956 RTCRSPCINDIRECTDATACONTENT_SANITY_F_ONLY_KNOWN_HASH,957 RTErrInfoInitStatic(&ErrInfo));958 if (RT_FAILURE(rc))959 RTMsgError("SPC indirect data content sanity check failed for '%s': %Rrc - %s\n",960 pThis->pszFilename, rc, ErrInfo.szMsg);961 }962 }963 else964 RTMsgError("Unexpected the signed content in '%s': %s (expected %s)", pThis->pszFilename,965 pThis->pSignedData->ContentInfo.ContentType.szObjId, RTCRSPCINDIRECTDATACONTENT_OID);966 }967 else968 RTMsgError("PKCS#7 content is inside '%s' is not 'signedData': %s\n",969 pThis->pszFilename, pThis->ContentInfo.ContentType.szObjId);970 }971 else972 RTMsgError("RTCrPkcs7ContentInfo_DecodeAsn1 failed on '%s': %Rrc - %s\n", pThis->pszFilename, rc, ErrInfo.szMsg);973 return rc;974 }975 976 977 /**978 915 * Display an object ID. 979 916 *
Note:
See TracChangeset
for help on using the changeset viewer.