- First tests for x509_write_cert_req() compat with OpenSSL output
This commit is contained in:
Родитель
3cac5e012b
Коммит
6d6205091b
|
@ -50,3 +50,4 @@ add_test_suite(rsa)
|
|||
add_test_suite(version)
|
||||
add_test_suite(xtea)
|
||||
add_test_suite(x509parse)
|
||||
add_test_suite(x509write)
|
||||
|
|
|
@ -19,8 +19,8 @@ APPS = test_suite_aes test_suite_arc4 \
|
|||
test_suite_md test_suite_mdx \
|
||||
test_suite_mpi test_suite_pkcs1_v21 \
|
||||
test_suite_rsa test_suite_shax \
|
||||
test_suite_x509parse test_suite_xtea \
|
||||
test_suite_version
|
||||
test_suite_x509parse test_suite_x509write \
|
||||
test_suite_xtea test_suite_version
|
||||
|
||||
.SILENT:
|
||||
|
||||
|
@ -126,6 +126,10 @@ test_suite_x509parse: test_suite_x509parse.c ../library/libpolarssl.a
|
|||
echo " CC $@.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
|
||||
|
||||
test_suite_x509write: test_suite_x509write.c ../library/libpolarssl.a
|
||||
echo " CC $@.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
|
||||
|
||||
test_suite_xtea: test_suite_xtea.c ../library/libpolarssl.a
|
||||
echo " CC $@.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEogIBAAKCAQEAqQIfPUBq1VVTi/027oJlLhVhXom/uOhFkNvuiBZS0/FDUEeW
|
||||
Ellkh2v9K+BG+XO+3c+S4ZFb7Wagb4kpeUWA0INq1UFDd185fAkER4KwVzlw7aPs
|
||||
FRkeqDMIR8EFQqn9TMO0390GH00QUUBncxMPQPhtgSVfCrFTxjB+FTms+Vruf5Ke
|
||||
pgVb5xOXhbUjktnUJAbVCSWJdQfdphqPPwkZvq1lLGTrlZvc/kFeF6babFtpzAK6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Gc8Mc
|
||||
K+PNQvoz425dHK3dHzeoIWD2Ka25mbjglbW1rqAdTkZSYH2QqZTHsKCr0u5iPtSD
|
||||
gF7K0AMuT2LIeSs1p82n+cLF78fz
|
||||
-----END CERTIFICATE REQUEST-----
|
|
@ -0,0 +1,16 @@
|
|||
-----BEGIN CERTIFICATE REQUEST-----
|
||||
MIICgTCCAWkCAQAwPDELMAkGA1UEBhMCTkwxETAPBgNVBAoTCFBvbGFyU1NMMRow
|
||||
GAYDVQQDExFQb2xhclNTTCBTZXJ2ZXIgMTCCASIwDQYJKoZIhvcNAQEBBQADggEP
|
||||
ADCCAQoCggEBAKkCHz1AatVVU4v9Nu6CZS4VYV6Jv7joRZDb7ogWUtPxQ1BHlhJZ
|
||||
ZIdr/SvgRvlzvt3PkuGRW+1moG+JKXlFgNCDatVBQ3dfOXwJBEeCsFc5cO2j7BUZ
|
||||
HqgzCEfBBUKp/UzDtN/dBh9NEFFAZ3MTD0D4bYElXwqxU8YwfhU5rPla7n+SnqYF
|
||||
W+cTl4W1I5LZ1CQG1QkliXUH3aYajz8JGb6tZSxk65Wb3P5BXhem2mxbacwCuhQs
|
||||
FiScStzN0PdSZ3PxLaAj/X70McotcMqJCwTbLqZPcG6ezr1YieJTWZ5uWpJl4og/
|
||||
DJQZo93l6J2VE+0p26twEtxaymsXq1KCVLECAwEAAaAAMA0GCSqGSIb3DQEBDQUA
|
||||
A4IBAQBH78JrIboWUlOiUzEwxuYkaRBr22DfdSHlNVjnenrTsSsSdfPenfrUbs42
|
||||
NfzhJtvLBnDMs9olsiyPNKZnROmjl/4Da5ScVBfdA7oSImwdsaL0krAju8lJosy7
|
||||
ypqNejQQDgjL00HkaVyqjnEWY68enAkaK64suQ4w0pkGmtdZyg0nBiH1VI72PcPR
|
||||
Fu2wxSkvvYj+BcHVAY/GWRMTHw1mkmsQna7AsZ1MFIF3ycIW5Fom6d0wpB6clJ3M
|
||||
vNTBc7kZIR1BQyblyU96acesxJURJn5xO9Yf9OSsTbd7Xm5xK6DpQWxFFEgdVtir
|
||||
hSAqtp54nVnLe4QihmVAlM8zt2ON
|
||||
-----END CERTIFICATE REQUEST-----
|
|
@ -0,0 +1,27 @@
|
|||
Certificate Request check Server1 SHA1
|
||||
depends_on:POLARSSL_SHA1_C
|
||||
x509_cert_req_check:"data_files/server1.key":SIG_RSA_SHA1:"data_files/server1.req.sha1"
|
||||
|
||||
Certificate Request check Server1 SHA224
|
||||
depends_on:POLARSSL_SHA2_C
|
||||
x509_cert_req_check:"data_files/server1.key":SIG_RSA_SHA224:"data_files/server1.req.sha224"
|
||||
|
||||
Certificate Request check Server1 SHA256
|
||||
depends_on:POLARSSL_SHA2_C
|
||||
x509_cert_req_check:"data_files/server1.key":SIG_RSA_SHA256:"data_files/server1.req.sha256"
|
||||
|
||||
Certificate Request check Server1 SHA384
|
||||
depends_on:POLARSSL_SHA4_C
|
||||
x509_cert_req_check:"data_files/server1.key":SIG_RSA_SHA384:"data_files/server1.req.sha384"
|
||||
|
||||
Certificate Request check Server1 SHA512
|
||||
depends_on:POLARSSL_SHA4_C
|
||||
x509_cert_req_check:"data_files/server1.key":SIG_RSA_SHA512:"data_files/server1.req.sha512"
|
||||
|
||||
Certificate Request check Server1 MD4
|
||||
depends_on:POLARSSL_MD4_C
|
||||
x509_cert_req_check:"data_files/server1.key":SIG_RSA_MD4:"data_files/server1.req.md4"
|
||||
|
||||
Certificate Request check Server1 MD5
|
||||
depends_on:POLARSSL_MD5_C
|
||||
x509_cert_req_check:"data_files/server1.key":SIG_RSA_MD5:"data_files/server1.req.md5"
|
|
@ -0,0 +1,64 @@
|
|||
BEGIN_HEADER
|
||||
#include <polarssl/x509write.h>
|
||||
#include <polarssl/x509.h>
|
||||
#include <polarssl/pem.h>
|
||||
END_HEADER
|
||||
|
||||
BEGIN_DEPENDENCIES
|
||||
depends_on:POLARSSL_X509_WRITE_C:POLARSSL_BIGNUM_C
|
||||
END_DEPENDENCIES
|
||||
|
||||
BEGIN_CASE
|
||||
x509_cert_req_check:key_file:md_type:cert_req_check_file
|
||||
{
|
||||
rsa_context rsa;
|
||||
pem_context pem;
|
||||
x509_req_name req_name, *cur;
|
||||
unsigned char *c;
|
||||
unsigned char buf[4000];
|
||||
unsigned char check_buf[4000];
|
||||
int ret;
|
||||
size_t olen = 2000;
|
||||
FILE *f;
|
||||
|
||||
cur = &req_name;
|
||||
|
||||
memset( cur, 0, sizeof(x509_req_name) );
|
||||
strcpy( cur->oid, OID_CN );
|
||||
strcpy( cur->name, "PolarSSL Server 1" );
|
||||
cur->next = malloc( sizeof(x509_req_name) );
|
||||
cur = cur->next;
|
||||
|
||||
memset( cur, 0, sizeof(x509_req_name) );
|
||||
strcpy( cur->oid, OID_ORGANIZATION );
|
||||
strcpy( cur->name, "PolarSSL" );
|
||||
cur->next = malloc( sizeof(x509_req_name) );
|
||||
cur = cur->next;
|
||||
|
||||
memset( cur, 0, sizeof(x509_req_name) );
|
||||
strcpy( cur->oid, OID_COUNTRY );
|
||||
strcpy( cur->name, "NL" );
|
||||
|
||||
memset( &rsa, 0, sizeof(rsa_context) );
|
||||
ret = x509parse_keyfile( &rsa, {key_file}, NULL );
|
||||
TEST_ASSERT( ret == 0 );
|
||||
if( ret != 0 )
|
||||
return 0;
|
||||
|
||||
ret = x509_write_cert_req( buf, 4000, &rsa, &req_name, {md_type} );
|
||||
TEST_ASSERT( ret >= 0 );
|
||||
|
||||
c = buf + 3999 - ret;
|
||||
|
||||
f = fopen( {cert_req_check_file}, "r" );
|
||||
TEST_ASSERT( f != NULL );
|
||||
fread( check_buf, 1, 4000, f );
|
||||
fclose( f );
|
||||
|
||||
pem_init( &pem );
|
||||
pem_read_buffer( &pem, "-----BEGIN CERTIFICATE REQUEST-----", "-----END CERTIFICATE REQUEST-----", check_buf, NULL, 0, &olen );
|
||||
|
||||
TEST_ASSERT( memcmp( c, pem.buf, pem.buflen ) == 0 );
|
||||
TEST_ASSERT( pem.buflen == (size_t) ret );
|
||||
}
|
||||
END_CASE
|
Загрузка…
Ссылка в новой задаче