Package list libcryptx-perl / aae09a0
ecc der_length_custom_type fix Karel Miko 3 years ago
3 changed file(s) with 29 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
189189 }
190190 } else {
191191 /* calc length of length */
192 if ((err = der_length_asn1_length(y, &x)) != CRYPT_OK) {
192 if ((err = der_length_asn1_length(y - id_len, &x)) != CRYPT_OK) {
193193 goto LBL_ERR;
194194 }
195195 if (payloadlen != NULL) {
118118 use Crypt::PK::ECC;
119119
120120 my $pkec = Crypt::PK::ECC->new;
121 $pkec->import_key("test_eckey.pub.der");
122 $pkec->import_key("test_eckey.pubc.der");
123 $pkec->import_key("test_eckey.priv.der");
124 $pkec->import_key("test_eckey.privc.der");
125 $pkec->import_key("test_eckey.pub.pem");
126 $pkec->import_key("test_eckey.priv.pem");
127 $pkec->import_key("test_eckey-passwd.priv.pem", "secret");
121 warn("> gonna import: test_eckey.pub.der\n"); $pkec->import_key("test_eckey.pub.der");
122 warn("> gonna import: test_eckey.pubc.der\n"); $pkec->import_key("test_eckey.pubc.der");
123 warn("> gonna import: test_eckey.priv.der\n"); $pkec->import_key("test_eckey.priv.der");
124 warn("> gonna import: test_eckey.privc.der\n"); $pkec->import_key("test_eckey.privc.der");
125 warn("> gonna import: test_eckey.pub.pem\n"); $pkec->import_key("test_eckey.pub.pem");
126 warn("> gonna import: test_eckey.priv.pem\n"); $pkec->import_key("test_eckey.priv.pem");
127 warn("> gonna import: test_eckey-passwd.priv.pem + secret\n"); $pkec->import_key("test_eckey-passwd.priv.pem", "secret");
128128 }
129129
130130 doit("$curve/B");
00 use strict;
11 use warnings;
22
3 use Test::More tests => 661;
3 use Test::More tests => 662;
44 use Crypt::PK::ECC;
55
66 my $data = [
8989 }
9090
9191 ### ecc_set_key bug
92 my $der = pack("H*", "3081be020101041500c78b055db0706fd86b5a15e14b9e51f0043d18f9a074307202010130200607".
93 "2a8648ce3d0101021500fffffffffffffffffffffffffffffffeffffac7330060401000401070429".
94 "043b4c382ce37aa192a4019e763036f4f5dd4d7ebb938cf935318fdced6bc28286531733c3f03c4f".
95 "ee02150100000000000000000001b8fa16dfab9aca16b6b3020101a12c032a00040ca9f03d79907c".
96 "97538177a3027970abefa351073a73120e1b5d2dab02dde37c118a44f8cb267b56");
97 my $pk = Crypt::PK::ECC->new(\$der);
98 ok($pk->is_private, "ecc_set_key bug");
92 {
93 my $der = pack("H*", "3081be020101041500c78b055db0706fd86b5a15e14b9e51f0043d18f9a074307202010130200607".
94 "2a8648ce3d0101021500fffffffffffffffffffffffffffffffeffffac7330060401000401070429".
95 "043b4c382ce37aa192a4019e763036f4f5dd4d7ebb938cf935318fdced6bc28286531733c3f03c4f".
96 "ee02150100000000000000000001b8fa16dfab9aca16b6b3020101a12c032a00040ca9f03d79907c".
97 "97538177a3027970abefa351073a73120e1b5d2dab02dde37c118a44f8cb267b56");
98 my $pk = Crypt::PK::ECC->new(\$der);
99 ok($pk->is_private, "ecc_set_key bug");
100 }
101
102 ### der_length_custom_type bug:
103 {
104 my $der = pack("H*", "3081a8020101040e20df177a6f7e4bb9fecbd2d75b57a07f307d020101301a06072a8648ce3d0101".
105 "020f00db7c2abf62e35e668076bead208b3037040edb7c2abf62e35e668076bead2088040e659ef8".
106 "ba043916eede8911702b2203150000f50b028e4d696e676875615175290472783fb1040f02094872".
107 "39995a5ee76b55f9c2f098020f00db7c2abf62e35e7628dfac6561c5020101a11203100003a63510".
108 "5c5717812580408a3fd5ac");
109 my $pk = Crypt::PK::ECC->new(\$der);
110 ok($pk->is_private, "ecc_set_key bug");
111 }