Changeset 59675 in vbox for trunk/src/VBox/Runtime/testcase/tstRTCrX509-1.cpp
- Timestamp:
- Feb 15, 2016 10:39:32 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 105532
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstRTCrX509-1.cpp
r59668 r59675 48 48 const char *pszFile; 49 49 bool fMaybeNotInOpenSSL; 50 bool fSelfSigned; 50 51 51 52 char const *pchPem; … … 56 57 } g_aFiles[] = 57 58 { 58 #define MY_CERT_ENTRY(a_fMaybeNotInOpenSSL, a_ Name) \59 { #a_Name, a_fMaybeNotInOpenSSL, \59 #define MY_CERT_ENTRY(a_fMaybeNotInOpenSSL, a_fSelfSigned, a_Name) \ 60 { #a_Name, a_fMaybeNotInOpenSSL, a_fSelfSigned, \ 60 61 (const char *)RT_CONCAT(g_abPem_, a_Name), RT_CONCAT(g_cbPem_, a_Name), \ 61 RT_CONCAT(g_abCertDer_, a_Name), RT_CONCAT(g_cbCertDer_, a_Name) } 62 MY_CERT_ENTRY(true, md4), 63 MY_CERT_ENTRY(false, md5), 64 MY_CERT_ENTRY(false, sha1), 65 /// @todo fix this: MY_CERT_ENTRY(false, sha224), 66 MY_CERT_ENTRY(false, sha256), 67 MY_CERT_ENTRY(false, sha384), 68 MY_CERT_ENTRY(false, sha512), 62 RT_CONCAT(g_abDer_, a_Name), RT_CONCAT(g_cbDer_, a_Name) } 63 MY_CERT_ENTRY(true, true, md4), 64 MY_CERT_ENTRY(false, true, md5), 65 MY_CERT_ENTRY(false, true, sha1), 66 /// @todo fix this: MY_CERT_ENTRY(false, true, sha224), 67 MY_CERT_ENTRY(false, true, sha256), 68 MY_CERT_ENTRY(false, true, sha384), 69 MY_CERT_ENTRY(false, true, sha512), 70 MY_CERT_ENTRY(false, false, cert1), 69 71 }; 70 72 … … 140 142 141 143 /* 142 * Check that our self signed check works , since all of them are self signed.144 * Check that our self signed check works. 143 145 */ 144 RTTESTI_CHECK(RTCrX509Certificate_IsSelfSigned(&Cert0) );145 RTTESTI_CHECK(RTCrX509Certificate_IsSelfSigned(&Cert1) );146 RTTESTI_CHECK(RTCrX509Certificate_IsSelfSigned(&Cert2) );146 RTTESTI_CHECK(RTCrX509Certificate_IsSelfSigned(&Cert0) == g_aFiles[i].fSelfSigned); 147 RTTESTI_CHECK(RTCrX509Certificate_IsSelfSigned(&Cert1) == g_aFiles[i].fSelfSigned); 148 RTTESTI_CHECK(RTCrX509Certificate_IsSelfSigned(&Cert2) == g_aFiles[i].fSelfSigned); 147 149 148 /* 149 * Verify the certificate signature (self signed). 150 */ 151 for (j = 0; j < RT_ELEMENTS(paCerts); j++) 150 if (g_aFiles[i].fSelfSigned) 152 151 { 153 rc = RTCrX509Certificate_VerifySignatureSelfSigned(paCerts[j], NULL /*pErrInfo*/); 154 if ( RT_FAILURE(rc) 155 && ( rc != VERR_CR_PKIX_OSSL_CIPHER_ALGO_NOT_KNOWN_EVP 156 || !g_aFiles[i].fMaybeNotInOpenSSL) ) 157 RTTestIFailed("RTCrX509Certificate_VerifySignatureSelfSigned failed for %s (#%u), variation %u: %Rrc", 158 g_aFiles[i].pszFile, i, j, rc); 152 /* 153 * Verify the certificate signature (self signed). 154 */ 155 for (j = 0; j < RT_ELEMENTS(paCerts); j++) 156 { 157 rc = RTCrX509Certificate_VerifySignatureSelfSigned(paCerts[j], NULL /*pErrInfo*/); 158 if ( RT_FAILURE(rc) 159 && ( rc != VERR_CR_PKIX_OSSL_CIPHER_ALGO_NOT_KNOWN_EVP 160 || !g_aFiles[i].fMaybeNotInOpenSSL) ) 161 RTTestIFailed("RTCrX509Certificate_VerifySignatureSelfSigned failed for %s (#%u), variation %u: %Rrc", 162 g_aFiles[i].pszFile, i, j, rc); 163 } 159 164 } 160 161 165 } 162 166
Note:
See TracChangeset
for help on using the changeset viewer.