]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Add key-id self test.
authorSimon Josefsson <simon@josefsson.org>
Thu, 1 Feb 2007 11:13:32 +0000 (11:13 +0000)
committerSimon Josefsson <simon@josefsson.org>
Thu, 1 Feb 2007 11:13:32 +0000 (11:13 +0000)
configure.in
tests/Makefile.am
tests/key-id/Makefile.am [new file with mode: 0644]
tests/key-id/README [new file with mode: 0644]
tests/key-id/ca-gnutls-keyid.pem [new file with mode: 0644]
tests/key-id/ca-no-keyid.pem [new file with mode: 0644]
tests/key-id/ca-weird-keyid.pem [new file with mode: 0644]
tests/key-id/key-ca.pem [new file with mode: 0644]
tests/key-id/key-id [new file with mode: 0755]
tests/key-id/key-user.pem [new file with mode: 0644]

index e0a0228aa1bb050acc6f1cd67c67022a0407497a..3ec037916e058a0267a04c4eaf4428e1afef5edf 100644 (file)
@@ -616,6 +616,7 @@ AC_CONFIG_FILES([Makefile po/Makefile.in \
        tests/Makefile tests/rsa-md5-collision/Makefile tests/userid/Makefile \
        tests/pkcs1-padding/Makefile tests/pkcs8-decode/Makefile \
        tests/pkcs12-decode/Makefile tests/pathlen/Makefile \
+       tests/keyid/Makefile \
        includes/Makefile includes/gnutls/gnutls.h \
        lib/Makefile lib/minitasn1/Makefile lib/x509/Makefile \
        libextra/Makefile libextra/openpgp/Makefile libextra/opencdk/Makefile \
index 5c48ea84b709992f38e32f6ce99a26f2bced0e6b..6ad4163986b6e06b1eb53e2cf1c90989e12ce6d9 100644 (file)
@@ -20,7 +20,7 @@
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
 SUBDIRS = rsa-md5-collision pkcs1-padding pkcs8-decode pkcs12-decode   \
-       userid pathlen
+       userid pathlen key-id
 
 AM_CPPFLAGS = -I$(top_srcdir)/lgl -I$(top_builddir)/lgl                        \
        -I$(top_srcdir)/gl -I$(top_builddir)/gl                         \
diff --git a/tests/key-id/Makefile.am b/tests/key-id/Makefile.am
new file mode 100644 (file)
index 0000000..c63068a
--- /dev/null
@@ -0,0 +1,27 @@
+## Process this file with automake to produce Makefile.in
+# Copyright (C) 2007 Free Software Foundation
+#
+# Author: Simon Josefsson
+#
+# This file is part of GNUTLS.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this file; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+EXTRA_DIST = README key-ca.pem key-user.pem \
+       ca-gnutls-keyid.pem ca-no-keyid.pem ca-weird-keyid.pem
+
+dist_check_SCRIPTS = key-id
+
+TESTS = key-id
diff --git a/tests/key-id/README b/tests/key-id/README
new file mode 100644 (file)
index 0000000..013319b
--- /dev/null
@@ -0,0 +1,13 @@
+authkeyid README -- Information about auth-key-id self test.
+Copyright (C) 2007 Simon Josefsson
+See the end for copying conditions.
+
+This directory contains a check to find regressions for the bug
+related to Authority Key Id reported in:
+
+http://lists.gnupg.org/pipermail/gnutls-dev/2006-December/001317.html
+
+----------------------------------------------------------------------
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
diff --git a/tests/key-id/ca-gnutls-keyid.pem b/tests/key-id/ca-gnutls-keyid.pem
new file mode 100644 (file)
index 0000000..ad4ae9a
--- /dev/null
@@ -0,0 +1,46 @@
+
+
+X.509 certificate info:
+
+Version: 3
+Serial Number (hex): 00
+Subject: C=SE,CN=GnuTLS Test
+Issuer: C=SE,CN=GnuTLS Test
+Signature Algorithm: RSA-SHA
+Validity:
+       Not Before: Wed Jan 31 10:23:47 2007
+       Not After: Wed Mar 14 10:23:51 2007
+Subject Public Key Info:
+       Public Key Algorithm: RSA (512 bits)
+modulus:
+       c6:94:06:28:a7:51:24:39:b1:5a:01:54:9b:50:d4:
+       17:0c:4d:df:ac:42:00:07:e5:72:30:dc:88:2d:82:
+       16:80:da:23:47:a8:46:7c:c8:88:4f:0f:6a:d2:b4:
+       86:97:db:94:87:85:35:2f:51:e7:1c:33:7e:6b:1c:
+       00:07:1b:bb:
+public exponent:
+       01:00:01:
+
+X.509 Extensions:
+       Basic Constraints: (critical)
+               CA:TRUE
+       Subject Key ID: 
+               BA:E4:6F:63:51:90:6C:38:1B:DF:DA:89:B5:92:87:D3:29:E7:D7:41
+
+Other information:
+       MD5 Fingerprint: 49:4C:5E:02:10:16:82:5E:18:86:74:DF:51:56:EF:CC
+       SHA1 Fingerprint: B9:29:A0:CD:D1:B2:8F:C8:89:EB:87:E6:B5:9B:13:62:1C:D4:36:BF
+       Public Key ID: BA:E4:6F:63:51:90:6C:38:1B:DF:DA:89:B5:92:87:D3:29:E7:D7:41
+
+
+-----BEGIN CERTIFICATE-----
+MIIBYjCCAQ6gAwIBAgIBADALBgkqhkiG9w0BAQUwIzELMAkGA1UEBhMCU0UxFDAS
+BgNVBAMTC0dudVRMUyBUZXN0MB4XDTA3MDEzMTA5MjM0N1oXDTA3MDMxNDA5MjM1
+MVowIzELMAkGA1UEBhMCU0UxFDASBgNVBAMTC0dudVRMUyBUZXN0MFkwCwYJKoZI
+hvcNAQEBA0oAMEcCQMaUBiinUSQ5sVoBVJtQ1BcMTd+sQgAH5XIw3IgtghaA2iNH
+qEZ8yIhPD2rStIaX25SHhTUvUeccM35rHAAHG7sCAwEAAaMyMDAwDwYDVR0TAQH/
+BAUwAwEB/zAdBgNVHQ4EFgQUuuRvY1GQbDgb39qJtZKH0ynn10EwCwYJKoZIhvcN
+AQEFA0EAMIM/ZIai49eKHg/Hb/LoKPtY8bLIf+oRw+0ifZghudZPokwIukVRoRw3
+rvJSTitBJGH9uyNWn8bbackkkg4otA==
+-----END CERTIFICATE-----
+
diff --git a/tests/key-id/ca-no-keyid.pem b/tests/key-id/ca-no-keyid.pem
new file mode 100644 (file)
index 0000000..b058706
--- /dev/null
@@ -0,0 +1,43 @@
+
+
+X.509 certificate info:
+
+Version: 3
+Serial Number (hex): 2A
+Subject: CN=GnuTLS test2
+Issuer: CN=GnuTLS test2
+Signature Algorithm: RSA-SHA
+Validity:
+       Not Before: Wed Jan 31 10:34:15 2007
+       Not After: Wed Mar 14 10:34:18 2007
+Subject Public Key Info:
+       Public Key Algorithm: RSA (512 bits)
+modulus:
+       c6:94:06:28:a7:51:24:39:b1:5a:01:54:9b:50:d4:
+       17:0c:4d:df:ac:42:00:07:e5:72:30:dc:88:2d:82:
+       16:80:da:23:47:a8:46:7c:c8:88:4f:0f:6a:d2:b4:
+       86:97:db:94:87:85:35:2f:51:e7:1c:33:7e:6b:1c:
+       00:07:1b:bb:
+public exponent:
+       01:00:01:
+
+X.509 Extensions:
+       Basic Constraints: (critical)
+               CA:TRUE
+
+Other information:
+       MD5 Fingerprint: 0F:AF:52:29:F4:17:B4:28:8E:FA:7D:F1:76:F3:81:FF
+       SHA1 Fingerprint: 93:8D:80:22:77:17:0D:12:51:56:32:61:9F:12:BA:B7:66:D9:38:77
+       Public Key ID: BA:E4:6F:63:51:90:6C:38:1B:DF:DA:89:B5:92:87:D3:29:E7:D7:41
+
+
+-----BEGIN CERTIFICATE-----
+MIIBKjCB16ADAgECAgEqMAsGCSqGSIb3DQEBBTAXMRUwEwYDVQQDEwxHbnVUTFMg
+dGVzdDIwHhcNMDcwMTMxMDkzNDE1WhcNMDcwMzE0MDkzNDE4WjAXMRUwEwYDVQQD
+EwxHbnVUTFMgdGVzdDIwWTALBgkqhkiG9w0BAQEDSgAwRwJAxpQGKKdRJDmxWgFU
+m1DUFwxN36xCAAflcjDciC2CFoDaI0eoRnzIiE8PatK0hpfblIeFNS9R5xwzfmsc
+AAcbuwIDAQABoxMwETAPBgNVHRMBAf8EBTADAQH/MAsGCSqGSIb3DQEBBQNBAI6O
+9GReGvX7vMcZxjMOua6mIOViqOPeMzJRNEFqUAo4aHy/ad17nHZhy3WsWm2GkrTk
+AiKsBcgbwyu2d/Fg6js=
+-----END CERTIFICATE-----
+
diff --git a/tests/key-id/ca-weird-keyid.pem b/tests/key-id/ca-weird-keyid.pem
new file mode 100644 (file)
index 0000000..6d0579a
--- /dev/null
@@ -0,0 +1,52 @@
+
+
+X.509 certificate info:
+
+Version: 3
+Serial Number (hex): 00:D2:08:1A:82:A4:27:85:2B
+Subject: C=AU,ST=Some-State,O=Internet Widgits Pty Ltd
+Issuer: C=AU,ST=Some-State,O=Internet Widgits Pty Ltd
+Signature Algorithm: RSA-SHA
+Validity:
+       Not Before: Wed Jan 31 10:23:01 2007
+       Not After: Sat Jan 28 10:23:01 2017
+Subject Public Key Info:
+       Public Key Algorithm: RSA (512 bits)
+modulus:
+       c6:94:06:28:a7:51:24:39:b1:5a:01:54:9b:50:d4:
+       17:0c:4d:df:ac:42:00:07:e5:72:30:dc:88:2d:82:
+       16:80:da:23:47:a8:46:7c:c8:88:4f:0f:6a:d2:b4:
+       86:97:db:94:87:85:35:2f:51:e7:1c:33:7e:6b:1c:
+       00:07:1b:bb:
+public exponent:
+       01:00:01:
+
+X.509 Extensions:
+       Basic Constraints:
+               CA:TRUE
+       Subject Key ID: 
+               7A:2C:7A:60:97:46:06:03:CB:FB:28:E8:E2:19:DF:18:DE:EB:4E:0D
+       Authority Key ID: 
+               7A:2C:7A:60:97:46:06:03:CB:FB:28:E8:E2:19:DF:18:DE:EB:4E:0D
+
+Other information:
+       MD5 Fingerprint: EF:6B:8B:10:03:E4:5F:5E:76:AA:A9:88:8A:6E:03:14
+       SHA1 Fingerprint: 7C:7C:88:BD:34:5A:EC:F1:3C:6A:70:92:76:73:1B:59:32:DA:5E:74
+       Public Key ID: BA:E4:6F:63:51:90:6C:38:1B:DF:DA:89:B5:92:87:D3:29:E7:D7:41
+
+
+-----BEGIN CERTIFICATE-----
+MIICKzCCAdWgAwIBAgIJANIIGoKkJ4UrMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
+BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX
+aWRnaXRzIFB0eSBMdGQwHhcNMDcwMTMxMDkyMzAxWhcNMTcwMTI4MDkyMzAxWjBF
+MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50
+ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMaU
+BiinUSQ5sVoBVJtQ1BcMTd+sQgAH5XIw3IgtghaA2iNHqEZ8yIhPD2rStIaX25SH
+hTUvUeccM35rHAAHG7sCAwEAAaOBpzCBpDAdBgNVHQ4EFgQUeix6YJdGBgPL+yjo
+4hnfGN7rTg0wdQYDVR0jBG4wbIAUeix6YJdGBgPL+yjo4hnfGN7rTg2hSaRHMEUx
+CzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRl
+cm5ldCBXaWRnaXRzIFB0eSBMdGSCCQDSCBqCpCeFKzAMBgNVHRMEBTADAQH/MA0G
+CSqGSIb3DQEBBQUAA0EAv5CpU4DykkfMcy1BLbsowb/7YritEudYemW3cOMg6q92
+tc8eEDBjIYcVccHJMM27fTKt7AIDUiHUysFFxclcww==
+-----END CERTIFICATE-----
+
diff --git a/tests/key-id/key-ca.pem b/tests/key-id/key-ca.pem
new file mode 100644 (file)
index 0000000..88e775c
--- /dev/null
@@ -0,0 +1,9 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBPAIBAAJBAMaUBiinUSQ5sVoBVJtQ1BcMTd+sQgAH5XIw3IgtghaA2iNHqEZ8
+yIhPD2rStIaX25SHhTUvUeccM35rHAAHG7sCAwEAAQJAP/UlFqrtI3HBgW+0RGIA
+LXw1CLl+eGwSpni+Ts35fC1qEYCsjSwAzeNucV5urXnTTmsboHNIig54MnwbL1Sn
+YQIhAMtdpCtbFilcdidYBegCa3AMrkxQfNsi8k1fuhYXEYZlAiEA+fksjyNHytun
+RjnwW6EIRNCWfiynfPWoiZhbYOCqZ58CIQCkC/ucRbPQ1ZcyEZ1iFGGaV4Baayrs
+knom1CuGGkG2yQIhAKnTKv6jzWZ4DBCd1DmsEV4PB+74j2FJ1BKGu635dEupAiEA
+trFNqR7VOm9kt+mjcsenUzJXaarFnRog/E9qAjguU/U=
+-----END RSA PRIVATE KEY-----
diff --git a/tests/key-id/key-id b/tests/key-id/key-id
new file mode 100755 (executable)
index 0000000..b819953
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# Copyright (C) 2007 Free Software Foundation
+#
+# Author: Simon Josefsson
+#
+# This file is part of GNUTLS.
+#
+# GNUTLS is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at
+# your option) any later version.
+#
+# GNUTLS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNUTLS; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+set -e
+
+srcdir=${srcdir:-.}
+CERTTOOL=${CERTTOOL:-../../src/certtool}
+
+PARAMS="--generate-certificate --load-privkey $srcdir/key-user.pem --load-ca-privkey $srcdir/key-ca.pem --template /dev/null"
+
+#$CERTTOOL $PARAMS --load-ca-certificate $srcdir/ca-gnutls-keyid.pem \
+#    --outfile user-gnutls-keyid.pem 2> /dev/null
+
+#$CERTTOOL $PARAMS --load-ca-certificate $srcdir/ca-no-keyid.pem \
+#    --outfile user-no-keyid.pem 2> /dev/null
+
+$CERTTOOL $PARAMS --load-ca-certificate $srcdir/ca-weird-keyid.pem \
+    --outfile user-weird-keyid.pem 2> /dev/null
+
+if ! $CERTTOOL -i < user-weird-keyid.pem | grep '7A:2C:7A:60:97:46:06:03:CB:FB:28:E8:E2:19:DF:18:DE:EB:4E:0D'; then
+    echo "Could not find CA SKI in user certificate."
+    exit 1;
+fi
+
+rm -f user-gnutls-keyid.pem user-no-keyid.pem user-weird-keyid.pem
+
+# We're done.
+exit 0
diff --git a/tests/key-id/key-user.pem b/tests/key-id/key-user.pem
new file mode 100644 (file)
index 0000000..e375860
--- /dev/null
@@ -0,0 +1,9 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBOwIBAAJBAPNKtqHQHldXWXn+jhOb9GY0inTHrlwpJ0Odjv58nVj7b5L6bvWH
+OeSseVevdOg6ZeBeCr6WY/41i5u3u5hHykECAwEAAQJAUM4k4JOmMC4z6r/wYnTu
+9K9IuUbFE5kbkGqZXs721+FtQrgFk/qZqs9fTSKX17l+gG0G9I6VkdYtCMHM5iAj
+nQIhAPmJceliytoZXGNVPbY9gj9kfi5JYRRmUOQVSFkpkRr/AiEA+ZfcU5zfJMXn
+ADXpTnzJ+itvbxwT34S/2B8/KDF5Wr8CIDRrOgGj3ib4ot6+/kq1GxJEAvmoMnt9
+jsqK6frI75FzAiEAjhPODaKMu2gUOOB3cIBEkS3MfxkijugINMSEtSKEjA0CIQCY
+BFmcfpV0GQyLySiglPgCxqjhoKvgBB3NVz4BdxUFmw==
+-----END RSA PRIVATE KEY-----