Juan Lang : crypt32: Add one more test of CertAddEncodedCertificateToStore.

Alexandre Julliard julliard at wine.codeweavers.com
Thu May 25 04:15:56 CDT 2006


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

Author: Juan Lang <juan_lang at yahoo.com>
Date:   Wed May 24 18:47:30 2006 -0700

crypt32: Add one more test of CertAddEncodedCertificateToStore.

---

 dlls/crypt32/tests/store.c |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c
index 3d487ac..78b0530 100644
--- a/dlls/crypt32/tests/store.c
+++ b/dlls/crypt32/tests/store.c
@@ -127,7 +127,7 @@ static const BYTE certWithUsage[] = { 0x
  0x05, 0x05, 0x07, 0x03, 0x03, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07,
  0x03, 0x02, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01 };
 static const BYTE serialNum[] = { 1 };
-static const BYTE bigCertWithDifferentIssuer[] = { 0x30, 0x7a, 0x02, 0x01, 0x01,
+static const BYTE bigCertWithDifferentSubject[] = { 0x30, 0x7a, 0x02, 0x01, 0x01,
  0x30, 0x02, 0x06, 0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55,
  0x04, 0x03, 0x13, 0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67,
  0x00, 0x30, 0x22, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31,
@@ -138,6 +138,17 @@ static const BYTE bigCertWithDifferentIs
  0x00, 0x03, 0x01, 0x00, 0xa3, 0x16, 0x30, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55,
  0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02,
  0x01, 0x01 };
+static const BYTE bigCertWithDifferentIssuer[] = { 0x30, 0x7a, 0x02, 0x01,
+ 0x01, 0x30, 0x02, 0x06, 0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03,
+ 0x55, 0x04, 0x03, 0x13, 0x0a, 0x41, 0x6c, 0x65, 0x78, 0x20, 0x4c, 0x61, 0x6e,
+ 0x67, 0x00, 0x30, 0x22, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30,
+ 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x31, 0x36, 0x30,
+ 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30,
+ 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0a, 0x4a,
+ 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30, 0x07, 0x30, 0x02,
+ 0x06, 0x00, 0x03, 0x01, 0x00, 0xa3, 0x16, 0x30, 0x14, 0x30, 0x12, 0x06, 0x03,
+ 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff,
+ 0x02, 0x01, 0x01 };
 
 static void testAddCert(void)
 {
@@ -224,8 +235,8 @@ static void testAddCert(void)
             CertFreeCertificateContext(context);
         }
 
-        /* Adding a cert that differs by nothing more than serial number
-         * succeeds.
+        /* Adding a cert with the same issuer name and serial number (but
+         * different subject) as an existing cert succeeds.
          */
         context = NULL;
         ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
@@ -236,6 +247,18 @@ static void testAddCert(void)
         if (context)
             CertDeleteCertificateFromStore(context);
 
+        /* Adding a cert with the same subject name and serial number (but
+         * different issuer) as an existing cert succeeds.
+         */
+        context = NULL;
+        ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
+         bigCertWithDifferentSubject, sizeof(bigCertWithDifferentSubject),
+         CERT_STORE_ADD_NEW, &context);
+        ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n",
+         GetLastError());
+        if (context)
+            CertDeleteCertificateFromStore(context);
+
         /* Adding a cert with the same issuer name and serial number (but
          * different otherwise) as an existing cert succeeds.
          */




More information about the wine-cvs mailing list