From: niklas Date: Fri, 7 Apr 2000 21:33:18 +0000 (+0000) Subject: Obsolete X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=226a146276b423006333a6ce17ed856230b1814f;p=openbsd Obsolete --- diff --git a/sbin/isakmpd/regress/asn/.cvsignore b/sbin/isakmpd/regress/asn/.cvsignore deleted file mode 100644 index b672fdeaf35..00000000000 --- a/sbin/isakmpd/regress/asn/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -obj diff --git a/sbin/isakmpd/regress/asn/Makefile b/sbin/isakmpd/regress/asn/Makefile deleted file mode 100644 index f0d60e3f6ec..00000000000 --- a/sbin/isakmpd/regress/asn/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# Test ASN - -PROG= asntest -SRCS= asntest.c conf.c asn.c asn_useful.c gmp_util.c log.c pkcs.c \ - sysdep.c hash.c x509.c -TOPSRC= ${.CURDIR}/../.. -TOPOBJ!= cd ${TOPSRC}; printf "all:\n\t@pwd\n" |${MAKE} -f- -OS!= awk '/^OS=/ { print $$2 }' ${.CURDIR}/../../Makefile -.PATH: ${TOPSRC} ${TOPSRC}/sysdep/${OS} ${TOPOBJ} -CFLAGS+= -I${TOPSRC} -I${TOPSRC}/sysdep/${OS} -I${TOPOBJ} -Wall -LDADD+= -lgmp -DPADD+= ${LIBDES} -NOMAN= -DEBUG= -g - -.include diff --git a/sbin/isakmpd/regress/asn/asntest.c b/sbin/isakmpd/regress/asn/asntest.c deleted file mode 100644 index 1588ee5a2c9..00000000000 --- a/sbin/isakmpd/regress/asn/asntest.c +++ /dev/null @@ -1,149 +0,0 @@ -/* $OpenBSD: asntest.c,v 1.7 1999/04/19 21:00:46 niklas Exp $ */ -/* $EOM: asntest.c,v 1.8 1999/04/05 18:27:33 niklas Exp $ */ - -/* - * Copyright (c) 1998 Niels Provos. All rights reserved. - * Copyright (c) 1999 Niklas Hallqvist. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Ericsson Radio Systems. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This code was written under funding by Ericsson Radio Systems. - */ - -#include -#include -#include -#include - -#include "conf.h" -#include "asn.h" -#include "asn_useful.h" -#include "pkcs.h" -#include "x509.h" - -int -main (void) -{ - char buf[1000]; - char buf2[1000]; - u_int32_t len; - struct norm_type test = SEQ("test", Signed); - struct norm_type test2 = SEQ("cert", Certificate); - struct norm_type *tmp, *tmp2; - struct rsa_public_key key; - struct x509_certificate cert; - int i, j; - u_int8_t *asn; - char *p; - - FILE *f = fopen ("ssh-test-ca.pem", "r"); - len = 0; - while (conf_get_line (f, buf + len, sizeof (buf) - len)) - if (buf[len] != '-') - len = strlen (buf); - - conf_decode_base64 (buf, &len, buf); - - asn_template_clone (&test, 1); - - asn_decode_sequence (buf, len, &test); - - p = ASN_SIGNED_ALGORITHM(&test); - - printf ("ObjectId: %s = %s\n", p, asn_parse_objectid (asn_ids, p)); - - asn_template_clone (&test2, 1); - - len = asn_get_len (ASN_SIGNED_DATA(&test)); - asn_decode_sequence (ASN_SIGNED_DATA(&test), len, &test2); - - tmp = asn_decompose ("cert.version", &test2); - printf ("Version: "); mpz_out_str (stdout, 16, tmp->data); - tmp = asn_decompose ("cert.serialNumber", &test2); - printf ("\nSerialNumber: "); mpz_out_str (stdout, 16, tmp->data); - tmp = asn_decompose ("cert.signature.algorithm", &test2); - printf ("\nsignature: %s\n", - asn_parse_objectid (asn_ids, (char *)tmp->data)); - - tmp = ASN_CERT_VALIDITY(&test2); - printf ("Begin: %s, End: %s\n", ASN_VAL_BEGIN(tmp), ASN_VAL_END(tmp)); - - i = 0; - while (1) - { - sprintf (buf2, "cert.issuer.RelativeDistinguishedName[%d]", i++); - tmp = asn_decompose (buf2, &test2); - if (tmp == NULL) - break; - - j = 0; - while (1) - { - sprintf (buf2, "RelativeDistinguishedName.AttributeValueAssertion[%d].AttributeType", j); - tmp2 = asn_decompose (buf2, tmp); - if (tmp2 == NULL) - break; - - printf ("Issuer: (%s) ", - asn_parse_objectid (asn_ids, tmp2->data)); - sprintf (buf2, "RelativeDistinguishedName.AttributeValueAssertion[%d].AttributeValue", j++); - tmp2 = asn_decompose (buf2, tmp); - printf ("%s\n", (char *)tmp2->data); - } - }; - - tmp = asn_decompose ("cert.subjectPublicKeyInfo.algorithm.algorithm", &test2); - printf ("Key: %s\n", asn_parse_objectid (asn_ids, tmp->data)); - - tmp = asn_decompose ("cert.subjectPublicKeyInfo.subjectPublicKey", &test2); - asn = tmp->data + 1; - - pkcs_public_key_from_asn (&key, asn, asn_get_len (asn)); - printf ("n (%u): 0x", (unsigned int)mpz_sizeinbase (key.n, 2)); - mpz_out_str (stdout, 16, key.n); - printf ("\ne: 0x"); mpz_out_str (stdout, 16, key.e); - printf ("\n"); - - printf ("Validate SIGNED: "); - if (!x509_validate_signed (buf, asn_get_len (buf), &key, &asn, &len)) - printf ("FAILED "); - else - printf ("OKAY "); - printf ("\n"); - - memset (&cert, 0, sizeof (cert)); - x509_decode_certificate (buf, asn_get_len (buf), &cert); - - printf ("Encoding Certificate: "); - if (!x509_encode_certificate(&cert, &asn, &len)) - printf ("FAILED "); - else - printf ("OKAY "); - printf ("\n"); - return 1; -} diff --git a/sbin/isakmpd/regress/asn/ssh-test-ca.pem b/sbin/isakmpd/regress/asn/ssh-test-ca.pem deleted file mode 100644 index 4721db3bedb..00000000000 --- a/sbin/isakmpd/regress/asn/ssh-test-ca.pem +++ /dev/null @@ -1,12 +0,0 @@ ------BEGIN X509 CERTIFICATE----- -MIIB/DCCAWWgAwIBAgIDAeD0MA0GCSqGSIb3DQEBBAUAMDgxCzAJBgNVBAYTAkZJMSkwJwYDVQQ -KEyBTc2ggQ29tbXVuaWNhdGlvbnMgU2VjdXJpdHkgTHRkLjAeFw05NzEyMzEwMDAwMDBaFw05OD -EyMzEwMDAwMDBaMDgxCzAJBgNVBAYTAkZJMSkwJwYDVQQKEyBTc2ggQ29tbXVuaWNhdGlvbnMgU -2VjdXJpdHkgTHRkLjCBnTANBgkqhkiG9w0BAQEFAAOBiwAwgYcCgYEAmxrZfHh3PXzt4STZ27xN -v6ccHA5Zs2rJ/NmjTz+cDtJriGtfroPjPuI82H7QifrGAmG9+iHLP9bZKvs8Bur5avXTQmxg2kT -/53K74Tiox2hJEPWKNAPWKf8Y/sCXKJF0TEYtFlFCzkm+lmBmtuSDixgD5Xa1DNl3Ket7m4vOhq -8CASmjFjAUMBIGA1UdEwEB/wQIMAYBAf8CAQowDQYJKoZIhvcNAQEEBQADgYEAP66aK4rdFAT/H -PKGTEM1UQgmo8b/fi7rB90jonodOI4Xros/3R1Nj8Z5zQcx2hG5xjIAl9YpHmmPSbgtYD1SIFxF -0sWBa12FU7u/Sa8OjBvs9K0Ofnw/Sdp7on0M6f/xTVHKFCunfAbHsqFhieej6esDJBKODpbb2pJ -c6VphrlE= ------END X509 CERTIFICATE----- diff --git a/sbin/isakmpd/regress/pkcs/.cvsignore b/sbin/isakmpd/regress/pkcs/.cvsignore deleted file mode 100644 index b672fdeaf35..00000000000 --- a/sbin/isakmpd/regress/pkcs/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -obj diff --git a/sbin/isakmpd/regress/pkcs/Makefile b/sbin/isakmpd/regress/pkcs/Makefile deleted file mode 100644 index f55c818c7ad..00000000000 --- a/sbin/isakmpd/regress/pkcs/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# $OpenBSD: Makefile,v 1.5 1999/03/02 15:27:36 niklas Exp $ -# $EOM: Makefile,v 1.5 1999/02/25 15:12:00 niklas Exp $ - -# Test PKCS#1 - -PROG= pkcstest -SRCS= log.c asn.c gmp_util.c pkcs.c pkcstest.c sysdep.c \ - asn_useful.c hash.c -TOPSRC= ${.CURDIR}/../.. -TOPOBJ!= cd ${TOPSRC}; printf "all:\n\t@pwd\n" |${MAKE} -f- -OS!= awk '/^OS=/ { print $$2 }' ${.CURDIR}/../../Makefile -.PATH: ${TOPSRC} ${TOPSRC}/sysdep/${OS} ${TOPOBJ} -CFLAGS+= -I${TOPSRC} -I${TOPSRC}/sysdep/${OS} -I${TOPOBJ} -Wall -LDADD+= -lgmp -DPADD+= ${LIBDES} -NOMAN= -DEBUG= -g - -.include diff --git a/sbin/isakmpd/regress/pkcs/pkcstest.c b/sbin/isakmpd/regress/pkcs/pkcstest.c deleted file mode 100644 index fffb4a59f07..00000000000 --- a/sbin/isakmpd/regress/pkcs/pkcstest.c +++ /dev/null @@ -1,126 +0,0 @@ -/* $OpenBSD: pkcstest.c,v 1.7 1999/04/19 21:00:46 niklas Exp $ */ -/* $EOM: pkcstest.c,v 1.7 1999/04/05 18:27:37 niklas Exp $ */ - -/* - * Copyright (c) 1998 Niels Provos. All rights reserved. - * Copyright (c) 1999 Niklas Hallqvist. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Ericsson Radio Systems. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This code was written under funding by Ericsson Radio Systems. - */ - -#include -#include -#include -#include -#include -#include - -#include "gmp_util.h" -#include "asn.h" -#include "pkcs.h" - -#define nibble2bin(y) (tolower((y)) < 'a' ? (y) - '0': tolower((y)) - 'a' + 10) -#define hexchar2bin(x) ((nibble2bin((x)[0]) << 4) + nibble2bin((x)[1])) -#define nibble2c(x) ((x) >= 10 ? ('a'-10+(x)) : ('0' + (x))) - -void asc2bin (u_int8_t *bin, u_int8_t *asc, u_int16_t len) -{ - int i; - - for (i = 0; i < len; i += 2, asc += 2) - { - *bin++ = hexchar2bin(asc); - } -} - -int -main (void) -{ - char buf[500]; - char *publickey = "304702400a66791dc6988168de7ab77419bb7fb0c001c6271027" - "0075142942e19a8d8c51d053b3e3782a1de5dc5af4ebe99468170114a1dfe67cdc9a9" - "af55d655620bbab0203010001"; - char *privatekey = "3082013602010002400a66791dc6988168de7ab77419bb7fb0c001" - "c62710270075142942e19a8d8c51d053b3e3782a1de5dc5af4ebe99468170114a1dfe67" - "cdc9a9af55d655620bbab020301000102400123c5b61ba36edb1d3679904199a89ea80c" - "09b9122e1400c09adcf7784676d01d23356a7d44d6bd8bd50e94bfc723fa87d8862b751" - "77691c11d757692df8881022033d48445c859e52340de704bcdda065fbb4058d740bd1d" - "67d29e9c146c11cf610220335e8408866b0fd38dc7002d3f972c67389a65d5d8306566d" - "5c4f2a5aa52628b0220045ec90071525325d3d46db79695e9afacc4523964360e02b119" - "baa366316241022015eb327360c7b60d12e5e2d16bdcd97981d17fba6b70db13b20b436" - "e24eada5902202ca6366d72781dfa24d34a9a24cbc2ae927a9958af426563ff63fb1165" - "8a461d"; - char *data = "Niels ist ein Luser!"; - u_int8_t *enc, *dec; - u_int16_t len; - u_int32_t enclen; - int erg = 0; - - struct rsa_public_key key; - struct rsa_private_key priv; - - asc2bin (buf, publickey, strlen (publickey)); - pkcs_public_key_from_asn (&key, buf, sizeof (buf)); - - printf ("n: 0x"); mpz_out_str (stdout, 16, key.n); - printf ("\ne: 0x"); mpz_out_str (stdout, 16, key.e); - printf ("\n"); - - asc2bin (buf, privatekey, strlen (privatekey)); - pkcs_private_key_from_asn (&priv, buf, sizeof (buf)); - - printf ("n: 0x"); mpz_out_str (stdout, 16, priv.n); - printf ("\ne: 0x"); mpz_out_str (stdout, 16, priv.e); - printf ("\nd: 0x"); mpz_out_str (stdout, 16, priv.d); - printf ("\np: 0x"); mpz_out_str (stdout, 16, priv.p); - printf ("\nq: 0x"); mpz_out_str (stdout, 16, priv.q); - printf ("\n"); - - printf ("Testing Signing/Verifying: "); - /* Sign with Private Key */ - if (!pkcs_rsa_encrypt (PKCS_PRIVATE, NULL, &priv, data, strlen(data)+1, - &enc, &enclen)) - printf ("FAILED "); - else - /* Decrypt/Verify with Public Key */ - erg = pkcs_rsa_decrypt (PKCS_PRIVATE, &key, NULL, enc, &dec, &len); - - if (!erg || strcmp(data,dec)) - printf ("FAILED "); - else - printf ("OKAY "); - - printf ("\n"); - - pkcs_free_public_key (&key); - pkcs_free_private_key (&priv); - - return 1; -}