From ed56b224dea9ba2513b8199cc405705340af9b49 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Wed, 13 Jul 2011 11:26:43 +0000 Subject: [PATCH] - Added support for PKCS#8 wrapper on reading private keys (Fixes ticket #20) --- include/polarssl/x509.h | 2 +- library/x509parse.c | 130 ++++++++++++++++- programs/Makefile | 5 + programs/pkey/CMakeLists.txt | 5 +- programs/pkey/key_app.c | 224 +++++++++++++++++++++++++++++ tests/data_files/format_gen.key | 16 +++ tests/data_files/format_gen.pub | 6 + tests/data_files/format_pkcs12.fmt | Bin 0 -> 3381 bytes tests/data_files/format_rsa.key | 15 ++ tests/data_files/server2.key | 27 ++++ 10 files changed, 427 insertions(+), 3 deletions(-) create mode 100644 programs/pkey/key_app.c create mode 100644 tests/data_files/format_gen.key create mode 100644 tests/data_files/format_gen.pub create mode 100644 tests/data_files/format_pkcs12.fmt create mode 100644 tests/data_files/format_rsa.key create mode 100644 tests/data_files/server2.key diff --git a/include/polarssl/x509.h b/include/polarssl/x509.h index 9ce98f438..b0b05a728 100644 --- a/include/polarssl/x509.h +++ b/include/polarssl/x509.h @@ -66,7 +66,7 @@ #define POLARSSL_ERR_X509_CERT_INVALID_EXTENSIONS -0x2580 /**< The extension tag or value is invalid. */ #define POLARSSL_ERR_X509_CERT_UNKNOWN_VERSION -0x2600 /**< Certificate or CRL has an unsupported version number. */ #define POLARSSL_ERR_X509_CERT_UNKNOWN_SIG_ALG -0x2680 /**< Signature algorithm (oid) is unsupported. */ -#define POLARSSL_ERR_X509_CERT_UNKNOWN_PK_ALG -0x2700 /**< Public key algorithm is unsupported (only RSA is supported). */ +#define POLARSSL_ERR_X509_UNKNOWN_PK_ALG -0x2700 /**< Key algorithm is unsupported (only RSA is supported). */ #define POLARSSL_ERR_X509_CERT_SIG_MISMATCH -0x2780 /**< Certificate signature algorithms do not match. (see \c ::x509_cert sig_oid) */ #define POLARSSL_ERR_X509_CERT_VERIFY_FAILED -0x2800 /**< Certificate verification failed, e.g. CRL, CA or signature check failed. */ #define POLARSSL_ERR_X509_KEY_INVALID_VERSION -0x2880 /**< Unsupported RSA key version */ diff --git a/library/x509parse.c b/library/x509parse.c index c5da0fc34..874cf0bb1 100644 --- a/library/x509parse.c +++ b/library/x509parse.c @@ -622,7 +622,7 @@ static int x509_get_pubkey( unsigned char **p, can_handle = 1; if( can_handle == 0 ) - return( POLARSSL_ERR_X509_CERT_UNKNOWN_PK_ALG ); + return( POLARSSL_ERR_X509_UNKNOWN_PK_ALG ); if( ( ret = asn1_get_tag( p, end, &len, ASN1_BIT_STRING ) ) != 0 ) return( POLARSSL_ERR_X509_CERT_INVALID_PUBKEY + ret ); @@ -1870,6 +1870,9 @@ int x509parse_key( rsa_context *rsa, const unsigned char *key, size_t keylen, int ret; size_t len; unsigned char *p, *end; + unsigned char *p_alt; + x509_buf pk_alg_oid; + #if defined(POLARSSL_PEM_C) pem_context pem; @@ -1879,6 +1882,14 @@ int x509parse_key( rsa_context *rsa, const unsigned char *key, size_t keylen, "-----END RSA PRIVATE KEY-----", key, pwd, pwdlen, &len ); + if( ret == POLARSSL_ERR_PEM_NO_HEADER_PRESENT ) + { + ret = pem_read_buffer( &pem, + "-----BEGIN PRIVATE KEY-----", + "-----END PRIVATE KEY-----", + key, pwd, pwdlen, &len ); + } + if( ret == 0 ) { /* @@ -1901,6 +1912,19 @@ int x509parse_key( rsa_context *rsa, const unsigned char *key, size_t keylen, end = p + keylen; /* + * Note: Depending on the type of private key file one can expect either a + * PrivatKeyInfo object (PKCS#8) or a RSAPrivateKey (PKCS#1) directly. + * + * PrivateKeyInfo ::= SEQUENCE { + * algorithm AlgorithmIdentifier, + * PrivateKey BIT STRING + * } + * + * AlgorithmIdentifier ::= SEQUENCE { + * algorithm OBJECT IDENTIFIER, + * parameters ANY DEFINED BY algorithm OPTIONAL + * } + * * RSAPrivateKey ::= SEQUENCE { * version Version, * modulus INTEGER, -- n @@ -1944,6 +1968,110 @@ int x509parse_key( rsa_context *rsa, const unsigned char *key, size_t keylen, return( POLARSSL_ERR_X509_KEY_INVALID_VERSION + ret ); } + p_alt = p; + + if( ( ret = x509_get_alg( &p_alt, end, &pk_alg_oid ) ) != 0 ) + { + // Assume that we have the PKCS#1 format if wrong + // tag was encountered + // + if( ret != POLARSSL_ERR_X509_CERT_INVALID_ALG + + POLARSSL_ERR_ASN1_UNEXPECTED_TAG ) + { +#if defined(POLARSSL_PEM_C) + pem_free( &pem ); +#endif + rsa_free( rsa ); + return( POLARSSL_ERR_X509_KEY_INVALID_FORMAT ); + } + } + else + { + int can_handle; + + /* + * only RSA keys handled at this time + */ + can_handle = 0; + + if( pk_alg_oid.len == 9 && + memcmp( pk_alg_oid.p, OID_PKCS1_RSA, 9 ) == 0 ) + can_handle = 1; + + if( pk_alg_oid.len == 9 && + memcmp( pk_alg_oid.p, OID_PKCS1, 8 ) == 0 ) + { + if( pk_alg_oid.p[8] >= 2 && pk_alg_oid.p[8] <= 5 ) + can_handle = 1; + + if ( pk_alg_oid.p[8] >= 11 && pk_alg_oid.p[8] <= 14 ) + can_handle = 1; + } + + if( pk_alg_oid.len == 5 && + memcmp( pk_alg_oid.p, OID_RSA_SHA_OBS, 5 ) == 0 ) + can_handle = 1; + + if( can_handle == 0 ) + return( POLARSSL_ERR_X509_UNKNOWN_PK_ALG ); + + /* + * Parse the PKCS#8 format + */ + + p = p_alt; + if( ( ret = asn1_get_tag( &p, end, &len, ASN1_OCTET_STRING ) ) != 0 ) + { +#if defined(POLARSSL_PEM_C) + pem_free( &pem ); +#endif + rsa_free( rsa ); + return( POLARSSL_ERR_X509_KEY_INVALID_FORMAT + ret ); + } + + if( ( end - p ) < 1 ) + { +#if defined(POLARSSL_PEM_C) + pem_free( &pem ); +#endif + rsa_free( rsa ); + return( POLARSSL_ERR_X509_KEY_INVALID_FORMAT + + POLARSSL_ERR_ASN1_OUT_OF_DATA ); + } + + end = p + len; + + if( ( ret = asn1_get_tag( &p, end, &len, + ASN1_CONSTRUCTED | ASN1_SEQUENCE ) ) != 0 ) + { +#if defined(POLARSSL_PEM_C) + pem_free( &pem ); +#endif + rsa_free( rsa ); + return( POLARSSL_ERR_X509_KEY_INVALID_FORMAT + ret ); + } + + end = p + len; + + if( ( ret = asn1_get_int( &p, end, &rsa->ver ) ) != 0 ) + { +#if defined(POLARSSL_PEM_C) + pem_free( &pem ); +#endif + rsa_free( rsa ); + return( POLARSSL_ERR_X509_KEY_INVALID_FORMAT + ret ); + } + + if( rsa->ver != 0 ) + { +#if defined(POLARSSL_PEM_C) + pem_free( &pem ); +#endif + rsa_free( rsa ); + return( POLARSSL_ERR_X509_KEY_INVALID_VERSION + ret ); + } + } + if( ( ret = asn1_get_mpi( &p, end, &rsa->N ) ) != 0 || ( ret = asn1_get_mpi( &p, end, &rsa->E ) ) != 0 || ( ret = asn1_get_mpi( &p, end, &rsa->D ) ) != 0 || diff --git a/programs/Makefile b/programs/Makefile index 6462653ac..c6db5b15e 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -12,6 +12,7 @@ APPS = aes/aescrypt2 aes/crypt_and_hash \ hash/md5sum hash/sha1sum \ hash/sha2sum pkey/dh_client \ pkey/dh_genprime pkey/dh_server \ + pkey/key_app \ pkey/mpi_demo pkey/rsa_genkey \ pkey/rsa_sign pkey/rsa_verify \ pkey/rsa_sign_pss pkey/rsa_verify_pss \ @@ -66,6 +67,10 @@ pkey/dh_server: pkey/dh_server.c ../library/libpolarssl.a echo " CC pkey/dh_server.c" $(CC) $(CFLAGS) $(OFLAGS) pkey/dh_server.c $(LDFLAGS) -o $@ +pkey/key_app: pkey/key_app.c ../library/libpolarssl.a + echo " CC pkey/key_app.c" + $(CC) $(CFLAGS) $(OFLAGS) pkey/key_app.c $(LDFLAGS) -o $@ + pkey/mpi_demo: pkey/mpi_demo.c ../library/libpolarssl.a echo " CC pkey/mpi_demo.c" $(CC) $(CFLAGS) $(OFLAGS) pkey/mpi_demo.c $(LDFLAGS) -o $@ diff --git a/programs/pkey/CMakeLists.txt b/programs/pkey/CMakeLists.txt index 18094c513..5fc89f76b 100644 --- a/programs/pkey/CMakeLists.txt +++ b/programs/pkey/CMakeLists.txt @@ -7,6 +7,9 @@ target_link_libraries(dh_genprime polarssl) add_executable(dh_server dh_server.c) target_link_libraries(dh_server polarssl) +add_executable(key_app key_app.c) +target_link_libraries(key_app polarssl) + add_executable(mpi_demo mpi_demo.c) target_link_libraries(mpi_demo polarssl) @@ -25,6 +28,6 @@ target_link_libraries(rsa_sign_pss polarssl) add_executable(rsa_verify_pss rsa_verify_pss.c) target_link_libraries(rsa_verify_pss polarssl) -INSTALL(TARGETS dh_client dh_genprime dh_server mpi_demo rsa_genkey rsa_sign rsa_verify +INSTALL(TARGETS dh_client dh_genprime dh_server key_app mpi_demo rsa_genkey rsa_sign rsa_verify DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) diff --git a/programs/pkey/key_app.c b/programs/pkey/key_app.c new file mode 100644 index 000000000..00a5effb0 --- /dev/null +++ b/programs/pkey/key_app.c @@ -0,0 +1,224 @@ +/* + * Key reading application + * + * Copyright (C) 2006-2010, Brainspark B.V. + * + * This file is part of PolarSSL (http://www.polarssl.org) + * Lead Maintainer: Paul Bakker + * + * All rights reserved. + * + * This program 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 program 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 program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_DEPRECATE 1 +#endif + +#include +#include +#include + +#include "polarssl/config.h" + +#include "polarssl/error.h" +#include "polarssl/rsa.h" +#include "polarssl/x509.h" + +#define MODE_NONE 0 +#define MODE_PRIVATE 1 +#define MODE_PUBLIC 2 + +#define DFL_MODE MODE_NONE +#define DFL_FILENAME "keyfile.key" +#define DFL_DEBUG_LEVEL 0 + +/* + * global options + */ +struct options +{ + int mode; /* the mode to run the application in */ + char *filename; /* filename of the key file */ + int debug_level; /* level of debugging */ +} opt; + +void my_debug( void *ctx, int level, const char *str ) +{ + if( level < opt.debug_level ) + { + fprintf( (FILE *) ctx, "%s", str ); + fflush( (FILE *) ctx ); + } +} + +#define USAGE \ + "\n usage: key_app param=<>...\n" \ + "\n acceptable parameters:\n" \ + " mode=private|public default: none\n" \ + " filename=%%s default: keyfile.key\n" \ + " debug_level=%%d default: 0 (disabled)\n" \ + "\n" + +#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ + !defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO) +int main( void ) +{ + printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or " + "POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n"); + return( 0 ); +} +#else +int main( int argc, char *argv[] ) +{ + int ret = 0; + rsa_context rsa; + char buf[1024]; + int i, j, n; + char *p, *q; + + /* + * Set to sane values + */ + memset( &rsa, 0, sizeof( rsa_context ) ); + memset( buf, 0, 1024 ); + + if( argc == 0 ) + { + usage: + printf( USAGE ); + goto exit; + } + + opt.mode = DFL_MODE; + opt.filename = DFL_FILENAME; + opt.debug_level = DFL_DEBUG_LEVEL; + + for( i = 1; i < argc; i++ ) + { + n = strlen( argv[i] ); + + for( j = 0; j < n; j++ ) + { + if( argv[i][j] >= 'A' && argv[i][j] <= 'Z' ) + argv[i][j] |= 0x20; + } + + p = argv[i]; + if( ( q = strchr( p, '=' ) ) == NULL ) + goto usage; + *q++ = '\0'; + + if( strcmp( p, "mode" ) == 0 ) + { + if( strcmp( q, "private" ) == 0 ) + opt.mode = MODE_PRIVATE; + else if( strcmp( q, "public" ) == 0 ) + opt.mode = MODE_PUBLIC; + else + goto usage; + } + else if( strcmp( p, "filename" ) == 0 ) + opt.filename = q; + else if( strcmp( p, "debug_level" ) == 0 ) + { + opt.debug_level = atoi( q ); + if( opt.debug_level < 0 || opt.debug_level > 65535 ) + goto usage; + } + else + goto usage; + } + + if( opt.mode == MODE_PRIVATE ) + { + /* + * 1.1. Load the key + */ + printf( "\n . Loading the private key ..." ); + fflush( stdout ); + + ret = x509parse_keyfile( &rsa, opt.filename, NULL ); + + if( ret != 0 ) + { +#ifdef POLARSSL_ERROR_C + error_strerror( ret, buf, 1024 ); +#endif + printf( " failed\n ! x509parse_key returned %d - %s\n\n", ret, buf ); + rsa_free( &rsa ); + goto exit; + } + + printf( " ok\n" ); + + /* + * 1.2 Print the key + */ + printf( " . Key information ...\n" ); + mpi_write_file( "N: ", &rsa.N, 16, NULL ); + mpi_write_file( "E: ", &rsa.E, 16, NULL ); + mpi_write_file( "D: ", &rsa.D, 16, NULL ); + mpi_write_file( "P: ", &rsa.P, 16, NULL ); + mpi_write_file( "Q: ", &rsa.Q, 16, NULL ); + mpi_write_file( "DP: ", &rsa.DP, 16, NULL ); + mpi_write_file( "DQ: ", &rsa.DQ, 16, NULL ); + mpi_write_file( "QP: ", &rsa.QP, 16, NULL ); + } + else if( opt.mode == MODE_PUBLIC ) + { + /* + * 1.1. Load the key + */ + printf( "\n . Loading the public key ..." ); + fflush( stdout ); + + ret = x509parse_public_keyfile( &rsa, opt.filename ); + + if( ret != 0 ) + { +#ifdef POLARSSL_ERROR_C + error_strerror( ret, buf, 1024 ); +#endif + printf( " failed\n ! x509parse_public_key returned %d - %s\n\n", ret, buf ); + rsa_free( &rsa ); + goto exit; + } + + printf( " ok\n" ); + + /* + * 1.2 Print the key + */ + printf( " . Key information ...\n" ); + mpi_write_file( "N: ", &rsa.N, 16, NULL ); + mpi_write_file( "E: ", &rsa.E, 16, NULL ); + } + else + goto usage; + +exit: + + rsa_free( &rsa ); + +#ifdef WIN32 + printf( " + Press Enter to exit this program.\n" ); + fflush( stdout ); getchar(); +#endif + + return( ret ); +} +#endif /* POLARSSL_BIGNUM_C && POLARSSL_RSA_C && + POLARSSL_X509_PARSE_C && POLARSSL_FS_IO */ diff --git a/tests/data_files/format_gen.key b/tests/data_files/format_gen.key new file mode 100644 index 000000000..204723213 --- /dev/null +++ b/tests/data_files/format_gen.key @@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAMDRSzONESX4mSVT +J69o3x9vQanXcPNviljcwKgkrXkFah6hQUAhW+4jQLxtGb+LU47gE321JGtGNb5L +z1htjLULvc9SAplJ6OOcQUDhyFxI4o6FmUzorv49ytzH6x2IO7UOF44MyJIWGjG3 +4fohS8EQaQjkBYW7kwM/vCVT8Bl9AgMBAAECgYBTqj0cSEi5li41kOh2Z2XxiOAQ +J0h+iNaaCmeaThfrnFrYoZXjktYF9cwANsLmZzlBlJ9Ae5oq5hMp2FFHCHn1z1U/ +BiE3yF2AXNslL0p8lMO4qGxmt2iYdE3Z8comfkyttUJ5k9thLQzU/NWATP8EZGng +iTdEDFOW35cG26ccDQJBAPPoaiveAVN0JYxe2tYR8xb5qta89QGU6HDdTRiClap1 +5rfph5d30MQggqf1tBTiDRKOSk7uN39xwGbMzz11+NcCQQDKYHXWAsN3QlmFQKTX +nm4G5xpl57P9U25wSC+NYOmFEieomD7YlbaBKBc0V5JNj2IqUt0EvXNh3LA5czd9 +3pHLAkAioVgZvF6h07bVFE6r4EaMd4xbCt8ah2LtS2570WagmjbU2/JlfhyFDDyg +zlDwOhwzC0LfrBDzJlpz/hZamppnAkBswjIRdSK+sLWTWw47ojTXGNOi+EZOWcv8 +I48Kl45nqT4O6OK9WpfeCUGPK5DAhdHnlOiaZ4Xejc9W0Ih96GLJAkBOzJE8nUU5 +giUjLAxJoYepKlWh5tZsNDoGFg46+bHn9l1O6fX7tau0+jEz4tC6aA8R3HtUOrYv +hJ61gH8x3U5J +-----END PRIVATE KEY----- diff --git a/tests/data_files/format_gen.pub b/tests/data_files/format_gen.pub new file mode 100644 index 000000000..81a7ab3ff --- /dev/null +++ b/tests/data_files/format_gen.pub @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDA0UszjREl+JklUyevaN8fb0Gp +13Dzb4pY3MCoJK15BWoeoUFAIVvuI0C8bRm/i1OO4BN9tSRrRjW+S89YbYy1C73P +UgKZSejjnEFA4chcSOKOhZlM6K7+Pcrcx+sdiDu1DheODMiSFhoxt+H6IUvBEGkI +5AWFu5MDP7wlU/AZfQIDAQAB +-----END PUBLIC KEY----- diff --git a/tests/data_files/format_pkcs12.fmt b/tests/data_files/format_pkcs12.fmt new file mode 100644 index 0000000000000000000000000000000000000000..296d599d633ad09a8e59f9038c8dc61417ce2e31 GIT binary patch literal 3381 zcmV-54a)K`f(E^;4p#*mj($chDe6@ z4FLxRpn?a8FoFk!0s#Opf(LyD2`Yw2hW8Bt2LUh~1_~;MNQUSG)6eKb-*e(h`Xt>$Zy zUeW4x+>(b#T9UqeX!q#h95Vz-+_~Y?{$VrV?OD1a6zV~ z&c6NHRA@=(k=lmDOSvEGD0z4VkW`xH`hv{zIGo{^*df_^l1=Xo}FwR>2-mi3*L~#d*xBm|vh}L-du%`_c zNsRPYaX7h8G&ouPl@<#o!e%H5EJFn>;zClz%F;UL$ojg8A%O)U_5)rcmn;9JL`DiY zKJ6D~J?gox)!aPNb>f-aKfQ0KZ*WXy=IXugXYe0jWzoBr zNm%uI5?7D!H;Vt!K}T4ue=GXo^sZ{o4V^f+k+U zyv{<6Rj~BfWONJ6jF||#c$4A2Sk5%zf{KZt%@8GyzymflteKd)22l5TZ2dZGP)@@P z5Lc{FrJ*W9tqLgbkVl9j)6uHI$$WWzj=v4VFq`oY+yK}}b&ly`$;o~14t`Iev&CMN zZ(-Aw6$HV-B#4kP9!9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HZ$E54L2jH>FUDQ8EO&Dh0;XkIgQbpO~jL zse2-)Ydg?lknr+j&hLCLy}VBY@}IkNm?4J8$y}A(4R6Pr-W4(RD`6hnQSq-sn@!Fi z;O;X5M`MTNNCyReILNa8?iO-22bg?CVfKsTta^Bf3T*#4c9W;B?cR2>x&~yGa%lNDkf%OiQL^xVwkEMqSHUEDI+R&hJU`0Ypzb- z(0oZ&qQJ2ZsV@TB$&e^b@bkxp<#87U7y|(ON3=J(xa?351^+MOW`3+#0Pa3{-dQ`I zHkb0@*J#(Bllr*nC(s+;W*1M@U~67yL>o@wp}EOzySR8@aCg?K(3uz0V+tIwD6LXj zKSczM3PV^7iHZdQICIzQE$ z{8;cwl5|tvs-&`O;&t#5|4n@!h6+8E@gyvA7OUk!Xj2^>8|0q5^d^icEtyS%&$<(g z>8BhHgTo{vK?iVB}!|vM{k`_&c^v=%V3hOyea^}#ZydeAmy{SLl7*j->^Hyt z4Y<^d9pxC^+E*iBLq7_MAf@-^S9fBP6V;$nWahZ28jN%=mhtGV3(L>OTwidaA`fl=AnL?RRng%5t* z1j$A9?RazXuEA59G=V7M zSrU`1v%)5P1TZl$AutIB1uG5%0vZJX1Qb$?xAdc;PI%Fxc{oiXnYZd80XYN+Nj0L( Lu!EV#0s;sC_v&0} literal 0 HcmV?d00001 diff --git a/tests/data_files/format_rsa.key b/tests/data_files/format_rsa.key new file mode 100644 index 000000000..0c8cb57c6 --- /dev/null +++ b/tests/data_files/format_rsa.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICWwIBAAKBgQDA0UszjREl+JklUyevaN8fb0Gp13Dzb4pY3MCoJK15BWoeoUFA +IVvuI0C8bRm/i1OO4BN9tSRrRjW+S89YbYy1C73PUgKZSejjnEFA4chcSOKOhZlM +6K7+Pcrcx+sdiDu1DheODMiSFhoxt+H6IUvBEGkI5AWFu5MDP7wlU/AZfQIDAQAB +AoGAU6o9HEhIuZYuNZDodmdl8YjgECdIfojWmgpnmk4X65xa2KGV45LWBfXMADbC +5mc5QZSfQHuaKuYTKdhRRwh59c9VPwYhN8hdgFzbJS9KfJTDuKhsZrdomHRN2fHK +Jn5MrbVCeZPbYS0M1PzVgEz/BGRp4Ik3RAxTlt+XBtunHA0CQQDz6Gor3gFTdCWM +XtrWEfMW+arWvPUBlOhw3U0YgpWqdea36YeXd9DEIIKn9bQU4g0SjkpO7jd/ccBm +zM89dfjXAkEAymB11gLDd0JZhUCk155uBucaZeez/VNucEgvjWDphRInqJg+2JW2 +gSgXNFeSTY9iKlLdBL1zYdywOXM3fd6RywJAIqFYGbxeodO21RROq+BGjHeMWwrf +Godi7Utue9FmoJo21NvyZX4chQw8oM5Q8DocMwtC36wQ8yZac/4WWpqaZwJAbMIy +EXUivrC1k1sOO6I01xjTovhGTlnL/COPCpeOZ6k+DujivVqX3glBjyuQwIXR55To +mmeF3o3PVtCIfehiyQJATsyRPJ1FOYIlIywMSaGHqSpVoebWbDQ6BhYOOvmx5/Zd +Tun1+7WrtPoxM+LQumgPEdx7VDq2L4SetYB/Md1OSQ== +-----END RSA PRIVATE KEY----- diff --git a/tests/data_files/server2.key b/tests/data_files/server2.key new file mode 100644 index 000000000..70a764a24 --- /dev/null +++ b/tests/data_files/server2.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAwU2j3efNHdEE10lyuJmsDnjkOjxKzzoTFtBa5M2jAIin7h5r +lqdStJDvLXJ6PiSa/LY0rCT1d+AmZIycsCh9odrqjObJHJa8/sEEUrM21KP64bF2 +2JDBYbRmUjaiJlOqq3ReB30Zgtsq2B+g2Q0cLUlm91slc0boC4pPaQy1AJDh2oIQ +Zn2uVCuLZXmRoeJhw81ASQjuaAzxi4bSRr/QuKoRAx5/VqgaHkQYDw+Fi9qLRF7i +GMZiL8dmjfpd2H3zJ4kpAcWQDj8n8TDISg7v1t7HxydrxwU9esQCPJodPg/oNJhb +y3NLUpbYEaIsgIhpOVrTD7DeWS8Rx/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