Changeset 59620 in vbox for trunk/src/VBox/Runtime/common/crypto/x509-file.cpp
- Timestamp:
- Feb 10, 2016 12:47:33 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 105459
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/crypto/x509-file.cpp
r57358 r59620 79 79 80 80 81 RTDECL(int) RTCrX509Certificate_ReadFromBuffer(PRTCRX509CERTIFICATE pCertificate, const void *pvBuf, size_t cbBuf, 82 uint32_t fFlags, PCRTASN1ALLOCATORVTABLE pAllocator, 83 PRTERRINFO pErrInfo, const char *pszErrorTag) 84 { 85 AssertReturn(!fFlags, VERR_INVALID_FLAGS); 86 PCRTCRPEMSECTION pSectionHead; 87 int rc = RTCrPemParseContent(pvBuf, cbBuf, 0, g_aCertificateMarkers, RT_ELEMENTS(g_aCertificateMarkers), 88 &pSectionHead, pErrInfo); 89 if (RT_SUCCESS(rc)) 90 { 91 RTCRX509CERTIFICATE TmpCert; 92 RTASN1CURSORPRIMARY PrimaryCursor; 93 RTAsn1CursorInitPrimary(&PrimaryCursor, pSectionHead->pbData, (uint32_t)RT_MIN(pSectionHead->cbData, UINT32_MAX), 94 pErrInfo, pAllocator, RTASN1CURSOR_FLAGS_DER, pszErrorTag); 95 rc = RTCrX509Certificate_DecodeAsn1(&PrimaryCursor.Cursor, 0, &TmpCert, "Cert"); 96 if (RT_SUCCESS(rc)) 97 { 98 rc = RTCrX509Certificate_CheckSanity(&TmpCert, 0, pErrInfo, "Cert"); 99 if (RT_SUCCESS(rc)) 100 { 101 rc = RTCrX509Certificate_Clone(pCertificate, &TmpCert, &g_RTAsn1DefaultAllocator); 102 if (RT_SUCCESS(rc)) 103 { 104 if (pSectionHead->pNext || PrimaryCursor.Cursor.cbLeft) 105 rc = VINF_ASN1_MORE_DATA; 106 } 107 } 108 RTCrX509Certificate_Delete(&TmpCert); 109 } 110 RTCrPemFreeSections(pSectionHead); 111 } 112 return rc; 113 } 114 115 81 116 82 117 #if 0
Note:
See TracChangeset
for help on using the changeset viewer.