Juan Lang : crypt32: Test finding the issuer of a certificate.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Aug 14 07:12:56 CDT 2007


Module: wine
Branch: master
Commit: aa0f823429f8a51dcc1d78166c83dc98fab08705
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=aa0f823429f8a51dcc1d78166c83dc98fab08705

Author: Juan Lang <juan.lang at gmail.com>
Date:   Mon Aug 13 14:32:58 2007 -0700

crypt32: Test finding the issuer of a certificate.

---

 dlls/crypt32/tests/cert.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/dlls/crypt32/tests/cert.c b/dlls/crypt32/tests/cert.c
index 2578ba3..6a73c91 100644
--- a/dlls/crypt32/tests/cert.c
+++ b/dlls/crypt32/tests/cert.c
@@ -929,7 +929,7 @@ static BYTE iTunesSerialNum[] = {
 static void testFindCert(void)
 {
     HCERTSTORE store;
-    PCCERT_CONTEXT context = NULL;
+    PCCERT_CONTEXT context = NULL, subject;
     BOOL ret;
     CERT_INFO certInfo = { 0 };
     CRYPT_HASH_BLOB blob;
@@ -1067,7 +1067,7 @@ static void testFindCert(void)
     ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n",
      GetLastError());
     ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
-     iTunesCert3, sizeof(iTunesCert3), CERT_STORE_ADD_NEW, NULL);
+     iTunesCert3, sizeof(iTunesCert3), CERT_STORE_ADD_NEW, &subject);
     ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n",
      GetLastError());
 
@@ -1098,6 +1098,18 @@ static void testFindCert(void)
         ok(context == NULL, "Expected one cert only\n");
     }
 
+    context = CertFindCertificateInStore(store, X509_ASN_ENCODING, 0,
+     CERT_FIND_ISSUER_OF, subject, NULL);
+    ok(context != NULL, "Expected an issuer\n");
+    if (context)
+    {
+        PCCERT_CONTEXT none = CertFindCertificateInStore(store,
+         X509_ASN_ENCODING, 0, CERT_FIND_ISSUER_OF, context, NULL);
+
+        ok(!none, "Expected no parent of issuer\n");
+        CertFreeCertificateContext(context);
+    }
+    CertFreeCertificateContext(subject);
     CertCloseStore(store, 0);
 }
 




More information about the wine-cvs mailing list