10 ((void) certificate_depth);
20 ((void) certificate_depth);
31 typedef UINT32 uint32_t;
40 #define GET_UINT32_BE(n,b,i) \
42 (n) = ( (uint32_t) (b)[(i) ] << 24 ) \
43 | ( (uint32_t) (b)[(i) + 1] << 16 ) \
44 | ( (uint32_t) (b)[(i) + 2] << 8 ) \
45 | ( (uint32_t) (b)[(i) + 3] ); \
50 #define PUT_UINT32_BE(n,b,i) \
52 (b)[(i) ] = (unsigned char) ( (n) >> 24 ); \
53 (b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \
54 (b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \
55 (b)[(i) + 3] = (unsigned char) ( (n) ); \
59 int unhexify(
unsigned char *obuf,
const char *ibuf)
62 int len = strlen(ibuf) / 2;
63 assert(!(strlen(ibuf) %1));
68 if( c >=
'0' && c <=
'9' )
70 else if( c >=
'a' && c <=
'f' )
72 else if( c >=
'A' && c <=
'F' )
78 if( c2 >=
'0' && c2 <=
'9' )
80 else if( c2 >=
'a' && c2 <=
'f' )
82 else if( c2 >=
'A' && c2 <=
'F' )
87 *obuf++ = ( c << 4 ) | c2;
93 void hexify(
unsigned char *obuf,
const unsigned char *ibuf,
int len)
105 *obuf++ =
'a' + h - 10;
110 *obuf++ =
'a' + l - 10;
126 static int rnd_std_rand(
void *rng_state,
unsigned char *output,
size_t len )
130 if( rng_state != NULL )
133 for( i = 0; i < len; ++i )
144 static int rnd_zero_rand(
void *rng_state,
unsigned char *output,
size_t len )
146 if( rng_state != NULL )
149 memset( output, 0, len );
176 if( rng_state == NULL )
185 memcpy( output, info->
buf, use_len );
186 info->
buf += use_len;
190 if( len - use_len > 0 )
191 return(
rnd_std_rand( NULL, output + use_len, len - use_len ) );
220 uint32_t i, *k, sum, delta=0x9E3779B9;
221 unsigned char result[4];
223 if( rng_state == NULL )
230 size_t use_len = ( len > 4 ) ? 4 : len;
233 for( i = 0; i < 32; i++ )
235 info->
v0 += (((info->
v1 << 4) ^ (info->
v1 >> 5)) + info->
v1) ^ (sum + k[sum & 3]);
237 info->
v1 += (((info->
v0 << 4) ^ (info->
v0 >> 5)) + info->
v0) ^ (sum + k[(sum>>11) & 3]);
241 memcpy( output, result, use_len );
251 #ifdef POLARSSL_X509_PARSE_C
252 #ifdef POLARSSL_BIGNUM_C
255 FCT_SUITE_BGN(test_suite_x509parse)
257 #ifdef POLARSSL_PEM_C
258 #ifdef POLARSSL_FS_IO
260 FCT_TEST_BGN(x509_certificate_information_1)
267 memset( buf, 0, 2000 );
274 fct_chk( res != -1 );
275 fct_chk( res != -2 );
277 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 01\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Server 1\nissued on : 2011-02-12 14:44:06\nexpires on : 2021-02-12 14:44:06\nsigned using : RSA+SHA1\nRSA key size : 2048 bits\n" ) == 0 );
283 #ifdef POLARSSL_PEM_C
284 #ifdef POLARSSL_FS_IO
286 FCT_TEST_BGN(x509_certificate_information_2)
293 memset( buf, 0, 2000 );
300 fct_chk( res != -1 );
301 fct_chk( res != -2 );
303 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 02\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=localhost\nissued on : 2011-02-12 14:44:06\nexpires on : 2021-02-12 14:44:06\nsigned using : RSA+SHA1\nRSA key size : 2048 bits\n" ) == 0 );
309 #ifdef POLARSSL_PEM_C
310 #ifdef POLARSSL_FS_IO
312 FCT_TEST_BGN(x509_certificate_information_3)
319 memset( buf, 0, 2000 );
326 fct_chk( res != -1 );
327 fct_chk( res != -2 );
329 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 00\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nissued on : 2011-02-12 14:44:00\nexpires on : 2021-02-12 14:44:00\nsigned using : RSA+SHA1\nRSA key size : 2048 bits\n" ) == 0 );
335 #ifdef POLARSSL_PEM_C
336 #ifdef POLARSSL_FS_IO
338 FCT_TEST_BGN(x509_certificate_information_md2_digest)
345 memset( buf, 0, 2000 );
352 fct_chk( res != -1 );
353 fct_chk( res != -2 );
355 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 09\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert MD2\nissued on : 2009-07-12 10:56:59\nexpires on : 2011-07-12 10:56:59\nsigned using : RSA+MD2\nRSA key size : 2048 bits\n" ) == 0 );
361 #ifdef POLARSSL_PEM_C
362 #ifdef POLARSSL_FS_IO
364 FCT_TEST_BGN(x509_certificate_information_md4_digest)
371 memset( buf, 0, 2000 );
378 fct_chk( res != -1 );
379 fct_chk( res != -2 );
381 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 05\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert MD4\nissued on : 2011-02-12 14:44:07\nexpires on : 2021-02-12 14:44:07\nsigned using : RSA+MD4\nRSA key size : 2048 bits\n" ) == 0 );
387 #ifdef POLARSSL_PEM_C
388 #ifdef POLARSSL_FS_IO
390 FCT_TEST_BGN(x509_certificate_information_md5_digest)
397 memset( buf, 0, 2000 );
404 fct_chk( res != -1 );
405 fct_chk( res != -2 );
407 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 06\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert MD5\nissued on : 2011-02-12 14:44:07\nexpires on : 2021-02-12 14:44:07\nsigned using : RSA+MD5\nRSA key size : 2048 bits\n" ) == 0 );
413 #ifdef POLARSSL_PEM_C
414 #ifdef POLARSSL_FS_IO
416 FCT_TEST_BGN(x509_certificate_information_sha1_digest)
423 memset( buf, 0, 2000 );
430 fct_chk( res != -1 );
431 fct_chk( res != -2 );
433 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 07\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert SHA1\nissued on : 2011-02-12 14:44:07\nexpires on : 2021-02-12 14:44:07\nsigned using : RSA+SHA1\nRSA key size : 2048 bits\n" ) == 0 );
439 #ifdef POLARSSL_PEM_C
440 #ifdef POLARSSL_FS_IO
442 FCT_TEST_BGN(x509_certificate_information_sha224_digest)
449 memset( buf, 0, 2000 );
456 fct_chk( res != -1 );
457 fct_chk( res != -2 );
459 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 08\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert SHA224\nissued on : 2011-02-12 14:44:07\nexpires on : 2021-02-12 14:44:07\nsigned using : RSA+SHA224\nRSA key size : 2048 bits\n" ) == 0 );
465 #ifdef POLARSSL_PEM_C
466 #ifdef POLARSSL_FS_IO
468 FCT_TEST_BGN(x509_certificate_information_sha256_digest)
475 memset( buf, 0, 2000 );
482 fct_chk( res != -1 );
483 fct_chk( res != -2 );
485 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 09\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert SHA256\nissued on : 2011-02-12 14:44:07\nexpires on : 2021-02-12 14:44:07\nsigned using : RSA+SHA256\nRSA key size : 2048 bits\n" ) == 0 );
491 #ifdef POLARSSL_PEM_C
492 #ifdef POLARSSL_FS_IO
494 FCT_TEST_BGN(x509_certificate_information_sha384_digest)
501 memset( buf, 0, 2000 );
508 fct_chk( res != -1 );
509 fct_chk( res != -2 );
511 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 0A\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert SHA384\nissued on : 2011-02-12 14:44:07\nexpires on : 2021-02-12 14:44:07\nsigned using : RSA+SHA384\nRSA key size : 2048 bits\n" ) == 0 );
517 #ifdef POLARSSL_PEM_C
518 #ifdef POLARSSL_FS_IO
520 FCT_TEST_BGN(x509_certificate_information_sha512_digest)
527 memset( buf, 0, 2000 );
534 fct_chk( res != -1 );
535 fct_chk( res != -2 );
537 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 0B\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert SHA512\nissued on : 2011-02-12 14:44:07\nexpires on : 2021-02-12 14:44:07\nsigned using : RSA+SHA512\nRSA key size : 2048 bits\n" ) == 0 );
543 #ifdef POLARSSL_PEM_C
544 #ifdef POLARSSL_FS_IO
546 FCT_TEST_BGN(x509_crl_information_1)
552 memset( &crl, 0,
sizeof(
x509_crl ) );
553 memset( buf, 0, 2000 );
560 fct_chk( res != -1 );
561 fct_chk( res != -2 );
563 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-20 10:24:19\nnext update : 2011-02-20 11:24:19\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+SHA1\n" ) == 0 );
569 #ifdef POLARSSL_PEM_C
570 #ifdef POLARSSL_FS_IO
572 FCT_TEST_BGN(x509_crl_information_md2_digest)
578 memset( &crl, 0,
sizeof(
x509_crl ) );
579 memset( buf, 0, 2000 );
586 fct_chk( res != -1 );
587 fct_chk( res != -2 );
589 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2009-07-19 19:56:37\nnext update : 2009-09-17 19:56:37\nRevoked certificates:\nserial number: 01 revocation date: 2009-02-09 21:12:36\nserial number: 03 revocation date: 2009-02-09 21:12:36\nsigned using : RSA+MD2\n" ) == 0 );
595 #ifdef POLARSSL_PEM_C
596 #ifdef POLARSSL_FS_IO
598 FCT_TEST_BGN(x509_crl_information_md4_digest)
604 memset( &crl, 0,
sizeof(
x509_crl ) );
605 memset( buf, 0, 2000 );
612 fct_chk( res != -1 );
613 fct_chk( res != -2 );
615 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-12 14:44:07\nnext update : 2011-04-13 14:44:07\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+MD4\n" ) == 0 );
621 #ifdef POLARSSL_PEM_C
622 #ifdef POLARSSL_FS_IO
624 FCT_TEST_BGN(x509_crl_information_md5_digest)
630 memset( &crl, 0,
sizeof(
x509_crl ) );
631 memset( buf, 0, 2000 );
638 fct_chk( res != -1 );
639 fct_chk( res != -2 );
641 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-12 14:44:07\nnext update : 2011-04-13 14:44:07\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+MD5\n" ) == 0 );
647 #ifdef POLARSSL_PEM_C
648 #ifdef POLARSSL_FS_IO
650 FCT_TEST_BGN(x509_crl_information_sha1_digest)
656 memset( &crl, 0,
sizeof(
x509_crl ) );
657 memset( buf, 0, 2000 );
664 fct_chk( res != -1 );
665 fct_chk( res != -2 );
667 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-12 14:44:07\nnext update : 2011-04-13 14:44:07\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+SHA1\n" ) == 0 );
673 #ifdef POLARSSL_PEM_C
674 #ifdef POLARSSL_FS_IO
676 FCT_TEST_BGN(x509_crl_information_sha224_digest)
682 memset( &crl, 0,
sizeof(
x509_crl ) );
683 memset( buf, 0, 2000 );
690 fct_chk( res != -1 );
691 fct_chk( res != -2 );
693 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-12 14:44:07\nnext update : 2011-04-13 14:44:07\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+SHA224\n" ) == 0 );
699 #ifdef POLARSSL_PEM_C
700 #ifdef POLARSSL_FS_IO
702 FCT_TEST_BGN(x509_crl_information_sha256_digest)
708 memset( &crl, 0,
sizeof(
x509_crl ) );
709 memset( buf, 0, 2000 );
716 fct_chk( res != -1 );
717 fct_chk( res != -2 );
719 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-12 14:44:07\nnext update : 2011-04-13 14:44:07\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+SHA256\n" ) == 0 );
725 #ifdef POLARSSL_PEM_C
726 #ifdef POLARSSL_FS_IO
728 FCT_TEST_BGN(x509_crl_information_sha384_digest)
734 memset( &crl, 0,
sizeof(
x509_crl ) );
735 memset( buf, 0, 2000 );
742 fct_chk( res != -1 );
743 fct_chk( res != -2 );
745 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-12 14:44:07\nnext update : 2011-04-13 14:44:07\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+SHA384\n" ) == 0 );
751 #ifdef POLARSSL_PEM_C
752 #ifdef POLARSSL_FS_IO
754 FCT_TEST_BGN(x509_crl_information_sha512_digest)
760 memset( &crl, 0,
sizeof(
x509_crl ) );
761 memset( buf, 0, 2000 );
768 fct_chk( res != -1 );
769 fct_chk( res != -2 );
771 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-12 14:44:07\nnext update : 2011-04-13 14:44:07\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+SHA512\n" ) == 0 );
777 #ifdef POLARSSL_MD5_C
778 #ifdef POLARSSL_PEM_C
779 #ifdef POLARSSL_FS_IO
781 FCT_TEST_BGN(x509_parse_key_1_no_password_when_required)
804 #ifdef POLARSSL_MD5_C
805 #ifdef POLARSSL_PEM_C
806 #ifdef POLARSSL_FS_IO
808 FCT_TEST_BGN(x509_parse_key_2_correct_password)
831 #ifdef POLARSSL_MD5_C
832 #ifdef POLARSSL_PEM_C
833 #ifdef POLARSSL_FS_IO
835 FCT_TEST_BGN(x509_parse_key_3_wrong_password)
858 #ifdef POLARSSL_MD5_C
859 #ifdef POLARSSL_DES_C
860 #ifdef POLARSSL_PEM_C
861 #ifdef POLARSSL_FS_IO
863 FCT_TEST_BGN(x509_parse_key_4_des_encrypted)
887 #ifdef POLARSSL_MD5_C
888 #ifdef POLARSSL_DES_C
889 #ifdef POLARSSL_PEM_C
890 #ifdef POLARSSL_FS_IO
892 FCT_TEST_BGN(x509_parse_key_5_3des_encrypted)
916 #ifdef POLARSSL_MD5_C
917 #ifdef POLARSSL_AES_C
918 #ifdef POLARSSL_PEM_C
919 #ifdef POLARSSL_FS_IO
921 FCT_TEST_BGN(x509_parse_key_6_aes_128_encrypted)
945 #ifdef POLARSSL_MD5_C
946 #ifdef POLARSSL_AES_C
947 #ifdef POLARSSL_PEM_C
948 #ifdef POLARSSL_FS_IO
950 FCT_TEST_BGN(x509_parse_key_7_aes_192_encrypted)
974 #ifdef POLARSSL_MD5_C
975 #ifdef POLARSSL_AES_C
976 #ifdef POLARSSL_PEM_C
977 #ifdef POLARSSL_FS_IO
979 FCT_TEST_BGN(x509_parse_key_8_aes_256_encrypted)
1003 #ifdef POLARSSL_MD5_C
1004 #ifdef POLARSSL_PEM_C
1005 #ifdef POLARSSL_FS_IO
1007 FCT_TEST_BGN(x509_parse_key_9_pkcs8_wrapped)
1016 fct_chk( res == 0 );
1030 #ifdef POLARSSL_MD5_C
1031 #ifdef POLARSSL_PEM_C
1032 #ifdef POLARSSL_FS_IO
1034 FCT_TEST_BGN(x509_parse_public_key_1_pkcs8_wrapped)
1043 fct_chk( res == 0 );
1057 #ifdef POLARSSL_PEM_C
1058 #ifdef POLARSSL_FS_IO
1060 FCT_TEST_BGN(x509_get_distinguished_name_1)
1067 memset( buf, 0, 2000 );
1074 fct_chk( res != -1 );
1075 fct_chk( res != -2 );
1077 fct_chk( strcmp( buf,
"C=NL, O=PolarSSL, CN=PolarSSL Server 1" ) == 0 );
1083 #ifdef POLARSSL_PEM_C
1084 #ifdef POLARSSL_FS_IO
1086 FCT_TEST_BGN(x509_get_distinguished_name_2)
1093 memset( buf, 0, 2000 );
1100 fct_chk( res != -1 );
1101 fct_chk( res != -2 );
1103 fct_chk( strcmp( buf,
"C=NL, O=PolarSSL, CN=PolarSSL Test CA" ) == 0 );
1109 #ifdef POLARSSL_PEM_C
1110 #ifdef POLARSSL_FS_IO
1112 FCT_TEST_BGN(x509_get_distinguished_name_3)
1119 memset( buf, 0, 2000 );
1126 fct_chk( res != -1 );
1127 fct_chk( res != -2 );
1129 fct_chk( strcmp( buf,
"C=NL, O=PolarSSL, CN=localhost" ) == 0 );
1135 #ifdef POLARSSL_PEM_C
1136 #ifdef POLARSSL_FS_IO
1138 FCT_TEST_BGN(x509_get_distinguished_name_4)
1145 memset( buf, 0, 2000 );
1152 fct_chk( res != -1 );
1153 fct_chk( res != -2 );
1155 fct_chk( strcmp( buf,
"C=NL, O=PolarSSL, CN=PolarSSL Test CA" ) == 0 );
1161 #ifdef POLARSSL_PEM_C
1162 #ifdef POLARSSL_FS_IO
1164 FCT_TEST_BGN(x509_time_expired_1)
1179 #ifdef POLARSSL_PEM_C
1180 #ifdef POLARSSL_FS_IO
1182 FCT_TEST_BGN(x509_time_expired_2)
1197 #ifdef POLARSSL_PEM_C
1198 #ifdef POLARSSL_FS_IO
1200 FCT_TEST_BGN(x509_time_expired_3)
1215 #ifdef POLARSSL_PEM_C
1216 #ifdef POLARSSL_FS_IO
1218 FCT_TEST_BGN(x509_time_expired_4)
1233 #ifdef POLARSSL_PEM_C
1234 #ifdef POLARSSL_FS_IO
1236 FCT_TEST_BGN(x509_time_expired_5)
1251 #ifdef POLARSSL_PEM_C
1252 #ifdef POLARSSL_FS_IO
1254 FCT_TEST_BGN(x509_time_expired_6polarssl_fs_io)
1269 #ifdef POLARSSL_PEM_C
1270 #ifdef POLARSSL_FS_IO
1272 FCT_TEST_BGN(x509_certificate_verification_1_revoked_cert_expired_crl)
1282 memset( &crl, 0,
sizeof(
x509_crl ) );
1301 #ifdef POLARSSL_PEM_C
1302 #ifdef POLARSSL_FS_IO
1304 FCT_TEST_BGN(x509_certificate_verification_2_revoked_cert_expired_crl)
1314 memset( &crl, 0,
sizeof(
x509_crl ) );
1320 res =
x509parse_verify( &crt, &ca, &crl,
"PolarSSL Server 1", &flags, NULL, NULL );
1333 #ifdef POLARSSL_PEM_C
1334 #ifdef POLARSSL_FS_IO
1336 FCT_TEST_BGN(x509_certificate_verification_3_revoked_cert_expired_crl_cn_mismatch)
1346 memset( &crl, 0,
sizeof(
x509_crl ) );
1352 res =
x509parse_verify( &crt, &ca, &crl,
"PolarSSL Wrong CN", &flags, NULL, NULL );
1365 #ifdef POLARSSL_PEM_C
1366 #ifdef POLARSSL_FS_IO
1368 FCT_TEST_BGN(x509_certificate_verification_4_valid_cert_expired_crl)
1378 memset( &crl, 0,
sizeof(
x509_crl ) );
1397 #ifdef POLARSSL_PEM_C
1398 #ifdef POLARSSL_FS_IO
1400 FCT_TEST_BGN(x509_certificate_verification_5_revoked_cert)
1410 memset( &crl, 0,
sizeof(
x509_crl ) );
1429 #ifdef POLARSSL_PEM_C
1430 #ifdef POLARSSL_FS_IO
1432 FCT_TEST_BGN(x509_certificate_verification_6_revoked_cert)
1442 memset( &crl, 0,
sizeof(
x509_crl ) );
1448 res =
x509parse_verify( &crt, &ca, &crl,
"PolarSSL Server 1", &flags, NULL, NULL );
1461 #ifdef POLARSSL_PEM_C
1462 #ifdef POLARSSL_FS_IO
1464 FCT_TEST_BGN(x509_certificate_verification_7_revoked_cert_cn_mismatch)
1474 memset( &crl, 0,
sizeof(
x509_crl ) );
1480 res =
x509parse_verify( &crt, &ca, &crl,
"PolarSSL Wrong CN", &flags, NULL, NULL );
1493 #ifdef POLARSSL_PEM_C
1494 #ifdef POLARSSL_FS_IO
1496 FCT_TEST_BGN(x509_certificate_verification_8_valid_cert)
1506 memset( &crl, 0,
sizeof(
x509_crl ) );
1518 fct_chk( res == ( 0 ) );
1519 fct_chk( flags == ( 0 ) );
1525 #ifdef POLARSSL_PEM_C
1526 #ifdef POLARSSL_FS_IO
1528 FCT_TEST_BGN(x509_certificate_verification_9_not_trusted_cert)
1538 memset( &crl, 0,
sizeof(
x509_crl ) );
1557 #ifdef POLARSSL_PEM_C
1558 #ifdef POLARSSL_FS_IO
1560 FCT_TEST_BGN(x509_certificate_verification_10_not_trusted_cert_expired_crl)
1570 memset( &crl, 0,
sizeof(
x509_crl ) );
1589 #ifdef POLARSSL_MD4_C
1590 #ifdef POLARSSL_PEM_C
1591 #ifdef POLARSSL_FS_IO
1593 FCT_TEST_BGN(x509_certificate_verification_12_valid_cert_md4_digest)
1603 memset( &crl, 0,
sizeof(
x509_crl ) );
1615 fct_chk( res == ( 0 ) );
1616 fct_chk( flags == ( 0 ) );
1623 #ifdef POLARSSL_MD5_C
1624 #ifdef POLARSSL_PEM_C
1625 #ifdef POLARSSL_FS_IO
1627 FCT_TEST_BGN(x509_certificate_verification_13_valid_cert_md5_digest)
1637 memset( &crl, 0,
sizeof(
x509_crl ) );
1649 fct_chk( res == ( 0 ) );
1650 fct_chk( flags == ( 0 ) );
1657 #ifdef POLARSSL_SHA1_C
1658 #ifdef POLARSSL_PEM_C
1659 #ifdef POLARSSL_FS_IO
1661 FCT_TEST_BGN(x509_certificate_verification_14_valid_cert_sha1_digest)
1671 memset( &crl, 0,
sizeof(
x509_crl ) );
1683 fct_chk( res == ( 0 ) );
1684 fct_chk( flags == ( 0 ) );
1691 #ifdef POLARSSL_SHA2_C
1692 #ifdef POLARSSL_PEM_C
1693 #ifdef POLARSSL_FS_IO
1695 FCT_TEST_BGN(x509_certificate_verification_15_valid_cert_sha224_digest)
1705 memset( &crl, 0,
sizeof(
x509_crl ) );
1717 fct_chk( res == ( 0 ) );
1718 fct_chk( flags == ( 0 ) );
1725 #ifdef POLARSSL_SHA2_C
1726 #ifdef POLARSSL_PEM_C
1727 #ifdef POLARSSL_FS_IO
1729 FCT_TEST_BGN(x509_certificate_verification_16_valid_cert_sha256_digest)
1739 memset( &crl, 0,
sizeof(
x509_crl ) );
1751 fct_chk( res == ( 0 ) );
1752 fct_chk( flags == ( 0 ) );
1759 #ifdef POLARSSL_SHA4_C
1760 #ifdef POLARSSL_PEM_C
1761 #ifdef POLARSSL_FS_IO
1763 FCT_TEST_BGN(x509_certificate_verification_17_valid_cert_sha384_digest)
1773 memset( &crl, 0,
sizeof(
x509_crl ) );
1785 fct_chk( res == ( 0 ) );
1786 fct_chk( flags == ( 0 ) );
1793 #ifdef POLARSSL_SHA4_C
1794 #ifdef POLARSSL_PEM_C
1795 #ifdef POLARSSL_FS_IO
1797 FCT_TEST_BGN(x509_certificate_verification_18_valid_cert_sha512_digest)
1807 memset( &crl, 0,
sizeof(
x509_crl ) );
1819 fct_chk( res == ( 0 ) );
1820 fct_chk( flags == ( 0 ) );
1827 #ifdef POLARSSL_SHA4_C
1828 #ifdef POLARSSL_PEM_C
1829 #ifdef POLARSSL_FS_IO
1831 FCT_TEST_BGN(x509_certificate_verification_19_valid_cert_denying_callback)
1841 memset( &crl, 0,
sizeof(
x509_crl ) );
1861 #ifdef POLARSSL_PEM_C
1862 #ifdef POLARSSL_FS_IO
1864 FCT_TEST_BGN(x509_certificate_verification_20_not_trusted_cert_allowing_callback)
1874 memset( &crl, 0,
sizeof(
x509_crl ) );
1886 fct_chk( res == ( 0 ) );
1887 fct_chk( flags == ( 0 ) );
1893 #ifdef POLARSSL_PEM_C
1894 #ifdef POLARSSL_FS_IO
1896 FCT_TEST_BGN(x509_certificate_verification_21_domain_matching_wildcard_certificate)
1906 memset( &crl, 0,
sizeof(
x509_crl ) );
1908 fct_chk(
x509parse_crtfile( &crt,
"data_files/cert_example_wildcard.crt" ) == 0 );
1912 res =
x509parse_verify( &crt, &ca, &crl,
"mail.example.com", &flags, NULL, NULL );
1918 fct_chk( res == ( 0 ) );
1919 fct_chk( flags == ( 0 ) );
1925 #ifdef POLARSSL_PEM_C
1926 #ifdef POLARSSL_FS_IO
1928 FCT_TEST_BGN(x509_certificate_verification_22_domain_not_matching_wildcard_certificate)
1938 memset( &crl, 0,
sizeof(
x509_crl ) );
1940 fct_chk(
x509parse_crtfile( &crt,
"data_files/cert_example_wildcard.crt" ) == 0 );
1944 res =
x509parse_verify( &crt, &ca, &crl,
"mail.example.net", &flags, NULL, NULL );
1957 #ifdef POLARSSL_PEM_C
1958 #ifdef POLARSSL_FS_IO
1960 FCT_TEST_BGN(x509_certificate_verification_23_domain_not_matching_wildcard_certificate)
1970 memset( &crl, 0,
sizeof(
x509_crl ) );
1972 fct_chk(
x509parse_crtfile( &crt,
"data_files/cert_example_wildcard.crt" ) == 0 );
1976 res =
x509parse_verify( &crt, &ca, &crl,
"example.com", &flags, NULL, NULL );
1989 #ifdef POLARSSL_PEM_C
1990 #ifdef POLARSSL_FS_IO
1992 FCT_TEST_BGN(x509_certificate_verification_24_domain_matching_cn_of_multi_certificate)
2002 memset( &crl, 0,
sizeof(
x509_crl ) );
2008 res =
x509parse_verify( &crt, &ca, &crl,
"www.example.com", &flags, NULL, NULL );
2021 #ifdef POLARSSL_PEM_C
2022 #ifdef POLARSSL_FS_IO
2024 FCT_TEST_BGN(x509_certificate_verification_25_domain_matching_multi_certificate)
2034 memset( &crl, 0,
sizeof(
x509_crl ) );
2040 res =
x509parse_verify( &crt, &ca, &crl,
"example.net", &flags, NULL, NULL );
2046 fct_chk( res == ( 0 ) );
2047 fct_chk( flags == ( 0 ) );
2053 #ifdef POLARSSL_PEM_C
2054 #ifdef POLARSSL_FS_IO
2056 FCT_TEST_BGN(x509_certificate_verification_26_domain_not_matching_multi_certificate)
2066 memset( &crl, 0,
sizeof(
x509_crl ) );
2072 res =
x509parse_verify( &crt, &ca, &crl,
"www.example.net", &flags, NULL, NULL );
2085 #ifdef POLARSSL_PEM_C
2086 #ifdef POLARSSL_FS_IO
2088 FCT_TEST_BGN(x509_certificate_verification_27_domain_not_matching_multi_certificate)
2098 memset( &crl, 0,
sizeof(
x509_crl ) );
2104 res =
x509parse_verify( &crt, &ca, &crl,
"xample.net", &flags, NULL, NULL );
2117 #ifdef POLARSSL_PEM_C
2118 #ifdef POLARSSL_FS_IO
2120 FCT_TEST_BGN(x509_certificate_verification_27_domain_not_matching_multi_certificate)
2130 memset( &crl, 0,
sizeof(
x509_crl ) );
2136 res =
x509parse_verify( &crt, &ca, &crl,
"bexample.net", &flags, NULL, NULL );
2149 #ifdef POLARSSL_PEM_C
2150 #ifdef POLARSSL_FS_IO
2152 FCT_TEST_BGN(x509_certificate_verification_28_domain_not_matching_wildcard_in_multi_certificate)
2162 memset( &crl, 0,
sizeof(
x509_crl ) );
2168 res =
x509parse_verify( &crt, &ca, &crl,
"example.org", &flags, NULL, NULL );
2181 #ifdef POLARSSL_PEM_C
2182 #ifdef POLARSSL_FS_IO
2184 FCT_TEST_BGN(x509_certificate_verification_29_domain_matching_wildcard_in_multi_certificate)
2194 memset( &crl, 0,
sizeof(
x509_crl ) );
2200 res =
x509parse_verify( &crt, &ca, &crl,
"mail.example.org", &flags, NULL, NULL );
2206 fct_chk( res == ( 0 ) );
2207 fct_chk( flags == ( 0 ) );
2213 #ifdef POLARSSL_PEM_C
2214 #ifdef POLARSSL_FS_IO
2216 FCT_TEST_BGN(x509_certificate_verification_30_domain_matching_multi_certificate_without_cn)
2226 memset( &crl, 0,
sizeof(
x509_crl ) );
2228 fct_chk(
x509parse_crtfile( &crt,
"data_files/cert_example_multi_nocn.crt" ) == 0 );
2232 res =
x509parse_verify( &crt, &ca, &crl,
"www.shotokan-braunschweig.de", &flags, NULL, NULL );
2245 #ifdef POLARSSL_PEM_C
2246 #ifdef POLARSSL_FS_IO
2248 FCT_TEST_BGN(x509_certificate_verification_31_domain_not_matching_multi_certificate_without_cn)
2258 memset( &crl, 0,
sizeof(
x509_crl ) );
2260 fct_chk(
x509parse_crtfile( &crt,
"data_files/cert_example_multi_nocn.crt" ) == 0 );
2264 res =
x509parse_verify( &crt, &ca, &crl,
"www.example.net", &flags, NULL, NULL );
2277 #ifdef POLARSSL_MD5_C
2278 #ifdef POLARSSL_PEM_C
2279 #ifdef POLARSSL_SELF_TEST
2281 FCT_TEST_BGN(x509_parse_selftest)
2291 FCT_TEST_BGN(x509_certificate_asn1_incorrect_first_tag)
2294 unsigned char buf[2000];
2295 unsigned char output[2000];
2299 memset( buf, 0, 2000 );
2300 memset( output, 0, 2000 );
2309 fct_chk( res != -1 );
2310 fct_chk( res != -2 );
2312 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2320 FCT_TEST_BGN(x509_certificate_asn1_correct_first_tag_data_length_does_not_match)
2323 unsigned char buf[2000];
2324 unsigned char output[2000];
2328 memset( buf, 0, 2000 );
2329 memset( output, 0, 2000 );
2331 data_len =
unhexify( buf,
"300000" );
2338 fct_chk( res != -1 );
2339 fct_chk( res != -2 );
2341 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2349 FCT_TEST_BGN(x509_certificate_asn1_correct_first_tag_no_more_data)
2352 unsigned char buf[2000];
2353 unsigned char output[2000];
2357 memset( buf, 0, 2000 );
2358 memset( output, 0, 2000 );
2360 data_len =
unhexify( buf,
"3000" );
2367 fct_chk( res != -1 );
2368 fct_chk( res != -2 );
2370 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2378 FCT_TEST_BGN(x509_certificate_asn1_correct_first_tag_length_data_incorrect)
2381 unsigned char buf[2000];
2382 unsigned char output[2000];
2386 memset( buf, 0, 2000 );
2387 memset( output, 0, 2000 );
2389 data_len =
unhexify( buf,
"30023085" );
2396 fct_chk( res != -1 );
2397 fct_chk( res != -2 );
2399 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2407 FCT_TEST_BGN(x509_certificate_asn1_correct_first_tag_length_data_incomplete)
2410 unsigned char buf[2000];
2411 unsigned char output[2000];
2415 memset( buf, 0, 2000 );
2416 memset( output, 0, 2000 );
2418 data_len =
unhexify( buf,
"30023083" );
2425 fct_chk( res != -1 );
2426 fct_chk( res != -2 );
2428 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2436 FCT_TEST_BGN(x509_certificate_asn1_correct_first_tag_length_data_incomplete)
2439 unsigned char buf[2000];
2440 unsigned char output[2000];
2444 memset( buf, 0, 2000 );
2445 memset( output, 0, 2000 );
2447 data_len =
unhexify( buf,
"30023081" );
2454 fct_chk( res != -1 );
2455 fct_chk( res != -2 );
2457 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2465 FCT_TEST_BGN(x509_certificate_asn1_correct_first_tag_length_data_incomplete)
2468 unsigned char buf[2000];
2469 unsigned char output[2000];
2473 memset( buf, 0, 2000 );
2474 memset( output, 0, 2000 );
2476 data_len =
unhexify( buf,
"3003308200" );
2483 fct_chk( res != -1 );
2484 fct_chk( res != -2 );
2486 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2494 FCT_TEST_BGN(x509_certificate_asn1_correct_first_tag_second_tag_no_tbscertificate)
2497 unsigned char buf[2000];
2498 unsigned char output[2000];
2502 memset( buf, 0, 2000 );
2503 memset( output, 0, 2000 );
2505 data_len =
unhexify( buf,
"300100" );
2512 fct_chk( res != -1 );
2513 fct_chk( res != -2 );
2515 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2523 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_no_version_tag_serial_missing)
2526 unsigned char buf[2000];
2527 unsigned char output[2000];
2531 memset( buf, 0, 2000 );
2532 memset( output, 0, 2000 );
2534 data_len =
unhexify( buf,
"3003300100" );
2541 fct_chk( res != -1 );
2542 fct_chk( res != -2 );
2544 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2552 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_invalid_version_tag)
2555 unsigned char buf[2000];
2556 unsigned char output[2000];
2560 memset( buf, 0, 2000 );
2561 memset( output, 0, 2000 );
2563 data_len =
unhexify( buf,
"30053003a00101" );
2570 fct_chk( res != -1 );
2571 fct_chk( res != -2 );
2573 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2581 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_valid_version_tag_no_length)
2584 unsigned char buf[2000];
2585 unsigned char output[2000];
2589 memset( buf, 0, 2000 );
2590 memset( output, 0, 2000 );
2592 data_len =
unhexify( buf,
"30053003a00102" );
2599 fct_chk( res != -1 );
2600 fct_chk( res != -2 );
2602 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2610 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_valid_version_tag_invalid_length)
2613 unsigned char buf[2000];
2614 unsigned char output[2000];
2618 memset( buf, 0, 2000 );
2619 memset( output, 0, 2000 );
2621 data_len =
unhexify( buf,
"30163014a012021000000000000000000000000000000000" );
2628 fct_chk( res != -1 );
2629 fct_chk( res != -2 );
2631 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2639 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_valid_version_tag_no_serial)
2642 unsigned char buf[2000];
2643 unsigned char output[2000];
2647 memset( buf, 0, 2000 );
2648 memset( output, 0, 2000 );
2650 data_len =
unhexify( buf,
"30073005a003020104" );
2657 fct_chk( res != -1 );
2658 fct_chk( res != -2 );
2660 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2668 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_invalid_length_version_tag)
2671 unsigned char buf[2000];
2672 unsigned char output[2000];
2676 memset( buf, 0, 2000 );
2677 memset( output, 0, 2000 );
2679 data_len =
unhexify( buf,
"30083006a00402010400" );
2686 fct_chk( res != -1 );
2687 fct_chk( res != -2 );
2689 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2697 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_incorrect_serial_tag)
2700 unsigned char buf[2000];
2701 unsigned char output[2000];
2705 memset( buf, 0, 2000 );
2706 memset( output, 0, 2000 );
2708 data_len =
unhexify( buf,
"30083006a00302010400" );
2715 fct_chk( res != -1 );
2716 fct_chk( res != -2 );
2718 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2726 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_incorrect_serial_length)
2729 unsigned char buf[2000];
2730 unsigned char output[2000];
2734 memset( buf, 0, 2000 );
2735 memset( output, 0, 2000 );
2737 data_len =
unhexify( buf,
"30083006a00302010482" );
2744 fct_chk( res != -1 );
2745 fct_chk( res != -2 );
2747 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2755 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_serial_no_alg)
2758 unsigned char buf[2000];
2759 unsigned char output[2000];
2763 memset( buf, 0, 2000 );
2764 memset( output, 0, 2000 );
2766 data_len =
unhexify( buf,
"300d300ba0030201048204deadbeef" );
2773 fct_chk( res != -1 );
2774 fct_chk( res != -2 );
2776 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2784 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_serial_no_alg_oid)
2787 unsigned char buf[2000];
2788 unsigned char output[2000];
2792 memset( buf, 0, 2000 );
2793 memset( output, 0, 2000 );
2795 data_len =
unhexify( buf,
"300e300ca0030201048204deadbeef00" );
2802 fct_chk( res != -1 );
2803 fct_chk( res != -2 );
2805 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2813 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_alg_oid_no_data_in_sequence)
2816 unsigned char buf[2000];
2817 unsigned char output[2000];
2821 memset( buf, 0, 2000 );
2822 memset( output, 0, 2000 );
2824 data_len =
unhexify( buf,
"300f300da0030201048204deadbeef3000" );
2831 fct_chk( res != -1 );
2832 fct_chk( res != -2 );
2834 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2842 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_alg_with_params)
2845 unsigned char buf[2000];
2846 unsigned char output[2000];
2850 memset( buf, 0, 2000 );
2851 memset( output, 0, 2000 );
2853 data_len =
unhexify( buf,
"30163014a0030201048204deadbeef30070604cafed00d01" );
2860 fct_chk( res != -1 );
2861 fct_chk( res != -2 );
2863 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2871 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_alg_data_no_params_unknown_version)
2874 unsigned char buf[2000];
2875 unsigned char output[2000];
2879 memset( buf, 0, 2000 );
2880 memset( output, 0, 2000 );
2882 data_len =
unhexify( buf,
"30153013a0030201048204deadbeef30060604cafed00d" );
2889 fct_chk( res != -1 );
2890 fct_chk( res != -2 );
2892 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2900 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_alg_data_unknown_version)
2903 unsigned char buf[2000];
2904 unsigned char output[2000];
2908 memset( buf, 0, 2000 );
2909 memset( output, 0, 2000 );
2911 data_len =
unhexify( buf,
"30173015a0030201048204deadbeef30080604cafed00d0500" );
2918 fct_chk( res != -1 );
2919 fct_chk( res != -2 );
2921 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2929 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_alg_data_length_mismatch)
2932 unsigned char buf[2000];
2933 unsigned char output[2000];
2937 memset( buf, 0, 2000 );
2938 memset( output, 0, 2000 );
2940 data_len =
unhexify( buf,
"30183016a0030201048204deadbeef30090604cafed00d050000" );
2947 fct_chk( res != -1 );
2948 fct_chk( res != -2 );
2950 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2958 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_alg_unknown_alg_id)
2961 unsigned char buf[2000];
2962 unsigned char output[2000];
2966 memset( buf, 0, 2000 );
2967 memset( output, 0, 2000 );
2969 data_len =
unhexify( buf,
"30173015a0030201028204deadbeef30080604cafed00d0500" );
2976 fct_chk( res != -1 );
2977 fct_chk( res != -2 );
2979 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2987 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_alg_specific_alg_id)
2990 unsigned char buf[2000];
2991 unsigned char output[2000];
2995 memset( buf, 0, 2000 );
2996 memset( output, 0, 2000 );
2998 data_len =
unhexify( buf,
"301c301aa0030201028204deadbeef300d06092a864886f70d0101020500" );
3005 fct_chk( res != -1 );
3006 fct_chk( res != -2 );
3008 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3016 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_alg_unknown_specific_alg_id)
3019 unsigned char buf[2000];
3020 unsigned char output[2000];
3024 memset( buf, 0, 2000 );
3025 memset( output, 0, 2000 );
3027 data_len =
unhexify( buf,
"301c301aa0030201028204deadbeef300d06092a864886f70d0101010500" );
3034 fct_chk( res != -1 );
3035 fct_chk( res != -2 );
3037 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3045 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_no_set_data)
3048 unsigned char buf[2000];
3049 unsigned char output[2000];
3053 memset( buf, 0, 2000 );
3054 memset( output, 0, 2000 );
3056 data_len =
unhexify( buf,
"301e301ca0030201028204deadbeef300d06092a864886f70d01010205003000" );
3063 fct_chk( res != -1 );
3064 fct_chk( res != -2 );
3066 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3074 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_no_inner_seq_data)
3077 unsigned char buf[2000];
3078 unsigned char output[2000];
3082 memset( buf, 0, 2000 );
3083 memset( output, 0, 2000 );
3085 data_len =
unhexify( buf,
"3020301ea0030201028204deadbeef300d06092a864886f70d010102050030023100" );
3092 fct_chk( res != -1 );
3093 fct_chk( res != -2 );
3095 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3103 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_no_inner_set_data)
3106 unsigned char buf[2000];
3107 unsigned char output[2000];
3111 memset( buf, 0, 2000 );
3112 memset( output, 0, 2000 );
3114 data_len =
unhexify( buf,
"30223020a0030201028204deadbeef300d06092a864886f70d0101020500300431023000" );
3121 fct_chk( res != -1 );
3122 fct_chk( res != -2 );
3124 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3132 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_two_inner_set_datas)
3135 unsigned char buf[2000];
3136 unsigned char output[2000];
3140 memset( buf, 0, 2000 );
3141 memset( output, 0, 2000 );
3143 data_len =
unhexify( buf,
"30243022a0030201028204deadbeef300d06092a864886f70d01010205003006310430003000" );
3150 fct_chk( res != -1 );
3151 fct_chk( res != -2 );
3153 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3161 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_no_oid_data)
3164 unsigned char buf[2000];
3165 unsigned char output[2000];
3169 memset( buf, 0, 2000 );
3170 memset( output, 0, 2000 );
3172 data_len =
unhexify( buf,
"30243022a0030201028204deadbeef300d06092a864886f70d01010205003006310430020600" );
3179 fct_chk( res != -1 );
3180 fct_chk( res != -2 );
3182 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3190 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_invalid_tag)
3193 unsigned char buf[2000];
3194 unsigned char output[2000];
3198 memset( buf, 0, 2000 );
3199 memset( output, 0, 2000 );
3201 data_len =
unhexify( buf,
"302a3028a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600060454657374" );
3208 fct_chk( res != -1 );
3209 fct_chk( res != -2 );
3211 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3219 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_no_string_data)
3222 unsigned char buf[2000];
3223 unsigned char output[2000];
3227 memset( buf, 0, 2000 );
3228 memset( output, 0, 2000 );
3230 data_len =
unhexify( buf,
"30253023a0030201028204deadbeef300d06092a864886f70d0101020500300731053003060013" );
3237 fct_chk( res != -1 );
3238 fct_chk( res != -2 );
3240 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3248 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_no_full_following_string)
3251 unsigned char buf[2000];
3252 unsigned char output[2000];
3256 memset( buf, 0, 2000 );
3257 memset( output, 0, 2000 );
3259 data_len =
unhexify( buf,
"302b3029a0030201028204deadbeef300d06092a864886f70d0101020500300d310b3009060013045465737400" );
3266 fct_chk( res != -1 );
3267 fct_chk( res != -2 );
3269 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3277 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_valid_issuer_no_validity)
3280 unsigned char buf[2000];
3281 unsigned char output[2000];
3285 memset( buf, 0, 2000 );
3286 memset( output, 0, 2000 );
3288 data_len =
unhexify( buf,
"302a3028a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374" );
3295 fct_chk( res != -1 );
3296 fct_chk( res != -2 );
3298 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3306 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_too_much_date_data)
3309 unsigned char buf[2000];
3310 unsigned char output[2000];
3314 memset( buf, 0, 2000 );
3315 memset( output, 0, 2000 );
3317 data_len =
unhexify( buf,
"30493047a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301d170c303930313031303030303030170c30393132333132333539353900" );
3324 fct_chk( res != -1 );
3325 fct_chk( res != -2 );
3327 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3335 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_invalid_from_date)
3338 unsigned char buf[2000];
3339 unsigned char output[2000];
3343 memset( buf, 0, 2000 );
3344 memset( output, 0, 2000 );
3346 data_len =
unhexify( buf,
"30483046a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303000000000170c303931323331323300000000" );
3353 fct_chk( res != -1 );
3354 fct_chk( res != -2 );
3356 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3364 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_invalid_to_date)
3367 unsigned char buf[2000];
3368 unsigned char output[2000];
3372 memset( buf, 0, 2000 );
3373 memset( output, 0, 2000 );
3375 data_len =
unhexify( buf,
"30483046a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323300000000" );
3382 fct_chk( res != -1 );
3383 fct_chk( res != -2 );
3385 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3393 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_valid_validity_no_subject)
3396 unsigned char buf[2000];
3397 unsigned char output[2000];
3401 memset( buf, 0, 2000 );
3402 memset( output, 0, 2000 );
3404 data_len =
unhexify( buf,
"30493047a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c30393132333132333539353930" );
3411 fct_chk( res != -1 );
3412 fct_chk( res != -2 );
3414 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3422 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_valid_subject_no_pubkeyinfo)
3425 unsigned char buf[2000];
3426 unsigned char output[2000];
3430 memset( buf, 0, 2000 );
3431 memset( output, 0, 2000 );
3433 data_len =
unhexify( buf,
"30563054a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374" );
3440 fct_chk( res != -1 );
3441 fct_chk( res != -2 );
3443 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3451 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_no_alg)
3454 unsigned char buf[2000];
3455 unsigned char output[2000];
3459 memset( buf, 0, 2000 );
3460 memset( output, 0, 2000 );
3462 data_len =
unhexify( buf,
"30583056a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743000" );
3469 fct_chk( res != -1 );
3470 fct_chk( res != -2 );
3472 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3480 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_valid_subject_unknown_pk_alg)
3483 unsigned char buf[2000];
3484 unsigned char output[2000];
3488 memset( buf, 0, 2000 );
3489 memset( output, 0, 2000 );
3491 data_len =
unhexify( buf,
"30673065a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374300f300d06092A864886F70D0101000500" );
3498 fct_chk( res != -1 );
3499 fct_chk( res != -2 );
3501 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3509 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_no_bitstring)
3512 unsigned char buf[2000];
3513 unsigned char output[2000];
3517 memset( buf, 0, 2000 );
3518 memset( output, 0, 2000 );
3520 data_len =
unhexify( buf,
"30673065a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374300f300d06092A864886F70D0101010500" );
3527 fct_chk( res != -1 );
3528 fct_chk( res != -2 );
3530 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3538 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_no_bitstring_data)
3541 unsigned char buf[2000];
3542 unsigned char output[2000];
3546 memset( buf, 0, 2000 );
3547 memset( output, 0, 2000 );
3549 data_len =
unhexify( buf,
"30693067a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743011300d06092A864886F70D01010105000300" );
3556 fct_chk( res != -1 );
3557 fct_chk( res != -2 );
3559 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3567 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_invalid_bitstring_start)
3570 unsigned char buf[2000];
3571 unsigned char output[2000];
3575 memset( buf, 0, 2000 );
3576 memset( output, 0, 2000 );
3578 data_len =
unhexify( buf,
"306a3068a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743012300d06092A864886F70D0101010500030101" );
3585 fct_chk( res != -1 );
3586 fct_chk( res != -2 );
3588 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3596 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_invalid_internal_bitstring_length)
3599 unsigned char buf[2000];
3600 unsigned char output[2000];
3604 memset( buf, 0, 2000 );
3605 memset( output, 0, 2000 );
3607 data_len =
unhexify( buf,
"306d306ba0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743015300d06092A864886F70D0101010500030400300000" );
3614 fct_chk( res != -1 );
3615 fct_chk( res != -2 );
3617 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3625 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_invalid_internal_bitstring_tag)
3628 unsigned char buf[2000];
3629 unsigned char output[2000];
3633 memset( buf, 0, 2000 );
3634 memset( output, 0, 2000 );
3636 data_len =
unhexify( buf,
"306d306ba0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743015300d06092A864886F70D0101010500030400310000" );
3643 fct_chk( res != -1 );
3644 fct_chk( res != -2 );
3646 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3654 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_invalid_mpi)
3657 unsigned char buf[2000];
3658 unsigned char output[2000];
3662 memset( buf, 0, 2000 );
3663 memset( output, 0, 2000 );
3665 data_len =
unhexify( buf,
"30743072a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301c300d06092A864886F70D0101010500030b0030080202ffff0302ffff" );
3672 fct_chk( res != -1 );
3673 fct_chk( res != -2 );
3675 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3683 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_total_length_mismatch)
3686 unsigned char buf[2000];
3687 unsigned char output[2000];
3691 memset( buf, 0, 2000 );
3692 memset( output, 0, 2000 );
3694 data_len =
unhexify( buf,
"30753073a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301d300d06092A864886F70D0101010500030b0030080202ffff0202ffff00" );
3701 fct_chk( res != -1 );
3702 fct_chk( res != -2 );
3704 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3712 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_check_failed)
3715 unsigned char buf[2000];
3716 unsigned char output[2000];
3720 memset( buf, 0, 2000 );
3721 memset( output, 0, 2000 );
3723 data_len =
unhexify( buf,
"30743072a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301c300d06092A864886F70D0101010500030b0030080202ffff0202ffff" );
3730 fct_chk( res != -1 );
3731 fct_chk( res != -2 );
3733 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3741 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_check_failed_expanded_length_notation)
3744 unsigned char buf[2000];
3745 unsigned char output[2000];
3749 memset( buf, 0, 2000 );
3750 memset( output, 0, 2000 );
3752 data_len =
unhexify( buf,
"308183308180a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210fffffffffffffffffffffffffffffffe0202ffff" );
3759 fct_chk( res != -1 );
3760 fct_chk( res != -2 );
3762 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3770 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_optional_uids_extensions_not_present)
3773 unsigned char buf[2000];
3774 unsigned char output[2000];
3778 memset( buf, 0, 2000 );
3779 memset( output, 0, 2000 );
3781 data_len =
unhexify( buf,
"308183308180a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff" );
3788 fct_chk( res != -1 );
3789 fct_chk( res != -2 );
3791 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3799 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_issuerid_wrong_tag)
3802 unsigned char buf[2000];
3803 unsigned char output[2000];
3807 memset( buf, 0, 2000 );
3808 memset( output, 0, 2000 );
3810 data_len =
unhexify( buf,
"308184308181a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff00" );
3817 fct_chk( res != -1 );
3818 fct_chk( res != -2 );
3820 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3828 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_uids_no_ext)
3831 unsigned char buf[2000];
3832 unsigned char output[2000];
3836 memset( buf, 0, 2000 );
3837 memset( output, 0, 2000 );
3839 data_len =
unhexify( buf,
"308189308186a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bb" );
3846 fct_chk( res != -1 );
3847 fct_chk( res != -2 );
3849 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3857 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_uids_invalid_length)
3860 unsigned char buf[2000];
3861 unsigned char output[2000];
3865 memset( buf, 0, 2000 );
3866 memset( output, 0, 2000 );
3868 data_len =
unhexify( buf,
"308189308186a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa185aaa201bb" );
3875 fct_chk( res != -1 );
3876 fct_chk( res != -2 );
3878 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3886 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_empty)
3889 unsigned char buf[2000];
3890 unsigned char output[2000];
3894 memset( buf, 0, 2000 );
3895 memset( output, 0, 2000 );
3897 data_len =
unhexify( buf,
"30818b308188a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba300" );
3904 fct_chk( res != -1 );
3905 fct_chk( res != -2 );
3907 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3915 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_length_mismatch)
3918 unsigned char buf[2000];
3919 unsigned char output[2000];
3923 memset( buf, 0, 2000 );
3924 memset( output, 0, 2000 );
3926 data_len =
unhexify( buf,
"30818e30818ba0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba303300000" );
3933 fct_chk( res != -1 );
3934 fct_chk( res != -2 );
3936 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3944 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_first_ext_invalid)
3947 unsigned char buf[2000];
3948 unsigned char output[2000];
3952 memset( buf, 0, 2000 );
3953 memset( output, 0, 2000 );
3955 data_len =
unhexify( buf,
"30818f30818ca0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30330023000" );
3962 fct_chk( res != -1 );
3963 fct_chk( res != -2 );
3965 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3973 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_first_ext_invalid_tag)
3976 unsigned char buf[2000];
3977 unsigned char output[2000];
3981 memset( buf, 0, 2000 );
3982 memset( output, 0, 2000 );
3984 data_len =
unhexify( buf,
"30819030818da0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba3043002310000" );
3991 fct_chk( res != -1 );
3992 fct_chk( res != -2 );
3994 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4002 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_basiccontraint_tag_bool_len_missing)
4005 unsigned char buf[2000];
4006 unsigned char output[2000];
4010 memset( buf, 0, 2000 );
4011 memset( output, 0, 2000 );
4013 data_len =
unhexify( buf,
"308198308195a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30c300a30060603551d1301010100" );
4020 fct_chk( res != -1 );
4021 fct_chk( res != -2 );
4023 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4031 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_basiccontraint_tag_data_missing)
4034 unsigned char buf[2000];
4035 unsigned char output[2000];
4039 memset( buf, 0, 2000 );
4040 memset( output, 0, 2000 );
4042 data_len =
unhexify( buf,
"308198308195a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30c300a30080603551d1301010100" );
4049 fct_chk( res != -1 );
4050 fct_chk( res != -2 );
4052 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4060 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_basiccontraint_tag_no_octet_present)
4063 unsigned char buf[2000];
4064 unsigned char output[2000];
4068 memset( buf, 0, 2000 );
4069 memset( output, 0, 2000 );
4071 data_len =
unhexify( buf,
"308198308195a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30d300b30090603551d1301010100" );
4078 fct_chk( res != -1 );
4079 fct_chk( res != -2 );
4081 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4089 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_basiccontraint_tag_octet_data_missing)
4092 unsigned char buf[2000];
4093 unsigned char output[2000];
4097 memset( buf, 0, 2000 );
4098 memset( output, 0, 2000 );
4100 data_len =
unhexify( buf,
"30819c308199a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba311300f300d0603551d130101010403300100" );
4107 fct_chk( res != -1 );
4108 fct_chk( res != -2 );
4110 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4118 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_basiccontraint_tag_no_pathlen)
4121 unsigned char buf[2000];
4122 unsigned char output[2000];
4126 memset( buf, 0, 2000 );
4127 memset( output, 0, 2000 );
4129 data_len =
unhexify( buf,
"30819f30819ca0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba314301230100603551d130101010406300402010102" );
4136 fct_chk( res != -1 );
4137 fct_chk( res != -2 );
4139 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4147 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_basiccontraint_tag_octet_len_mismatch)
4150 unsigned char buf[2000];
4151 unsigned char output[2000];
4155 memset( buf, 0, 2000 );
4156 memset( output, 0, 2000 );
4158 data_len =
unhexify( buf,
"3081a230819fa0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba317301530130603551d130101010409300702010102010100" );
4165 fct_chk( res != -1 );
4166 fct_chk( res != -2 );
4168 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4176 FCT_TEST_BGN(x509_certificate_asn1_correct_pubkey_no_sig_alg)
4179 unsigned char buf[2000];
4180 unsigned char output[2000];
4184 memset( buf, 0, 2000 );
4185 memset( output, 0, 2000 );
4187 data_len =
unhexify( buf,
"308183308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff" );
4194 fct_chk( res != -1 );
4195 fct_chk( res != -2 );
4197 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4205 FCT_TEST_BGN(x509_certificate_asn1_sig_alg_mismatch)
4208 unsigned char buf[2000];
4209 unsigned char output[2000];
4213 memset( buf, 0, 2000 );
4214 memset( output, 0, 2000 );
4216 data_len =
unhexify( buf,
"308192308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0102020500" );
4223 fct_chk( res != -1 );
4224 fct_chk( res != -2 );
4226 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4234 FCT_TEST_BGN(x509_certificate_asn1_sig_alg_no_sig)
4237 unsigned char buf[2000];
4238 unsigned char output[2000];
4242 memset( buf, 0, 2000 );
4243 memset( output, 0, 2000 );
4245 data_len =
unhexify( buf,
"308192308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500" );
4252 fct_chk( res != -1 );
4253 fct_chk( res != -2 );
4255 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4263 FCT_TEST_BGN(x509_certificate_asn1_signature_invalid_sig_data)
4266 unsigned char buf[2000];
4267 unsigned char output[2000];
4271 memset( buf, 0, 2000 );
4272 memset( output, 0, 2000 );
4274 data_len =
unhexify( buf,
"308195308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030100" );
4281 fct_chk( res != -1 );
4282 fct_chk( res != -2 );
4284 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4292 FCT_TEST_BGN(x509_certificate_asn1_signature_data_left)
4295 unsigned char buf[2000];
4296 unsigned char output[2000];
4300 memset( buf, 0, 2000 );
4301 memset( output, 0, 2000 );
4303 data_len =
unhexify( buf,
"308197308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff00" );
4310 fct_chk( res != -1 );
4311 fct_chk( res != -2 );
4313 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4321 FCT_TEST_BGN(x509_certificate_asn1_correct)
4324 unsigned char buf[2000];
4325 unsigned char output[2000];
4329 memset( buf, 0, 2000 );
4330 memset( output, 0, 2000 );
4332 data_len =
unhexify( buf,
"308196308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
4339 fct_chk( res != -1 );
4340 fct_chk( res != -2 );
4342 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : ?\?=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
4350 FCT_TEST_BGN(x509_certificate_asn1_generalizedtime_instead_of_utctime)
4353 unsigned char buf[2000];
4354 unsigned char output[2000];
4358 memset( buf, 0, 2000 );
4359 memset( output, 0, 2000 );
4361 data_len =
unhexify( buf,
"308198308182a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301e180e3230313030313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
4368 fct_chk( res != -1 );
4369 fct_chk( res != -2 );
4371 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : ?\?=Test\nsubject name : ?\?=Test\nissued on : 2010-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
4379 FCT_TEST_BGN(x509_certificate_asn1_name_with_x520_cn)
4382 unsigned char buf[2000];
4383 unsigned char output[2000];
4387 memset( buf, 0, 2000 );
4388 memset( output, 0, 2000 );
4390 data_len =
unhexify( buf,
"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550403130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
4397 fct_chk( res != -1 );
4398 fct_chk( res != -2 );
4400 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : CN=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
4408 FCT_TEST_BGN(x509_certificate_asn1_name_with_x520_c)
4411 unsigned char buf[2000];
4412 unsigned char output[2000];
4416 memset( buf, 0, 2000 );
4417 memset( output, 0, 2000 );
4419 data_len =
unhexify( buf,
"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550406130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
4426 fct_chk( res != -1 );
4427 fct_chk( res != -2 );
4429 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : C=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
4437 FCT_TEST_BGN(x509_certificate_asn1_name_with_x520_l)
4440 unsigned char buf[2000];
4441 unsigned char output[2000];
4445 memset( buf, 0, 2000 );
4446 memset( output, 0, 2000 );
4448 data_len =
unhexify( buf,
"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550407130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
4455 fct_chk( res != -1 );
4456 fct_chk( res != -2 );
4458 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : L=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
4466 FCT_TEST_BGN(x509_certificate_asn1_name_with_x520_st)
4469 unsigned char buf[2000];
4470 unsigned char output[2000];
4474 memset( buf, 0, 2000 );
4475 memset( output, 0, 2000 );
4477 data_len =
unhexify( buf,
"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550408130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
4484 fct_chk( res != -1 );
4485 fct_chk( res != -2 );
4487 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : ST=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
4495 FCT_TEST_BGN(x509_certificate_asn1_name_with_x520_o)
4498 unsigned char buf[2000];
4499 unsigned char output[2000];
4503 memset( buf, 0, 2000 );
4504 memset( output, 0, 2000 );
4506 data_len =
unhexify( buf,
"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b060355040a130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
4513 fct_chk( res != -1 );
4514 fct_chk( res != -2 );
4516 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : O=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
4524 FCT_TEST_BGN(x509_certificate_asn1_name_with_x520_ou)
4527 unsigned char buf[2000];
4528 unsigned char output[2000];
4532 memset( buf, 0, 2000 );
4533 memset( output, 0, 2000 );
4535 data_len =
unhexify( buf,
"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b060355040b130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
4542 fct_chk( res != -1 );
4543 fct_chk( res != -2 );
4545 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : OU=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
4553 FCT_TEST_BGN(x509_certificate_asn1_name_with_unknown_x520_part)
4556 unsigned char buf[2000];
4557 unsigned char output[2000];
4561 memset( buf, 0, 2000 );
4562 memset( output, 0, 2000 );
4564 data_len =
unhexify( buf,
"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b06035504de130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
4571 fct_chk( res != -1 );
4572 fct_chk( res != -2 );
4574 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : 0xDE=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
4582 FCT_TEST_BGN(x509_certificate_asn1_name_with_pkcs9_email)
4585 unsigned char buf[2000];
4586 unsigned char output[2000];
4590 memset( buf, 0, 2000 );
4591 memset( output, 0, 2000 );
4593 data_len =
unhexify( buf,
"30819f308189a0030201008204deadbeef300d06092a864886f70d010102050030153113301106092a864886f70d010901130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
4600 fct_chk( res != -1 );
4601 fct_chk( res != -2 );
4603 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : emailAddress=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
4611 FCT_TEST_BGN(x509_certificate_asn1_name_with_unknown_pkcs9_part)
4614 unsigned char buf[2000];
4615 unsigned char output[2000];
4619 memset( buf, 0, 2000 );
4620 memset( output, 0, 2000 );
4622 data_len =
unhexify( buf,
"30819f308189a0030201008204deadbeef300d06092a864886f70d010102050030153113301106092a864886f70d0109ab130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
4629 fct_chk( res != -1 );
4630 fct_chk( res != -2 );
4632 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : 0xAB=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
4640 FCT_TEST_BGN(x509_crl_asn1_incorrect_first_tag)
4643 unsigned char buf[2000];
4644 unsigned char output[2000];
4647 memset( &crl, 0,
sizeof(
x509_crl ) );
4648 memset( buf, 0, 2000 );
4649 memset( output, 0, 2000 );
4658 fct_chk( res != -1 );
4659 fct_chk( res != -2 );
4661 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4669 FCT_TEST_BGN(x509_crl_asn1_correct_first_tag_data_length_does_not_match)
4672 unsigned char buf[2000];
4673 unsigned char output[2000];
4676 memset( &crl, 0,
sizeof(
x509_crl ) );
4677 memset( buf, 0, 2000 );
4678 memset( output, 0, 2000 );
4680 data_len =
unhexify( buf,
"300000" );
4687 fct_chk( res != -1 );
4688 fct_chk( res != -2 );
4690 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4698 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_tag_missing)
4701 unsigned char buf[2000];
4702 unsigned char output[2000];
4705 memset( &crl, 0,
sizeof(
x509_crl ) );
4706 memset( buf, 0, 2000 );
4707 memset( output, 0, 2000 );
4709 data_len =
unhexify( buf,
"3000" );
4716 fct_chk( res != -1 );
4717 fct_chk( res != -2 );
4719 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4727 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_version_tag_len_missing)
4730 unsigned char buf[2000];
4731 unsigned char output[2000];
4734 memset( &crl, 0,
sizeof(
x509_crl ) );
4735 memset( buf, 0, 2000 );
4736 memset( output, 0, 2000 );
4738 data_len =
unhexify( buf,
"3003300102" );
4745 fct_chk( res != -1 );
4746 fct_chk( res != -2 );
4748 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4756 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_version_correct_alg_missing)
4759 unsigned char buf[2000];
4760 unsigned char output[2000];
4763 memset( &crl, 0,
sizeof(
x509_crl ) );
4764 memset( buf, 0, 2000 );
4765 memset( output, 0, 2000 );
4767 data_len =
unhexify( buf,
"30053003020100" );
4774 fct_chk( res != -1 );
4775 fct_chk( res != -2 );
4777 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4785 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_alg_correct_incorrect_version)
4788 unsigned char buf[2000];
4789 unsigned char output[2000];
4792 memset( &crl, 0,
sizeof(
x509_crl ) );
4793 memset( buf, 0, 2000 );
4794 memset( output, 0, 2000 );
4796 data_len =
unhexify( buf,
"300b3009020102300406000500" );
4803 fct_chk( res != -1 );
4804 fct_chk( res != -2 );
4806 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4814 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_correct_version_sig_oid1_unknown)
4817 unsigned char buf[2000];
4818 unsigned char output[2000];
4821 memset( &crl, 0,
sizeof(
x509_crl ) );
4822 memset( buf, 0, 2000 );
4823 memset( output, 0, 2000 );
4825 data_len =
unhexify( buf,
"300b3009020100300406000500" );
4832 fct_chk( res != -1 );
4833 fct_chk( res != -2 );
4835 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4843 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_sig_oid1_id_unknown)
4846 unsigned char buf[2000];
4847 unsigned char output[2000];
4850 memset( &crl, 0,
sizeof(
x509_crl ) );
4851 memset( buf, 0, 2000 );
4852 memset( output, 0, 2000 );
4854 data_len =
unhexify( buf,
"30143012020100300d06092a864886f70d01010f0500" );
4861 fct_chk( res != -1 );
4862 fct_chk( res != -2 );
4864 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4872 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_sig_oid1_correct_issuer_missing)
4875 unsigned char buf[2000];
4876 unsigned char output[2000];
4879 memset( &crl, 0,
sizeof(
x509_crl ) );
4880 memset( buf, 0, 2000 );
4881 memset( output, 0, 2000 );
4883 data_len =
unhexify( buf,
"30143012020100300d06092a864886f70d01010e0500" );
4890 fct_chk( res != -1 );
4891 fct_chk( res != -2 );
4893 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4901 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_issuer_set_missing)
4904 unsigned char buf[2000];
4905 unsigned char output[2000];
4908 memset( &crl, 0,
sizeof(
x509_crl ) );
4909 memset( buf, 0, 2000 );
4910 memset( output, 0, 2000 );
4912 data_len =
unhexify( buf,
"30163014020100300d06092a864886f70d01010e05003000" );
4919 fct_chk( res != -1 );
4920 fct_chk( res != -2 );
4922 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4930 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_correct_issuer_thisupdate_missing)
4933 unsigned char buf[2000];
4934 unsigned char output[2000];
4937 memset( &crl, 0,
sizeof(
x509_crl ) );
4938 memset( buf, 0, 2000 );
4939 memset( output, 0, 2000 );
4941 data_len =
unhexify( buf,
"30253023020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344" );
4948 fct_chk( res != -1 );
4949 fct_chk( res != -2 );
4951 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4959 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_correct_thisupdate_nextupdate_missing_entries_length_missing)
4962 unsigned char buf[2000];
4963 unsigned char output[2000];
4966 memset( &crl, 0,
sizeof(
x509_crl ) );
4967 memset( buf, 0, 2000 );
4968 memset( output, 0, 2000 );
4970 data_len =
unhexify( buf,
"30343032020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c30393031303130303030303030" );
4977 fct_chk( res != -1 );
4978 fct_chk( res != -2 );
4980 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4988 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_entries_present_invalid_sig_alg)
4991 unsigned char buf[2000];
4992 unsigned char output[2000];
4995 memset( &crl, 0,
sizeof(
x509_crl ) );
4996 memset( buf, 0, 2000 );
4997 memset( output, 0, 2000 );
4999 data_len =
unhexify( buf,
"304a3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c30383132333132333539353900" );
5006 fct_chk( res != -1 );
5007 fct_chk( res != -2 );
5009 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
5017 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_entries_present_date_in_entry_invalid)
5020 unsigned char buf[2000];
5021 unsigned char output[2000];
5024 memset( &crl, 0,
sizeof(
x509_crl ) );
5025 memset( buf, 0, 2000 );
5026 memset( output, 0, 2000 );
5028 data_len =
unhexify( buf,
"304a3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd190c30383132333132333539353900" );
5035 fct_chk( res != -1 );
5036 fct_chk( res != -2 );
5038 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
5046 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_sig_alg_present_sig_alg_does_not_match)
5049 unsigned char buf[2000];
5050 unsigned char output[2000];
5053 memset( &crl, 0,
sizeof(
x509_crl ) );
5054 memset( buf, 0, 2000 );
5055 memset( output, 0, 2000 );
5057 data_len =
unhexify( buf,
"30583047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c303831323331323335393539300d06092a864886f70d01010d0500" );
5064 fct_chk( res != -1 );
5065 fct_chk( res != -2 );
5067 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
5075 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_sig_present_len_mismatch)
5078 unsigned char buf[2000];
5079 unsigned char output[2000];
5082 memset( &crl, 0,
sizeof(
x509_crl ) );
5083 memset( buf, 0, 2000 );
5084 memset( output, 0, 2000 );
5086 data_len =
unhexify( buf,
"305d3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c303831323331323335393539300d06092a864886f70d01010e05000302000100" );
5093 fct_chk( res != -1 );
5094 fct_chk( res != -2 );
5096 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
5104 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_sig_present)
5107 unsigned char buf[2000];
5108 unsigned char output[2000];
5111 memset( &crl, 0,
sizeof(
x509_crl ) );
5112 memset( buf, 0, 2000 );
5113 memset( output, 0, 2000 );
5115 data_len =
unhexify( buf,
"305c3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c303831323331323335393539300d06092a864886f70d01010e050003020001" );
5122 fct_chk( res != -1 );
5123 fct_chk( res != -2 );
5125 fct_chk( strcmp( (
char *) output,
"CRL version : 1\nissuer name : CN=ABCD\nthis update : 2009-01-01 00:00:00\nnext update : 0000-00-00 00:00:00\nRevoked certificates:\nserial number: AB:CD revocation date: 2008-12-31 23:59:59\nsigned using : RSA+SHA224\n" ) == 0 );
5133 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_no_entries)
5136 unsigned char buf[2000];
5137 unsigned char output[2000];
5140 memset( &crl, 0,
sizeof(
x509_crl ) );
5141 memset( buf, 0, 2000 );
5142 memset( output, 0, 2000 );
5144 data_len =
unhexify( buf,
"30463031020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030300d06092a864886f70d01010e050003020001" );
5151 fct_chk( res != -1 );
5152 fct_chk( res != -2 );
5154 fct_chk( strcmp( (
char *) output,
"CRL version : 1\nissuer name : CN=ABCD\nthis update : 2009-01-01 00:00:00\nnext update : 0000-00-00 00:00:00\nRevoked certificates:\nsigned using : RSA+SHA224\n" ) == 0 );
5162 FCT_TEST_BGN(x509_key_asn1_incorrect_first_tag)
5165 unsigned char buf[2000];
5166 unsigned char output[2000];
5170 memset( buf, 0, 2000 );
5171 memset( output, 0, 2000 );
5186 FCT_TEST_BGN(x509_key_asn1_rsaprivatekey_incorrect_version_tag)
5189 unsigned char buf[2000];
5190 unsigned char output[2000];
5194 memset( buf, 0, 2000 );
5195 memset( output, 0, 2000 );
5197 data_len =
unhexify( buf,
"300100" );
5210 FCT_TEST_BGN(x509_key_asn1_rsaprivatekey_version_tag_missing)
5213 unsigned char buf[2000];
5214 unsigned char output[2000];
5218 memset( buf, 0, 2000 );
5219 memset( output, 0, 2000 );
5221 data_len =
unhexify( buf,
"3000" );
5234 FCT_TEST_BGN(x509_key_asn1_rsaprivatekey_invalid_version)
5237 unsigned char buf[2000];
5238 unsigned char output[2000];
5242 memset( buf, 0, 2000 );
5243 memset( output, 0, 2000 );
5245 data_len =
unhexify( buf,
"3003020101" );
5258 FCT_TEST_BGN(x509_key_asn1_rsaprivatekey_correct_version_incorrect_tag)
5261 unsigned char buf[2000];
5262 unsigned char output[2000];
5266 memset( buf, 0, 2000 );
5267 memset( output, 0, 2000 );
5269 data_len =
unhexify( buf,
"300402010000" );
5282 FCT_TEST_BGN(x509_key_asn1_rsaprivatekey_values_present_length_mismatch)
5285 unsigned char buf[2000];
5286 unsigned char output[2000];
5290 memset( buf, 0, 2000 );
5291 memset( output, 0, 2000 );
5293 data_len =
unhexify( buf,
"301c02010002010102010102010102010102010102010102010102010100" );
5306 FCT_TEST_BGN(x509_key_asn1_rsaprivatekey_values_present_check_privkey_fails)
5309 unsigned char buf[2000];
5310 unsigned char output[2000];
5314 memset( buf, 0, 2000 );
5315 memset( output, 0, 2000 );
5317 data_len =
unhexify( buf,
"301b020100020101020101020101020101020101020101020101020101" );