Changeset 52600 in vbox for trunk/src/VBox/Runtime/common/crypto/pkcs7-core.cpp
- Timestamp:
- Sep 4, 2014 10:59:00 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 95876
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/crypto/pkcs7-core.cpp
r52537 r52600 34 34 #include <iprt/err.h> 35 35 #include <iprt/string.h> 36 #include <iprt/crypto/tsp.h> 36 37 37 38 #include "pkcs7-internal.h" … … 127 128 128 129 130 RTDECL(PCRTASN1TIME) RTCrPkcs7SignerInfo_GetMsTimestamp(PCRTCRPKCS7SIGNERINFO pThis, PCRTCRPKCS7CONTENTINFO *ppContentInfo) 131 { 132 /* 133 * Assume there is only one, so no need to enumerate anything here. 134 */ 135 uint32_t cAttrsLeft = pThis->UnauthenticatedAttributes.cItems; 136 PCRTCRPKCS7ATTRIBUTE pAttr = pThis->UnauthenticatedAttributes.paItems; 137 while (cAttrsLeft-- > 0) 138 { 139 if (pAttr->enmType == RTCRPKCS7ATTRIBUTETYPE_MS_TIMESTAMP) 140 { 141 uint32_t cLeft = pAttr->uValues.pContentInfos->cItems; 142 PCRTCRPKCS7CONTENTINFO pContentInfo = &pAttr->uValues.pContentInfos->paItems[0]; 143 while (cLeft-- > 0) 144 { 145 if (RTAsn1ObjId_CompareWithString(&pContentInfo->ContentType, RTCRPKCS7SIGNEDDATA_OID) == 0) 146 { 147 if (RTAsn1ObjId_CompareWithString(&pContentInfo->u.pSignedData->ContentInfo.ContentType, 148 RTCRTSPTSTINFO_OID) == 0) 149 { 150 if (ppContentInfo) 151 *ppContentInfo = pContentInfo; 152 return &pContentInfo->u.pSignedData->ContentInfo.u.pTstInfo->GenTime; 153 } 154 } 155 156 pContentInfo++; 157 } 158 } 159 pAttr++; 160 } 161 162 /* 163 * No signature was found. 164 */ 165 if (ppContentInfo) 166 *ppContentInfo = NULL; 167 168 return NULL; 169 } 170 171 129 172 /* 130 173 * PCKS #7 ContentInfo. … … 138 181 139 182 /* 183 * Set of some kind of certificate supported by PKCS #7 or CMS. 184 */ 185 186 RTDECL(PCRTCRX509CERTIFICATE) 187 RTCrPkcs7SetOfCerts_FindX509ByIssuerAndSerialNumber(PCRTCRPKCS7SETOFCERTS pCertificates, 188 PCRTCRX509NAME pIssuer, PCRTASN1INTEGER pSerialNumber) 189 { 190 for (uint32_t i = 0; i < pCertificates->cItems; i++) 191 if ( pCertificates->paItems[i].enmChoice == RTCRPKCS7CERTCHOICE_X509 192 && RTCrX509Certificate_MatchIssuerAndSerialNumber(pCertificates->paItems[i].u.pX509Cert, pIssuer, pSerialNumber)) 193 return pCertificates->paItems[i].u.pX509Cert; 194 return NULL; 195 } 196 197 198 /* 140 199 * Generate the standard core code. 141 200 */
Note:
See TracChangeset
for help on using the changeset viewer.