]> granicus.if.org Git - curl/commitdiff
Simplify check for trusted certificates.
authorGuenter Knauf <lists@gknw.net>
Mon, 5 Aug 2013 11:02:27 +0000 (13:02 +0200)
committerGuenter Knauf <lists@gknw.net>
Mon, 5 Aug 2013 11:02:27 +0000 (13:02 +0200)
This changes the previous check for untrusted certs to a check for
certs explicitely marked as trusted.
The change is backward-compatible (tested with certdata.txt v1.80).

lib/mk-ca-bundle.pl
lib/mk-ca-bundle.vbs

index 873f8fb772574505e56008e22abee1803573a523..1a9c859857a0c5975d2afc22eab7ac01ec8e29d6 100755 (executable)
@@ -164,7 +164,7 @@ while (<TXT>) {
   if ($start_of_cert && /^CKA_LABEL UTF8 \"(.*)\"/) {
     $caname = $1;
   }
-  my $untrusted = 0;
+  my $untrusted = 1;
   if ($start_of_cert && /^CKA_VALUE MULTILINE_OCTAL/) {
     my $data;
     while (<TXT>) {
@@ -184,10 +184,8 @@ while (<TXT>) {
     # now scan the trust part for untrusted certs
     while (<TXT>) {
       last if (/^#/);
-      if (/^CKA_TRUST_SERVER_AUTH\s+CK_TRUST\s+CKT_NSS_NOT_TRUSTED$/
-          or /^CKA_TRUST_SERVER_AUTH\s+CK_TRUST\s+CKT_NSS_TRUST_UNKNOWN$/
-          or /^CKA_TRUST_SERVER_AUTH\s+CK_TRUST\s+CKT_NSS_MUST_VERIFY_TRUST/) {
-        $untrusted = 1;
+      if (/^CKA_TRUST_SERVER_AUTH\s+CK_TRUST\s+CKT_NSS_TRUSTED_DELEGATOR$/) {
+          $untrusted = 0;
       }
     }
     if ($untrusted) {
index a8b2358a14064f5a050d945a3ab5e6e1a6f06561..d86807929e02414274899a1be917337606c5b6a3 100755 (executable)
@@ -130,10 +130,8 @@ For i = 0 To UBound(myLines)
       myInsideCert = FALSE\r
       While (i < UBound(myLines)) And Not (myLines(i) = "#")\r
         i = i + 1\r
-        If (InstrRev(myLines(i), "CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED") Or _\r
-           InstrRev(myLines(i), "CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUST_UNKNOWN") Or _\r
-           InstrRev(myLines(i), "CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST")) Then\r
-          myUntrusted = TRUE\r
+        If InstrRev(myLines(i), "CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR") Then\r
+          myUntrusted = FALSE\r
         End If\r
       Wend\r
       If (myUntrusted = TRUE) Then\r
@@ -183,7 +181,7 @@ For i = 0 To UBound(myLines)
   End If\r
   If InstrRev(myLines(i), "CKA_VALUE MULTILINE_OCTAL") Then\r
     myInsideCert = TRUE\r
-    myUntrusted = FALSE\r
+    myUntrusted = TRUE\r
     myData = ""\r
   End If\r
   If InstrRev(myLines(i), "***** BEGIN LICENSE BLOCK *****") Then\r