1169d9 | 2004-05-02 | Martin Nilsson | | START_MARKER
|
fb517e | 2003-08-07 | Martin Nilsson | |
|
ab48b5 | 2004-02-06 | Martin Nilsson | | test_compile_error( H )
test_compile_error( S )
test_do( add_constant( "H", String.hex2string ) )
test_do( add_constant( "S", String.string2hex ) )
|
fb517e | 2003-08-07 | Martin Nilsson | |
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | cond_resolv( Nettle.Cipher, [[
test_true( programp(Crypto.Cipher) )
|
ce3d35 | 2003-12-06 | Martin Nilsson | | test_true( programp(Crypto.CipherState) )
test_true( programp(Crypto.HashState) )
]])
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | cond_resolv( Nettle.Cipher, [[
|
8d1fb4 | 2004-02-04 | Martin Nilsson | | test_any([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b1 = Crypto.AES.Buffer();
object b2 = Crypto.AES.Buffer();
|
8d1fb4 | 2004-02-04 | Martin Nilsson | | b1->set_encrypt_key("A"*32);
b2->set_decrypt_key("A"*32);
|
2693a9 | 2010-06-22 | Martin Nilsson | | foreach( ({ Crypto.PAD_SSL, Crypto.PAD_ISO_10126,
Crypto.PAD_ANSI_X923, Crypto.PAD_PKCS7,
|
82ba33 | 2014-03-26 | Martin Nilsson | | Crypto.PAD_ZERO, Crypto.PAD_TLS }), int m )
|
2693a9 | 2010-06-22 | Martin Nilsson | | {
for(int i=1; i<Crypto.AES->block_size(); i++) {
string p = "x"*i;
if(sizeof(b1->crypt(p))) error("Data returned (%O).\n", i);
string u = b2->unpad(b1->pad(m),m);
if(u!=p) error("Data differs (%O, %O, %O, %O).\n", m,i,u,p);
}
for(int i=Crypto.AES->block_size(); i<Crypto.AES->block_size()*3; i++) {
string p = "y"*i;
string x = b1->crypt(p);
string u = b2->unpad(x+b1->pad(m),m);
if(u!=p) error("Data differs (%O, %O, %O, %O).\n", m,i,u,p);
}
|
3b7b6e | 2010-06-06 | Martin Nilsson | | }
|
8d1fb4 | 2004-02-04 | Martin Nilsson | | return 1;
]], 1)
|
2693a9 | 2010-06-22 | Martin Nilsson | | test_any([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b1 = Crypto.AES.Buffer();
|
2693a9 | 2010-06-22 | Martin Nilsson | | object b2 = Crypto.AES();
b1->set_encrypt_key("A"*32);
b2->set_decrypt_key("A"*32);
if(sizeof(b1->crypt("AA"))) error("Data returned.\n");
string x = b1->pad();
return b2->crypt(x)[-1];
]], 13)
test_any([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b1 = Crypto.AES.Buffer();
|
2693a9 | 2010-06-22 | Martin Nilsson | | object b2 = Crypto.AES();
b1->set_encrypt_key("A"*32);
b2->set_decrypt_key("A"*32);
if(sizeof(b1->crypt("AA"))) error("Data returned.\n");
string x = b1->pad(Crypto.PAD_ISO_10126);
return b2->crypt(x)[-1];
]], 14)
test_eval_error([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b = Crypto.AES.Buffer();
|
2693a9 | 2010-06-22 | Martin Nilsson | | b->set_encrypt_key("A"*32);
b->crypt("AA\0");
b->pad(Crypto.PAD_ZERO);
]])
define(test_pad,[[
test_any([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b1 = Crypto.AES.Buffer();
|
2693a9 | 2010-06-22 | Martin Nilsson | | object b2 = Crypto.AES();
b1->set_encrypt_key("A"*32);
b2->set_decrypt_key("A"*32);
if(sizeof(b1->crypt("AA"))) error("Data returned.\n");
string x = b1->pad(Crypto.$1);
return b2->crypt(x);
]], $2)
]])
test_any([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b1 = Crypto.AES.Buffer();
|
2693a9 | 2010-06-22 | Martin Nilsson | | object b2 = Crypto.AES();
b1->set_encrypt_key("A"*32);
b2->set_decrypt_key("A"*32);
if(sizeof(b1->crypt("AA"))) error("Data returned.\n");
string x = b1->pad(Crypto.PAD_SSL);
string c = b2->crypt(x);
return sizeof(c)==Crypto.AES.block_size() &&
c[..1]=="AA" &&
c[-1]==13;
]], 1)
test_any([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b1 = Crypto.AES.Buffer();
|
2693a9 | 2010-06-22 | Martin Nilsson | | object b2 = Crypto.AES();
b1->set_encrypt_key("A"*32);
b2->set_decrypt_key("A"*32);
if(sizeof(b1->crypt("AA"))) error("Data returned.\n");
string x = b1->pad(Crypto.PAD_ISO_10126);
string c = b2->crypt(x);
return sizeof(c)==Crypto.AES.block_size() &&
c[..1]=="AA" &&
c[-1]==14;
]], 1)
test_pad(PAD_ANSI_X923, "AA"+"\0"*13+"\16")
test_pad(PAD_PKCS7, "AA"+"\16"*14)
test_pad(PAD_ZERO, "AA"+"\0"*14)
test_eval_error([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b = Crypto.AES.Buffer();
|
2693a9 | 2010-06-22 | Martin Nilsson | | b->set_encrypt_key("A"*32);
b->crypt("A\0");
b->pad(Crypto.PAD_ZERO);
]])
test_eval_error([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b = Crypto.AES.Buffer();
|
2693a9 | 2010-06-22 | Martin Nilsson | | b->set_encrypt_key("A"*32);
|
82ba33 | 2014-03-26 | Martin Nilsson | | b->pad(6);
|
2693a9 | 2010-06-22 | Martin Nilsson | | ]])
test_eval_error([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b = Crypto.AES.Buffer();
|
2693a9 | 2010-06-22 | Martin Nilsson | | b->set_decrypt_key("A"*32);
b->unpad("X"*(Crypto.AES.block_size()+1));
]])
|
0b1c3b | 2013-08-13 | Martin Nilsson | |
test_any([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b = Crypto.AES.CBC.Buffer();
|
0b1c3b | 2013-08-13 | Martin Nilsson | | b->set_encrypt_key("key "*4);
array a = ({});
for(int i; i<5; i++)
a += ({ b->crypt("12345") });
a += ({ b->pad(Crypto.PAD_PKCS7) });
return a*",";
]], [[",,,\355Gn@\346\213\373\34TX@2\0o\206\372,,\322\236\277\321\332\vK\213\344""6\341\202\265\275\333e"]])
test_any([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b = Crypto.AES.CBC.Buffer();
|
0b1c3b | 2013-08-13 | Martin Nilsson | | b->set_decrypt_key("key "*4);
array a = ({});
a += ({ b->crypt("\355Gn@\346\213\373\34TX") });
a += ({ b->crypt("@2\0o\206\372\322\236\277\321") });
a += ({ b->crypt("\332\vK\213\344""6\341\202\265\275") });
a += ({ b->unpad("\333e", Crypto.PAD_PKCS7) });
return a*",";
]],[[ ",1234512345123451,,234512345" ]])
|
8d1fb4 | 2004-02-04 | Martin Nilsson | | ]])
|
82ba33 | 2014-03-26 | Martin Nilsson | | test_any([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b = Crypto.AES.Buffer();
|
0bc742 | 2014-03-19 | Martin Nilsson | | b->set_decrypt_key("A"*16);
|
82ba33 | 2014-03-26 | Martin Nilsson | | return b->unpad("p\354v\251y8\351]B\367\254+\350G\257""5");
]], "AA")
|
392adf | 2014-03-27 | Martin Nilsson | | test_any([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b = Crypto.AES.Buffer();
|
0bc742 | 2014-03-19 | Martin Nilsson | | b->set_decrypt_key("A"*16);
|
392adf | 2014-03-27 | Martin Nilsson | | return b->unpad("\225\222\355<k\b$.\327\370\317b\236p-\245", Crypto.PAD_ANSI_X923);
]], 0)
test_any([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b = Crypto.AES.Buffer();
|
0bc742 | 2014-03-19 | Martin Nilsson | | b->set_decrypt_key("A"*16);
|
392adf | 2014-03-27 | Martin Nilsson | | return b->unpad("\362\237""7r\302% \360\276\201\316#<W4\231", Crypto.PAD_PKCS7);
]], 0)
test_any([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object b = Crypto.AES.Buffer();
|
82ba33 | 2014-03-26 | Martin Nilsson | | b->set_decrypt_key("A"*16);
|
392adf | 2014-03-27 | Martin Nilsson | | return b->unpad("p\354v\251y8\351]B\367\254+\350G\257""5", Crypto.PAD_TLS);
]], 0)
|
0bc742 | 2014-03-19 | Martin Nilsson | |
|
ee4c1d | 2003-12-03 | Martin Nilsson | | cond_resolv( Nettle.Yarrow, [[
|
4683cb | 2003-08-07 | Martin Nilsson | | test_eq( Nettle.Yarrow()->min_seed_size(), 32)
|
ac928c | 2009-07-02 | Henrik Grubbström (Grubba) | | ]])
cond( master()->resolv("Nettle.Yarrow")()->get_seed, [[
|
3cb171 | 2003-11-10 | Niels Möller | | test_eval_error( Nettle.Yarrow()->get_seed() )
|
ab48b5 | 2004-02-06 | Martin Nilsson | | test_eq( S(Nettle.Yarrow()->seed("\0"*32)->get_seed()),
|
ac928c | 2009-07-02 | Henrik Grubbström (Grubba) | | "200fe7972e93822621682027def987291e977e546fd879bd86643e5932123507" )
]])
cond_resolv( Nettle.Yarrow, [[
|
4683cb | 2003-08-07 | Martin Nilsson | | test_eq( Nettle.Yarrow()->is_seeded(), 0)
test_eq( Nettle.Yarrow()->seed("\0"*32)->is_seeded(), 1)
test_do( Nettle.Yarrow()->seed("\0"*32)->force_reseed() )
test_do( Nettle.Yarrow()->needed_sources(), 2 )
test_eq( Nettle.Yarrow()->seed("\0"*32)->random_string(0), "")
|
144c87 | 2014-06-20 | Martin Nilsson | | test_eq( Nettle.Yarrow()->seed("\0"*32)->random_string(1), " ")
|
ab48b5 | 2004-02-06 | Martin Nilsson | | test_eq( S(Nettle.Yarrow()->seed("\0"*32)->random_string(32)),
|
144c87 | 2014-06-20 | Martin Nilsson | | "200fe7972e93822621682027def987291e977e546fd879bd86643e5932123507" )
|
ab48b5 | 2004-02-06 | Martin Nilsson | | test_eq( S(Nettle.Yarrow(7)->seed("\0"*32)->random_string(32)),
|
144c87 | 2014-06-20 | Martin Nilsson | | "200fe7972e93822621682027def987291e977e546fd879bd86643e5932123507" )
|
ab48b5 | 2004-02-06 | Martin Nilsson | | test_eq( S(Nettle.Yarrow()->seed((string)enumerate(33))->random_string(32)),
|
144c87 | 2014-06-20 | Martin Nilsson | | "c63f6a753bf294272263e56282965dc35ef53f9799907761ecb2cd26633b4d0d" )
|
fb517e | 2003-08-07 | Martin Nilsson | | test_any([[
object r=Nettle.Yarrow(1)->seed("\0"*32);
r->update("\0"*32,0,0);
|
ab48b5 | 2004-02-06 | Martin Nilsson | | return S(r->random_string(32));
|
144c87 | 2014-06-20 | Martin Nilsson | | ]], "200fe7972e93822621682027def987291e977e546fd879bd86643e5932123507" )
|
fb517e | 2003-08-07 | Martin Nilsson | | test_any([[
object r=Nettle.Yarrow(1)->seed("\0"*32);
r->update("\0"*32,0,256);
|
ab48b5 | 2004-02-06 | Martin Nilsson | | return S(r->random_string(32));
|
144c87 | 2014-06-20 | Martin Nilsson | | ]], "c31e0ef2059db21e39ec0d0a0c1f790246eee47afc4054d752b20d64e494225d" )
|
352471 | 2015-05-26 | Martin Nilsson | | ]])
|
e6065d | 2003-03-19 | Martin Nilsson | |
|
ab48b5 | 2004-02-06 | Martin Nilsson | | // Crypto.Random
|
bd1ab8 | 2014-04-06 | Martin Nilsson | | cond_resolv( Nettle.Fortuna, [[
|
4683cb | 2003-08-07 | Martin Nilsson | | test_eq( sizeof( Crypto.Random.random_string(1) ), 1)
test_eq( sizeof( Crypto.Random.random_string(31) ), 31)
test_eq( sizeof( Crypto.Random.random_string(128) ), 128)
|
453a2b | 2014-04-05 | Martin Nilsson | | test_do( Crypto.Random.add_entropy("xy") )
|
4683cb | 2003-08-07 | Martin Nilsson | | ]])
|
3def13 | 2004-04-28 | Martin Nilsson | | test_do([[ Stdio.write_file("hash_me", "foo"*1000) ]])
|
b16fa4 | 2013-11-17 | Henrik Grubbström (Grubba) | | dnl hash, empty-digest, foo1000-digest, block-size
|
47fb08 | 2013-11-14 | Martin Nilsson | | define(test_hash, [[
|
b16fa4 | 2013-11-17 | Henrik Grubbström (Grubba) | | cond_resolv( Crypto.$1, [[
|
e1d4a6 | 2014-08-25 | Martin Nilsson | | test_eq(decode_value(encode_value(Crypto.$1)),Crypto.$1)
|
47fb08 | 2013-11-14 | Martin Nilsson | | test_eq(S(Crypto.$1()->update("")->digest()), "$2")
test_eq(S(Crypto.$1.hash("")), "$2")
|
268ddf | 2014-12-03 | Martin Nilsson | | test_eq(S(Crypto.$1.hash(Stdio.Buffer())), "$2")
|
d62792 | 2014-12-03 | Martin Nilsson | | test_eq(S(Crypto.$1.hash(Stdio.Buffer(),5)), "$2")
|
268ddf | 2014-12-03 | Martin Nilsson | | test_eq(S(Crypto.$1.hash(String.Buffer())), "$2")
|
d62792 | 2014-12-03 | Martin Nilsson | | test_eval_error(Crypto.$1.hash("\x2ff"))
|
47fb08 | 2013-11-14 | Martin Nilsson | | test_eq(S(Crypto.$1.hash("foo"*1000)), "$3")
|
268ddf | 2014-12-03 | Martin Nilsson | | test_eq(S(Crypto.$1.hash(Stdio.Buffer("foo"*1000))), "$3")
test_eq(S(Crypto.$1.hash(Stdio.Buffer("foo"*1001),3000)), "$3")
test_any([[
String.Buffer b=String.Buffer();
b->add("foo"*1000);
return S(Crypto.$1.hash(b));
]], "$3")
test_any([[
String.Buffer b=String.Buffer();
b->add("foo"*1001);
return S(Crypto.$1.hash(b,3000));
]], "$3")
|
d62792 | 2014-12-03 | Martin Nilsson | | test_eval_error([[
String.Buffer b=String.Buffer();
b->add("\x2ff");
return S(Crypto.$1.hash(b));
]], "$3")
|
268ddf | 2014-12-03 | Martin Nilsson | | test_any([[
System.Memory b=System.Memory(3000);
b->pwrite(0, "foo"*1000);
return S(Crypto.$1.hash(b));
]], "$3")
test_any([[
System.Memory b=System.Memory(3003);
b->pwrite(0, "foo"*1001);
return S(Crypto.$1.hash(b,3000));
]], "$3")
|
d62792 | 2014-12-03 | Martin Nilsson | | test_eval_error(Crypto.$1.hash(ADT.Queue()))
|
47fb08 | 2013-11-14 | Martin Nilsson | | test_eq(S(Crypto.$1()->update("foo"*501)->update("foo"*499)->digest()), "$3")
test_eq(S(Crypto.$1.hash(Stdio.File("hash_me"))), "$3")
test_eq(Crypto.$1.name(),lower_case("$1"))
test_eq(Crypto.$1.block_size(),$4)
dnl crypt_hash
dnl openssl_pbkdf
|
ceb8bb | 2013-11-30 | Martin Nilsson | | test_eq(S(Crypto.$1.pbkdf1("","",1,8)),"$2"[..15])
test_eq(Crypto.$1.pbkdf2("password","salt",1,Crypto.$1.digest_size()),
Crypto.HMAC(Crypto.$1)("password")("salt\0\0\0\1"))
|
4146ae | 2014-06-27 | Martin Nilsson | | dnl pkcs_hash_id
|
47fb08 | 2013-11-14 | Martin Nilsson | | test_eq(sizeof(Crypto.$1.hash("foo")),Crypto.$1.digest_size())
|
04440f | 2014-03-29 | Martin Nilsson | | test_eq(Crypto.$1.HMAC("x")->block_size(),Crypto.$1.block_size())
test_eq(Crypto.$1.HMAC("x")->digest_size(),Crypto.$1.digest_size())
|
c0f3f5 | 2013-11-21 | Martin Nilsson | | ]])
|
4146ae | 2014-06-27 | Martin Nilsson | | cond_resolv( Crypto.$1.pkcs_hash_id, [[
|
c0f3f5 | 2013-11-21 | Martin Nilsson | | test_any([[
return Standards.PKCS.Identifiers[lower_case("$1")+"_id"];
|
4146ae | 2014-06-27 | Martin Nilsson | | ]], Crypto.$1.pkcs_hash_id())
|
c0f3f5 | 2013-11-21 | Martin Nilsson | | ]])
]])
|
e6065d | 2003-03-19 | Martin Nilsson | |
|
47fb08 | 2013-11-14 | Martin Nilsson | | test_hash(MD2,
8350e5a3e24c153df2275c9f80692773,
f0d5fdb3351311b582e1174b39b94980,
16)
|
5799f7 | 2003-03-23 | Martin Nilsson | |
|
47fb08 | 2013-11-14 | Martin Nilsson | | test_hash(MD4,
31d6cfe0d16ae931b73c59d7e0c089c0,
5e45f623f3fdbdccc5c18280b8bf7c09,
64)
|
fb517e | 2003-08-07 | Martin Nilsson | |
|
47fb08 | 2013-11-14 | Martin Nilsson | | test_hash(MD5,
d41d8cd98f00b204e9800998ecf8427e,
3aee29ca9ce057ebe49629afcc3fb51f,
64)
|
fb517e | 2003-08-07 | Martin Nilsson | |
|
47fb08 | 2013-11-14 | Martin Nilsson | | test_hash(SHA1,
da39a3ee5e6b4b0d3255bfef95601890afd80709,
392f13661282d7d986722e8928391a99a007ab9a,
64)
|
fb517e | 2003-08-07 | Martin Nilsson | |
|
9f7d27 | 2013-11-19 | Martin Nilsson | | test_hash(SHA224,
d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f,
2c36c4cd7dcea7b483ae8789fb5c44ded9e3f9c05161418b251a3f35,
64)
|
47fb08 | 2013-11-14 | Martin Nilsson | | test_hash(SHA256,
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855,
8db466bdfc3265dd1347843b31ed34af0a0c2e6ff0fd4d6a5853755f0e68b8a0,
64)
|
fb517e | 2003-08-07 | Martin Nilsson | |
|
47fb08 | 2013-11-14 | Martin Nilsson | | test_hash(SHA384,
38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b,
c12cf7846a43e75df117644016d37e2b16425843eb0da80809c7a50502c8add4681f7dd08ec45ddf9b74baab80a3318b,
128)
test_hash(SHA512,
cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e,
a1846b033c0375279d20874cc3b311e4756ea01e615e9f9f12a90d3f91cb536a1472146faea917c3bc789c7363debd5beb31e5dee7d7b0b994ebdcc261e2e51d,
128)
test_hash(SHA3_224,
|
4bb7ac | 2016-02-22 | Henrik Grubbström (Grubba) | | 6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7,
6a88853b4477db1760fb5d0548320bbd79d9f2240514529a3069d487,
|
47fb08 | 2013-11-14 | Martin Nilsson | | 144)
test_hash(SHA3_256,
|
4bb7ac | 2016-02-22 | Henrik Grubbström (Grubba) | | a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a,
8099c2fdc96e0888ce7c3505987eecfa2613df0dd56aca4d2fb12dc3433eab18,
|
47fb08 | 2013-11-14 | Martin Nilsson | | 136)
test_hash(SHA3_384,
|
4bb7ac | 2016-02-22 | Henrik Grubbström (Grubba) | | 0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004,
25ce0149cd13628d4ce99dd13bf76bf5c653f5488dcde20ad75006eddf1b7c1f0d3525b3019d6b41bafff076e248b759,
|
47fb08 | 2013-11-14 | Martin Nilsson | | 104)
test_hash(SHA3_512,
|
4bb7ac | 2016-02-22 | Henrik Grubbström (Grubba) | | a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26,
230282ef578936ce751ff954583e93f358a6a74f0f769038c22ba5138f32bb530a08872b31b29cf98f057c66bdcc4132848298d284167dc04ed901354b122035,
|
47fb08 | 2013-11-14 | Martin Nilsson | | 72)
|
fb517e | 2003-08-07 | Martin Nilsson | |
|
dcb280 | 2013-11-30 | Martin Nilsson | | test_hash(GOST94,
ce85b99cc46752fffee35cab9a7b0278abb4c2d2055cff685af4912c49490f8d,
777087cc7fbf49feaac18bc05289e4b75e6803c05c9f71a01708a7c225e8d636,
32)
test_hash(RIPEMD160,
9c1185a5c5e9fc54612808977ee8f548b2258d31,
d5c4507e4743056d4b0341fd27ffac3686b1202d,
64)
|
3def13 | 2004-04-28 | Martin Nilsson | | test_do([[ rm("hash_me") ]])
|
fb517e | 2003-08-07 | Martin Nilsson | |
|
ceb8bb | 2013-11-30 | Martin Nilsson | | // PBKDF
test_eq(S(Crypto.SHA1.pbkdf1("password","salt",1000,20)),
"4a8fd48e426ed081b535be5769892fa396293efb")
test_eval_error(Crypto.SHA1.pbkdf1("password","salt",1000,21))
dnl tests from RFC 6070
test_eq(S(Crypto.SHA1.pbkdf2("password","salt",1,20)),
"0c 60 c8 0f 96 1f 0e 71 f3 a9 b5 24 af 60 12 06 2f e0 37 a6"-" ")
test_eq(S(Crypto.SHA1.pbkdf2("password","salt",2,20)),
"ea 6c 01 4d c7 2d 6f 8c cd 1e d9 2a ce 1d 41 f0 d8 de 89 57"-" ")
test_eq(S(Crypto.SHA1.pbkdf2("password","salt",4096,20)),
"4b 00 79 01 b7 65 48 9a be ad 49 d9 26 f7 21 d0 65 a4 29 c1"-" ")
test_eq(S(Crypto.SHA1.pbkdf2("passwordPASSWORDpassword",
"saltSALTsaltSALTsaltSALTsaltSALTsalt",4096,25)),
"3d 2e ec 4f e4 1c 84 9b 80 c8 d8 36 62 c0 e4 4a 8b 29 1a 96 4c f2 f0 70 38"-" ")
test_eq(S(Crypto.SHA1.pbkdf2("pass\0word","sa\0lt",4096,16)),
"56 fa 6a a7 55 48 09 9d cc 37 d7 f0 34 25 e0 c3"-" ")
|
e01ef3 | 2016-01-15 | Martin Nilsson | | // HOTP
test_eq(Crypto.SHA1.hotp("12345678901234567890",0),755224)
test_eq(Crypto.SHA1.hotp("12345678901234567890",1),287082)
test_eq(Crypto.SHA1.hotp("12345678901234567890",2),359152)
test_eq(Crypto.SHA1.hotp("12345678901234567890",3),969429)
test_eq(Crypto.SHA1.hotp("12345678901234567890",4),338314)
test_eq(Crypto.SHA1.hotp("12345678901234567890",5),254676)
test_eq(Crypto.SHA1.hotp("12345678901234567890",6),287922)
test_eq(Crypto.SHA1.hotp("12345678901234567890",7),162583)
test_eq(Crypto.SHA1.hotp("12345678901234567890",8),399871)
test_eq(Crypto.SHA1.hotp("12345678901234567890",9),520489)
dnl From RFC6238
test_eq(Crypto.SHA1.hotp("12345678901234567890",1,8),94287082)
test_eq(Crypto.SHA256.hotp("12345678901234567890123456789012",1,8),46119246)
test_eq(Crypto.SHA512.hotp("1234567890123456789012345678901234567890123456789012345678901234",1,8),90693936)
|
ab48b5 | 2004-02-06 | Martin Nilsson | | // Crypto.DES
|
4d6595 | 2013-10-21 | Henrik Grubbström (Grubba) | | cond_resolv( Nettle.DES, [[
|
9569e6 | 2003-10-05 | Henrik Grubbström (Grubba) | | test_eq( Crypto.DES.fix_parity("\xff"*8), "\xfe"*8 )
|
e2d582 | 2003-11-29 | Martin Nilsson | | test_eq( Crypto.DES.fix_parity("\xff"*9), "\xfe"*8 )
|
9569e6 | 2003-10-05 | Henrik Grubbström (Grubba) | | test_eq( Crypto.DES.fix_parity("12345678"), "12244778" )
test_eq( Crypto.DES.fix_parity("\xff"*7), "\xfe"*8 )
test_eq( Crypto.DES.fix_parity("\1"*7), "\1\200\100\40\20\10\4\2")
|
e2d582 | 2003-11-29 | Martin Nilsson | | test_eval_error( Crypto.DES.fix_parity("123456") )
|
9569e6 | 2003-10-05 | Henrik Grubbström (Grubba) | | ]])
|
217615 | 2003-10-05 | Martin Nilsson | |
|
daac24 | 2003-10-10 | Martin Nilsson | |
|
ab48b5 | 2004-02-06 | Martin Nilsson | | // Crypto.DES3
|
4d6595 | 2013-10-21 | Henrik Grubbström (Grubba) | | cond_resolv( Nettle.DES3, [[
|
e2d582 | 2003-11-29 | Martin Nilsson | | test_eq( Crypto.DES3.fix_parity("\xff"*8*3), "\xfe"*8*3 )
test_eq( Crypto.DES3.fix_parity("\xff"*(8*3+1)), "\xfe"*8*3 )
test_eq( Crypto.DES3.fix_parity("12345678"*3), "12244778"*3 )
test_eq( Crypto.DES3.fix_parity("\xff"*7*3), "\xfe"*8*3 )
test_eq( Crypto.DES3.fix_parity("\1"*7*3), "\1\200\100\40\20\10\4\2"*3)
test_eval_error( Crypto.DES3.fix_parity("x"*20) )
test_eval_error( Crypto.DES3.fix_parity("x"*22) )
test_eval_error( Crypto.DES3.fix_parity("x"*23) )
|
254e24 | 2003-11-29 | Martin Nilsson | | test_eq( Crypto.DES3()->set_encrypt_key( "1234567qwertyu" )->crypt("AAAAAAAA"), String.hex2string("5c9a0edce113b184") )
dnl test_eq( Crypto.DES3()->set_encrypt_key( "12345678qwertyui" )->crypt("AAAAAAAA"), String.hex2string("fc516e07b34afe5a") )
test_eq( Crypto.DES3()->set_encrypt_key( "1234567qwertyuASDFGHJ" )->crypt("AAAAAAAA"), String.hex2string("b3341af18e541949") )
test_eq( Crypto.DES3()->set_encrypt_key( Crypto.DES3->fix_parity("12345678qwertyuiASDFGHJK") )->crypt("AAAAAAAA"), String.hex2string("1890fdeffda200b4") )
|
daac24 | 2003-10-10 | Martin Nilsson | | ]])
|
3fe79d | 2003-11-28 | Martin Nilsson | | define(test_cipher,[[
|
db2045 | 2003-12-03 | Martin Nilsson | | cond_resolv( Crypto.$1.name,[[
|
4f1a22 | 2003-11-29 | Martin Nilsson | | test_eq( Crypto.$1->name(), "$2" )
test_eq( Crypto.$1()->block_size(), Crypto.$1->block_size() )
test_eq( sizeof(Crypto.$1()->make_key()), Crypto.$1->key_size() )
|
3fe79d | 2003-11-28 | Martin Nilsson | | test_any([[
object c=Crypto.$1();
c->make_key();
return sizeof(c->crypt("A"*c->block_size()));
|
4f1a22 | 2003-11-29 | Martin Nilsson | | ]], Crypto.$1->block_size() )
|
ce3e47 | 2013-10-26 | Martin Nilsson | | test_any([[
object o=Crypto.$1();
|
b35b5b | 2016-04-27 | Martin Nilsson | | function real_random_string = random_string;
add_constant("random_string", Random.Deterministic(1234)->random_string);
|
ce3e47 | 2013-10-26 | Martin Nilsson | | string k=o->make_key();
|
b35b5b | 2016-04-27 | Martin Nilsson | | add_constant("random_string", real_random_string);
|
ce3e47 | 2013-10-26 | Martin Nilsson | | o=Crypto.$1();
o->set_encrypt_key(k);
string c = o->crypt("A"*o->block_size());
o=Crypto.$1();
o->set_decrypt_key(k);
return o->crypt(c) == "A"*o->block_size();
]], 1 )
|
e2d582 | 2003-11-29 | Martin Nilsson | | test_eval_error([[
object c=Crypto.$1();
if(c->block_size()==1) throw(1);
c->make_key();
c->crypt("A"*c->block_size()+1);
]])
test_eval_error([[
object c=Crypto.$1();
c->make_key();
c->crypt("\500"*c->block_size());
]])
|
ce3e47 | 2013-10-26 | Martin Nilsson | | test_eval_error(Crypto.$1()->set_encrypt_key("")))
test_eval_error(Crypto.$1()->set_decrypt_key("")))
test_eval_error((<"Arcfour","Blowfish">)["$1"]?throw(1):Crypto.$1()->set_decrypt_key("A"*(Crypto.$1->key_size()+1)))
|
e2d582 | 2003-11-29 | Martin Nilsson | | test_eval_error(Crypto.$1()->set_decrypt_key("\500"*Crypto.$1->key_size()))
test_eval_error(Crypto.$1()->crypt();)
|
3fe79d | 2003-11-28 | Martin Nilsson | | ]])]])
|
4f1a22 | 2003-11-29 | Martin Nilsson | | test_cipher(AES,aes)
|
95aaa8 | 2003-12-03 | Martin Nilsson | | test_cipher(Arcfour,arcfour)
test_cipher(Blowfish,blowfish)
|
988c20 | 2013-12-02 | Martin Nilsson | | test_cipher(Camellia,camellia)
|
4f1a22 | 2003-11-29 | Martin Nilsson | | test_cipher(CAST,cast128)
test_cipher(DES,des)
test_cipher(DES3,des3)
test_cipher(IDEA,idea)
|
f3b8d4 | 2013-11-12 | Martin Nilsson | | test_cipher(SALSA20,salsa20)
|
95aaa8 | 2003-12-03 | Martin Nilsson | | test_cipher(Serpent,serpent)
test_cipher(Twofish,twofish)
|
4f1a22 | 2003-11-29 | Martin Nilsson | |
|
542b18 | 2014-03-17 | Henrik Grubbström (Grubba) | | dnl class, wrapped, key, iv, associated_data, payload, crypt_text, dsize
define(test_aead, [[
cond_resolv( Crypto.$1.name,[[
test_any([[
object c = Crypto.$1(Crypto.$2);
c->set_encrypt_key(String.hex2string($3));
c->set_iv(String.hex2string($4));
c->update(String.hex2string($5));
return c->crypt(String.hex2string($6)) + c->digest($8);
]], String.hex2string($7))
test_any([[
object c = Crypto.$1(Crypto.$2);
c->set_decrypt_key(String.hex2string($3));
c->set_iv(String.hex2string($4));
c->update(String.hex2string($5));
return c->crypt(String.hex2string($7)[..<$8]) + c->digest($8);
]], String.hex2string($6) + String.hex2string($7)[<$8-1..])
]])]])
// Crypto.CCM
dnl NIST SP800-38C C1
test_aead(CCM, AES, "404142434445464748494a4b4c4d4e4f", "10111213141516",
"0001020304050607", "20212223", "7162015b4dac255d", 4)
dnl NIST SP800-38C C2
test_aead(CCM, AES, "404142434445464748494a4b4c4d4e4f", "1011121314151617",
"000102030405060708090a0b0c0d0e0f",
"202122232425262728292a2b2c2d2e2f",
"d2a1f0e051ea5f62081a7792073d593d1fc64fbfaccd", 6)
dnl NIST SP800-38C C3
test_aead(CCM, AES, "404142434445464748494a4b4c4d4e4f",
"101112131415161718191a1b",
"000102030405060708090a0b0c0d0e0f10111213",
"202122232425262728292a2b2c2d2e2f3031323334353637",
"e3b201a9f5b71a7a9b1ceaeccd97e70b6176aad9a4428aa5484392fbc1b09951", 8)
dnl NIST SP800-38C C4
test_aead(CCM, AES, "404142434445464748494a4b4c4d4e4f",
"101112131415161718191a1b1c",
"000102030405060708090a0b0c0d0e0f"
"101112131415161718191a1b1c1d1e1f"
"202122232425262728292a2b2c2d2e2f"
"303132333435363738393a3b3c3d3e3f"
"404142434445464748494a4b4c4d4e4f"
"505152535455565758595a5b5c5d5e5f"
"606162636465666768696a6b6c6d6e6f"
"707172737475767778797a7b7c7d7e7f"
"808182838485868788898a8b8c8d8e8f"
"909192939495969798999a9b9c9d9e9f"
"a0a1a2a3a4a5a6a7a8a9aaabacadaeaf"
"b0b1b2b3b4b5b6b7b8b9babbbcbdbebf"
"c0c1c2c3c4c5c6c7c8c9cacbcccdcecf"
"d0d1d2d3d4d5d6d7d8d9dadbdcdddedf"
"e0e1e2e3e4e5e6e7e8e9eaebecedeeef"
"f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff" * 256,
"202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f",
"69915dad1e84c6376a68c2967e4dab615ae0fd1faec44cc484828529463ccf72"
"b4ac6bec93e8598e7f0dadbcea5b", 14)
|
daac24 | 2003-10-10 | Martin Nilsson | |
|
ab48b5 | 2004-02-06 | Martin Nilsson | | // Crypto.RSA
|
b3e4a0 | 2013-10-28 | Martin Nilsson | |
test_do([[
#pike 7.8
add_constant("RSA", Crypto.RSA()) ]])
test_do( RSA->generate_key(1024) )
test_equal( RSA->cooked_get_n(), RSA->get_n()->digits(256) )
test_equal( RSA->cooked_get_e(), RSA->get_e()->digits(256) )
test_equal( RSA->cooked_get_d(), RSA->get_d()->digits(256) )
test_equal( RSA->cooked_get_p(), RSA->get_p()->digits(256) )
test_equal( RSA->cooked_get_q(), RSA->get_q()->digits(256) )
test_true( RSA->sha_verify("hej", RSA->sha_sign("hej")) )
test_false( RSA->sha_verify("hoj", RSA->sha_sign("hej")) )
test_true( RSA->md5_verify("hej", RSA->md5_sign("hej")) )
test_false( RSA->md5_verify("hoj", RSA->md5_sign("hej")) )
test_eq( RSA->query_blocksize(), 125 )
test_eq( RSA->rsa_size(), 1024 )
test_do( add_constant("RSA") )
|
ab48b5 | 2004-02-06 | Martin Nilsson | | test_do( add_constant("RSA", Crypto.RSA()) )
|
5799f7 | 2003-03-23 | Martin Nilsson | | test_do( RSA->generate_key(1024) )
test_equal( RSA->raw_sign("hej"), RSA->raw_sign("hej") )
|
604735 | 2003-03-24 | Martin Nilsson | | test_true( RSA->raw_verify("tjo", RSA->raw_sign("tjo")) )
|
5799f7 | 2003-03-23 | Martin Nilsson | | test_equal( RSA->get_n(), RSA->get_n() )
test_true( functionp(RSA->get_n()->gcdext2) )
test_equal( RSA->get_e(), RSA->get_e() )
test_true( functionp(RSA->get_e()->gcdext2) )
test_equal( RSA->get_d(), RSA->get_d() )
test_true( functionp(RSA->get_d()->gcdext2) )
test_equal( RSA->get_p(), RSA->get_p() )
test_true( functionp(RSA->get_p()->gcdext2) )
test_equal( RSA->get_q(), RSA->get_q() )
test_true( functionp(RSA->get_q()->gcdext2) )
|
ab48b5 | 2004-02-06 | Martin Nilsson | | test_do( add_constant("RSB", Crypto.RSA()) )
|
5799f7 | 2003-03-23 | Martin Nilsson | | test_do( RSB->set_private_key(RSA->get_d(),
({ RSA->get_p(), RSA->get_q() }) ) )
test_equal( RSA->get_d(), RSB->get_d() )
test_equal( RSA->get_p(), RSB->get_p() )
test_equal( RSA->get_q(), RSB->get_q() )
|
ed89d1 | 2013-10-21 | Martin Nilsson | | cond_resolv( Nettle.MD2, [[
|
9581ed | 2013-11-22 | Martin Nilsson | | test_true([[ RSA->pkcs_verify("hej", Crypto.MD2, RSB->pkcs_sign("hej", Crypto.MD2)) ]])
|
4abdf2 | 2008-05-16 | Henrik Grubbström (Grubba) | | ]])
|
ed89d1 | 2013-10-21 | Martin Nilsson | | cond_resolv( Nettle.MD4, [[
|
9581ed | 2013-11-22 | Martin Nilsson | | test_true([[ RSA->pkcs_verify("hej", Crypto.MD4, RSB->pkcs_sign("hej", Crypto.MD4)) ]])
|
4abdf2 | 2008-05-16 | Henrik Grubbström (Grubba) | | ]])
|
9581ed | 2013-11-22 | Martin Nilsson | | test_true([[ RSA->pkcs_verify("hej", Crypto.MD5, RSB->pkcs_sign("hej", Crypto.MD5)) ]])
test_true([[ RSA->pkcs_verify("hej", Crypto.SHA1, RSB->pkcs_sign("hej", Crypto.SHA1)) ]])
|
9b843b | 2014-01-03 | Martin Nilsson | | cond_resolv( Nettle.SHA256, [[
test_true([[ RSA->pkcs_verify("hej", Crypto.SHA256, RSB->pkcs_sign("hej", Crypto.SHA256)) ]])
]])
|
9581ed | 2013-11-22 | Martin Nilsson | | test_false([[ RSA->pkcs_verify("hoj", Crypto.MD5, RSB->pkcs_sign("hej", Crypto.MD5)) ]])
|
5799f7 | 2003-03-23 | Martin Nilsson | | test_do( add_constant("RSA") )
test_do( add_constant("RSB") )
|
ab48b5 | 2004-02-06 | Martin Nilsson | | test_do( add_constant("RSA", Crypto.RSA()) )
|
5799f7 | 2003-03-23 | Martin Nilsson | | test_true( RSA->set_public_key(
0x838b848334d4f2151d25971e655eed8a0905cb5b81ba9047db2bf3b56765b058fa9af2ad89a2726233fc8917e52e8966db4bae5d426207f98ab50e1467accb2d,
65537) )
test_true( RSA->set_private_key(
0x3f8a1cafe3cd1841ea9a45ac80faa172937921094a587b68ba0d38e2ded6d79ef1a5b8d9605278ddc61616f12fbb9dc6dbdea50f9dc4a51f6a8ed30ada7c9301,
({ 0xae01268cb370af44cb05e9618ea6681dae1186bd746d3aa6122b8bf6c2290619,
0xc1884f35667fb5ea3e8e7cfa052bb34894c2970b3da6a0650182fe514b23c835 })) )
|
b3e4a0 | 2013-10-28 | Martin Nilsson | | test_eq( RSA->block_size(), 61 )
|
0f80fb | 2014-09-07 | Martin Nilsson | | test_eq( S(RSA->pkcs_sign("\0", Crypto.SHA1)), "06e10d3bffa8a8f84f0fe1425453a553ac00f429771814c97eb649acd27bd50b89a31a8aa40aceebfb681b9337fc6c863ae544a46d480882c11639b6fd123dd5" )
test_eq( S(RSA->pkcs_sign(Gmp.mpz(331)->digits(256), Crypto.SHA1)), "00fd12bb2966d3059f74c3ce9da8a4430f7597dc96d137222bce32cf74cd0a05edd5eaccf92c607b75a4920444d8747de22bd04905267664dee7408c421d0056" )
|
b3e4a0 | 2013-10-28 | Martin Nilsson | | test_true( RSA->raw_verify("fl\0rpzprutt",RSA->raw_sign("fl\0rpzprutt")) )
test_false( RSA->raw_verify("fl\0rpzputt",RSA->raw_sign("fl\0rpzprutt")) )
|
566265 | 2014-07-25 | Martin Nilsson | | test_eq( RSA->decrypt(RSA->encrypt("fl\0rpzprutt")), "fl\0rpzprutt" )
|
b3e4a0 | 2013-10-28 | Martin Nilsson | | test_eq( RSA->key_size(), 512 )
|
5799f7 | 2003-03-23 | Martin Nilsson | | test_true( RSA->public_key_equal(RSA) )
|
ab48b5 | 2004-02-06 | Martin Nilsson | | test_false( RSA->public_key_equal(Crypto.RSA()->generate_key(512)) )
|
5799f7 | 2003-03-23 | Martin Nilsson | |
|
60afeb | 2014-04-02 | Martin Nilsson | | test_do( RSA->set_random(random_string); )
|
c49a32 | 2013-11-29 | Martin Nilsson | | test_eval_error( RSA->generate_key(88); )
|
a2ecce | 2014-10-20 | Martin Nilsson | | test_do( RSA->generate_key(489); )
test_eval_error( RSA->generate_key(489, 6); )
test_eval_error( RSA->generate_key(489, 1); )
test_eval_error( RSA->generate_key(489, (1<<128)+1); )
test_do( RSA->generate_key(489, 5); )
|
1be0e3 | 2014-10-20 | Martin Nilsson | | test_do( RSA->rsa_pad("x"*51,1); )
test_eval_error( RSA->rsa_pad("x"*52,1); )
dnl This is rsa->pad("x"*51,2)
test_eq( RSA->rsa_unpad(Gmp.mpz(8653122978089085258180412110456916522630219813380302393826135590094230922558301290311148252831586181145986834552965198025012975236458341391807284),2),
|
9b843b | 2014-01-03 | Martin Nilsson | | " 1234" )
|
1be0e3 | 2014-10-20 | Martin Nilsson | | dnl Same as above, but use the wrong type when unpadding.
test_eq( RSA->rsa_unpad(Gmp.mpz(8653122978089085258180412110456916522630219813380302393826135590094230922558301290311148252831586181145986834552965198025012975236458341391807284),1), 0 )
dnl Same as above, but one digit to few.
test_eq( RSA->rsa_unpad(Gmp.mpz(865312297808908525818041211045691652263021981338030239382613559009423092255830129031114825283158618114598683455296519802501297523645834139180728),2), 0 )
|
c49a32 | 2013-11-29 | Martin Nilsson | | test_do( add_constant("RSA") )
|
5799f7 | 2003-03-23 | Martin Nilsson | |
|
1620bf | 2016-05-06 | Martin Nilsson | | test_eq(Crypto.SHA256.HMAC.jwa(), "HS256")
|
7a2913 | 2016-04-20 | Martin Nilsson | | cond_resolv( Crypto.SHA384, [[
|
1620bf | 2016-05-06 | Martin Nilsson | | test_eq(Crypto.SHA384.HMAC.jwa(), "HS384")
|
7a2913 | 2016-04-20 | Martin Nilsson | | ]])
cond_resolv( Crypto.SHA512, [[
|
1620bf | 2016-05-06 | Martin Nilsson | | test_eq(Crypto.SHA512.HMAC.jwa(), "HS512")
|
7a2913 | 2016-04-20 | Martin Nilsson | | ]])
|
f00dae | 2016-05-04 | Henrik Grubbström (Grubba) | | // Hash, Key, JWS
define(test_jws_hmac, [[
test_do( add_constant("TEST_JWK", $1.HMAC(MIME.decode_base64url($2 - "\n" - "\r"))) )
test_equal( TEST_JWK->jose_decode($3 - "\n" - "\r"),
({ Standards.JSON.decode(MIME.decode_base64url((($3 - "\n" - "\r")/".")[0])),
MIME.decode_base64url((($3 - "\n" - "\r")/".")[1]) })
)
test_false( TEST_JWK->jose_decode(($3 - "\n" - "\r")[..<4] + "55Rw") )
// NB: As we use mappings to represent the headers, it is not
// deterministic what the order of the fields will be. It
// is also possible that there may be other JSON formatting
// differences.
test_equal( TEST_JWK->jose_decode(TEST_JWK->jose_sign(MIME.decode_base64url((($3 - "\n" - "\r")/".")[1]),
([ "typ": "JWT" ]))),
({ Standards.JSON.decode(MIME.decode_base64url((($3 - "\n" - "\r")/".")[0])),
MIME.decode_base64url((($3 - "\n" - "\r")/".")[1]) })
)
test_do( add_constant("TEST_JWK") )
]])
// RFC 7515 A.1.1
test_jws_hmac(Crypto.SHA256,
#"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75
aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow",
#"eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9
.
eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt
cGxlLmNvbS9pc19yb290Ijp0cnVlfQ
.
dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk")
|
8bacc3 | 2016-04-19 | Henrik Grubbström (Grubba) | | // Sign, Hash, Public key (n, e), Private key (d), JWS
define(test_jws, [[
test_do( add_constant("TEST_JWK", $1()) )
test_do( TEST_JWK->set_public_key(@map(map($3, MIME.decode_base64url),
Gmp.mpz, 256)) )
test_do( TEST_JWK->set_private_key(Gmp.mpz(MIME.decode_base64url($4), 256)) )
test_equal( TEST_JWK->jose_decode($5 - "\n" - "\r"),
({ Standards.JSON.decode(MIME.decode_base64url((($5 - "\n" -"\r")/".")[0])),
MIME.decode_base64url((($5 - "\n" - "\r")/".")[1]) })
)
test_false( TEST_JWK->jose_decode(($5 - "\n" - "\r")[..<4] + "55Rw") )
// NB: Eg Crypto.ECC.SECP_256R1.ECDSA uses random numbers
// for signatures, and the random numbers used in the
// test vectors are not known, so we validate that
// the signature is correct by decoding it, as we've
// validated that the decoder works correctly above.
test_equal( TEST_JWK->jose_decode(TEST_JWK->jose_sign(MIME.decode_base64url((($5 - "\n" - "\r")/".")[1]), UNDEFINED, $2)),
({ Standards.JSON.decode(MIME.decode_base64url((($5 - "\n" -"\r")/".")[0])),
MIME.decode_base64url((($5 - "\n" - "\r")/".")[1]) })
)
test_do( add_constant("TEST_JWK") )
]])
// RFC 7515 A.2.1
test_jws(Crypto.RSA, Crypto.SHA256,
({ #"ofgWCuLjybRlzo0tZWJjNiuSfb4p4fAkd_wWJcyQoTbji9k0l8W26mPddx
HmfHQp-Vaw-4qPCJrcS2mJPMEzP1Pt0Bm4d4QlL-yRT-SFd2lZS-pCgNMs
D1W_YpRPEwOWvG6b32690r2jZ47soMZo9wGzjb_7OMg0LOL-bSf63kpaSH
SXndS5z5rexMdbBYUsLA9e-KXBdQOS-UTo7WTBEMa2R2CapHg665xsmtdV
MTBQY4uDZlxvb3qCo5ZwKh9kG4LT6_I5IhlJH7aGhyxXFvUK-DWNmoudF8
NAco9_h9iaGNj8q2ethFkMLs91kzk2PAcDTW9gb54h4FRWyuXpoQ",
"AQAB" }),
#"Eq5xpGnNCivDflJsRQBXHx1hdR1k6Ulwe2JZD50LpXyWPEAeP88vLNO97I
jlA7_GQ5sLKMgvfTeXZx9SE-7YwVol2NXOoAJe46sui395IW_GO-pWJ1O0
BkTGoVEn2bKVRUCgu-GjBVaYLU6f3l9kJfFNS3E0QbVdxzubSu3Mkqzjkn
439X0M_V51gfpRLI9JYanrC4D4qAdGcopV_0ZHHzQlBjudU2QvXt4ehNYT
CBr6XCLQUShb1juUO1ZdiYoFaFQT5Tw8bGUl_x_jTj3ccPDVZFD9pIuhLh
BOneufuBiB4cS98l2SR_RQyGWSeWjnczT0QU91p1DhOVRuOopznQ",
#"eyJhbGciOiJSUzI1NiJ9
.
eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt
cGxlLmNvbS9pc19yb290Ijp0cnVlfQ
.
cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZmh7
AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjbKBYNX4
BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHlb1L07Qe7K
0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZESc6BfI7noOPqv
hJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrB
p0igcN_IoypGlUPQGe77Rw")
cond_resolv(Crypto.ECC.SECP_256R1, [[
test_jws(Crypto.ECC.SECP_256R1.ECDSA, UNDEFINED,
({ "f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU",
"x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0" }),
"jpsQnnGQmL-YBIffH1136cspYG6-0iY7X1fCE9-E9LI",
#"eyJhbGciOiJFUzI1NiJ9
.
eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt
cGxlLmNvbS9pc19yb290Ijp0cnVlfQ
.
DtEhU3ljbEg8L38VWAfUAqOyKAM6-Xx-F4GawxaepmXFCgfTjDxw5djxLa8ISlSA
pmWQxfKTUJqPP3-Kg6NU1Q")
]])
|
173c06 | 2015-11-09 | Henrik Grubbström (Grubba) | | // RSASSA-PSS
// Modulo (n), Exponent (e), Private Key (d), Message, Salt, Hash, Signature
define(test_pss, [[
test_do( add_constant("RSA", Crypto.RSA()) )
|
1bf7fc | 2015-12-01 | Martin Nilsson | | test_do( RSA->set_public_key(Gmp.mpz(H(#"$1"), 256),
Gmp.mpz(H(#"$2"), 256)) )
test_do( RSA->set_private_key(Gmp.mpz(H(#"$3"), 256)) )
test_do( add_constant("M", H(#"$4")) )
test_eq( RSA.PSS.pkcs_sign(M, $6, H(#"$5")),
H(#"$7") )
test_true( RSA.PSS.pkcs_verify(M, $6, H(#"$7"),
sizeof(H(#"$5"))) )
|
173c06 | 2015-11-09 | Henrik Grubbström (Grubba) | | test_do( add_constant("M") )
test_do( add_constant("RSA") )
]])
// Vectors from RSA Labs.
// RSASSA-PSS Signature Example 1.1
test_pss(
a5 6e 4a 0e 70 10 17 58 9a 51 87 dc 7e a8 41 d1
56 f2 ec 0e 36 ad 52 a4 4d fe b1 e6 1f 7a d9 91
d8 c5 10 56 ff ed b1 62 b4 c0 f2 83 a1 2a 88 a3
94 df f5 26 ab 72 91 cb b3 07 ce ab fc e0 b1 df
d5 cd 95 08 09 6d 5b 2b 8b 6d f5 d6 71 ef 63 77
c0 92 1c b2 3c 27 0a 70 e2 59 8e 6f f8 9d 19 f1
05 ac c2 d3 f0 cb 35 f2 92 80 e1 38 6b 6f 64 c4
ef 22 e1 e1 f2 0d 0c e8 cf fb 22 49 bd 9a 21 37,
01 00 01,
33 a5 04 2a 90 b2 7d 4f 54 51 ca 9b bb d0 b4 47
71 a1 01 af 88 43 40 ae f9 88 5f 2a 4b be 92 e8
94 a7 24 ac 3c 56 8c 8f 97 85 3a d0 7c 02 66 c8
c6 a3 ca 09 29 f1 e8 f1 12 31 88 44 29 fc 4d 9a
e5 5f ee 89 6a 10 ce 70 7c 3e d7 e7 34 e4 47 27
a3 95 74 50 1a 53 26 83 10 9c 2a ba ca ba 28 3c
31 b4 bd 2f 53 c3 ee 37 e3 52 ce e3 4f 9e 50 3b
d8 0c 06 22 ad 79 c6 dc ee 88 35 47 c6 a3 b3 25,
cd c8 7d a2 23 d7 86 df 3b 45 e0 bb bc 72 13 26
d1 ee 2a f8 06 cc 31 54 75 cc 6f 0d 9c 66 e1 b6
23 71 d4 5c e2 39 2e 1a c9 28 44 c3 10 10 2f 15
6a 0d 8d 52 c1 f4 c4 0b a3 aa 65 09 57 86 cb 76
97 57 a6 56 3b a9 58 fe d0 bc c9 84 e8 b5 17 a3
d5 f5 15 b2 3b 8a 41 e7 4a a8 67 69 3f 90 df b0
61 a6 e8 6d fa ae e6 44 72 c0 0e 5f 20 94 57 29
cb eb e7 7f 06 ce 78 e0 8f 40 98 fb a4 1f 9d 61
93 c0 31 7e 8b 60 d4 b6 08 4a cb 42 d2 9e 38 08
a3 bc 37 2d 85 e3 31 17 0f cb f7 cc 72 d0 b7 1c
29 66 48 b3 a4 d1 0f 41 62 95 d0 80 7a a6 25 ca
b2 74 4f d9 ea 8f d2 23 c4 25 37 02 98 28 bd 16
be 02 54 6f 13 0f d2 e3 3b 93 6d 26 76 e0 8a ed
1b 73 31 8b 75 0a 01 67 d0,
de e9 59 c7 e0 64 11 36 14 20 ff 80 18 5e d5 7f
3e 67 76 af,
Crypto.SHA1,
90 74 30 8f b5 98 e9 70 1b 22 94 38 8e 52 f9 71
fa ac 2b 60 a5 14 5a f1 85 df 52 87 b5 ed 28 87
e5 7c e7 fd 44 dc 86 34 e4 07 c8 e0 e4 36 0b c2
26 f3 ec 22 7f 9d 9e 54 63 8e 8d 31 f5 05 12 15
df 6e bb 9c 2f 95 79 aa 77 59 8a 38 f9 14 b5 b9
c1 bd 83 c4 e2 f9 f3 82 a0 d0 aa 35 42 ff ee 65
98 4a 60 1b c6 9e b2 8d eb 27 dc a1 2c 82 c2 d4
c3 f6 6c d5 00 f1 ff 2b 99 4d 8a 4e 30 cb b3 3c)
// RSASSA-PSS Signature Example 1.2
test_pss(
a5 6e 4a 0e 70 10 17 58 9a 51 87 dc 7e a8 41 d1
56 f2 ec 0e 36 ad 52 a4 4d fe b1 e6 1f 7a d9 91
d8 c5 10 56 ff ed b1 62 b4 c0 f2 83 a1 2a 88 a3
94 df f5 26 ab 72 91 cb b3 07 ce ab fc e0 b1 df
d5 cd 95 08 09 6d 5b 2b 8b 6d f5 d6 71 ef 63 77
c0 92 1c b2 3c 27 0a 70 e2 59 8e 6f f8 9d 19 f1
05 ac c2 d3 f0 cb 35 f2 92 80 e1 38 6b 6f 64 c4
ef 22 e1 e1 f2 0d 0c e8 cf fb 22 49 bd 9a 21 37,
01 00 01,
33 a5 04 2a 90 b2 7d 4f 54 51 ca 9b bb d0 b4 47
71 a1 01 af 88 43 40 ae f9 88 5f 2a 4b be 92 e8
94 a7 24 ac 3c 56 8c 8f 97 85 3a d0 7c 02 66 c8
c6 a3 ca 09 29 f1 e8 f1 12 31 88 44 29 fc 4d 9a
e5 5f ee 89 6a 10 ce 70 7c 3e d7 e7 34 e4 47 27
a3 95 74 50 1a 53 26 83 10 9c 2a ba ca ba 28 3c
31 b4 bd 2f 53 c3 ee 37 e3 52 ce e3 4f 9e 50 3b
d8 0c 06 22 ad 79 c6 dc ee 88 35 47 c6 a3 b3 25,
85 13 84 cd fe 81 9c 22 ed 6c 4c cb 30 da eb 5c
f0 59 bc 8e 11 66 b7 e3 53 0c 4c 23 3e 2b 5f 8f
71 a1 cc a5 82 d4 3e cc 72 b1 bc a1 6d fc 70 13
22 6b 9e,
ef 28 69 fa 40 c3 46 cb 18 3d ab 3d 7b ff c9 8f
d5 6d f4 2d,
Crypto.SHA1,
3e f7 f4 6e 83 1b f9 2b 32 27 41 42 a5 85 ff ce
fb dc a7 b3 2a e9 0d 10 fb 0f 0c 72 99 84 f0 4e
f2 9a 9d f0 78 07 75 ce 43 73 9b 97 83 83 90 db
0a 55 05 e6 3d e9 27 02 8d 9d 29 b2 19 ca 2c 45
17 83 25 58 a5 5d 69 4a 6d 25 b9 da b6 60 03 c4
cc cd 90 78 02 19 3b e5 17 0d 26 14 7d 37 b9 35
90 24 1b e5 1c 25 05 5f 47 ef 62 75 2c fb e2 14
18 fa fe 98 c2 2c 4d 4d 47 72 4f db 56 69 e8 43)
|
42aed0 | 2004-02-07 | Martin Nilsson | | // Crypto.DSA
|
19922f | 2014-01-29 | Martin Nilsson | |
|
bd1ab8 | 2014-04-06 | Martin Nilsson | | test_any([[
#pike 7.8
return !!Crypto.DSA;
]], 1)
|
60d22c | 2004-02-28 | Martin Nilsson | | cond_resolv(Crypto.SHA1.name, [[
|
42aed0 | 2004-02-07 | Martin Nilsson | | test_do( add_constant("DSA", Crypto.DSA()) )
test_eq( DSA->name(), "DSA" )
test_do( DSA->set_public_key(
Gmp.mpz( "8df2a494492276aa3d25759bb06869cb"
"eac0d83afb8d0cf7cbb8324f0d7882e5"
"d0762fc5b7210eafc2e9adac32ab7aac"
"49693dfbf83724c2ec0736ee31c80291", 16 ), // p
Gmp.mpz( "c773218c737ec8ee993b4f2ded30f48edace915f", 16 ), // q
Gmp.mpz( "626d027839ea0a13413163a55b4cb500"
"299d5522956cefcb3bff10f399ce2c2e"
"71cb9de5fa24babf58e5b79521925c9c"
"c42e9f6f464b088cc572af53e6d78802", 16 ), // g
Gmp.mpz( "19131871d75b1612a819f29d78d1b0d7"
"346f7aa77bb62a859bfd6c5675da9d21"
"2d3a36ef1672ef660b8c7c255cc0ec74"
"858fba33f44c06699630a76b030ee333", 16 )) )
test_do( DSA->set_private_key(
Gmp.mpz( "2070b3223dba372fde1c0ffc7b2e3b498b260614", 16 )) )
|
60afeb | 2014-04-02 | Martin Nilsson | | test_do( DSA->set_random( random_string ) )
|
9581ed | 2013-11-22 | Martin Nilsson | | test_equal( DSA->raw_sign(DSA->hash("abc", Crypto.SHA1),
|
42aed0 | 2004-02-07 | Martin Nilsson | | Gmp.mpz("358dad571462710f50e254cf1a376b2bdeaadfbf", 16))->digits(16),
({ "8bac1ab66410435cb7181f95b16ab97c92b341c0",
"41e2345f1f56df2458f426d155b4ba2db6dcd8c8" }) )
|
9581ed | 2013-11-22 | Martin Nilsson | | test_true(DSA->raw_verify(DSA->hash("abc", Crypto.SHA1), @DSA->raw_sign(DSA->hash("abc", Crypto.SHA1))))
|
b3e4a0 | 2013-10-28 | Martin Nilsson | | dnl test_true( DSA->verify_rsaref("abc", DSA->sign_rsaref("abc")) )
|
9581ed | 2013-11-22 | Martin Nilsson | | test_true( DSA->pkcs_verify("abc", Crypto.SHA1, DSA->pkcs_sign("abc", Crypto.SHA1)) )
|
42aed0 | 2004-02-07 | Martin Nilsson | | test_do( add_constant("DSB", Crypto.DSA()) )
test_do( DSB->set_public_key( DSA->get_p(), DSA->get_q(),
DSA->get_g(), DSA->get_y() ) )
test_true( DSB->public_key_equal(DSA) )
test_true( DSA->public_key_equal(DSB) )
test_do( add_constant("DSB", Crypto.DSA()) )
|
3f6dd0 | 2013-12-02 | Martin Nilsson | | test_true( DSB->generate_key(1024,160) )
|
42aed0 | 2004-02-07 | Martin Nilsson | | test_true( DSB->generate_key() )
|
9e05a7 | 2013-11-20 | Martin Nilsson | | test_any([[
|
9581ed | 2013-11-22 | Martin Nilsson | | array(Gmp.mpz) sign = DSB->raw_sign(DSB->hash("abc", Crypto.SHA1));
return DSB->raw_verify(DSB->hash("abc", Crypto.SHA1), @sign);
|
9e05a7 | 2013-11-20 | Martin Nilsson | | ]], 1)
|
42aed0 | 2004-02-07 | Martin Nilsson | | test_false( DSB->public_key_equal(DSA) )
test_false( DSA->public_key_equal(DSB) )
test_true( DSB->get_p()->gcdext2 )
test_true( DSB->get_q()->gcdext2 )
test_true( DSB->get_g()->gcdext2 )
test_true( DSB->get_x()->gcdext2 )
test_true( DSB->get_y()->gcdext2 )
test_do( add_constant("DSB") )
test_do( add_constant("DSA") )
|
60d22c | 2004-02-28 | Martin Nilsson | | ]])
|
42aed0 | 2004-02-07 | Martin Nilsson | |
|
19922f | 2014-01-29 | Martin Nilsson | | // Crypto.ECC
define(test_curve,[[
cond_resolv(Crypto.ECC.$1, [[
test_eq(Crypto.ECC.$1->name(),"$1")
test_eq(Crypto.ECC.$1->size(),(int)"$1"[5..])
|
e1d4a6 | 2014-08-25 | Martin Nilsson | | test_eq((string)Crypto.ECC.$1->pkcs_named_curve_id(),$2)
|
19922f | 2014-01-29 | Martin Nilsson | | test_do(add_constant("ecdsa", Crypto.ECC.$1.ECDSA()))
test_true(ecdsa->set_random(random_string))
test_true(ecdsa->generate_key())
|
46765d | 2015-01-25 | Martin Nilsson | | test_do(ecdsa->set_public_key(ecdsa->get_x(),ecdsa->get_y()))
test_do(ecdsa->set_public_key(ecdsa->get_point()))
test_do(ecdsa->set_public_key(ecdsa->get_public_key()))
|
f4ca2a | 2015-01-25 | Martin Nilsson | | test_eq(ecdsa->get_curve(),Crypto.ECC.$1)
|
19922f | 2014-01-29 | Martin Nilsson | | test_eq(ecdsa->size(),(int)"$1"[5..])
test_any([[
array sign = ecdsa->raw_sign("hej");
return ecdsa->raw_verify("hej", @sign);
]], 1)
test_do(add_constant("ecdsa"))
]])]])
test_curve(SECP_192R1,"1.2.840.10045.3.1.1")
test_curve(SECP_224R1,"1.3.132.0.33")
test_curve(SECP_256R1,"1.2.840.10045.3.1.7")
test_curve(SECP_384R1,"1.3.132.0.34")
test_curve(SECP_521R1,"1.3.132.0.35")
|
2fa9f6 | 2014-10-20 | Martin Nilsson | | cond_resolv(Crypto.ECC.SECP_192R1, [[
test_do( Crypto.ECC.SECP_192R1.ECDSA()->generate_key())
]])
|
19922f | 2014-01-29 | Martin Nilsson | |
|
e6065d | 2003-03-19 | Martin Nilsson | | dnl Crypto.substitution
|
7093e3 | 2004-02-14 | Martin Nilsson | | test_do( add_constant("C", Crypto.Substitution()) )
|
e6065d | 2003-03-19 | Martin Nilsson | |
dnl ROT
test_do( C->set_rot_key() )
|
7093e3 | 2004-02-14 | Martin Nilsson | | test_eq( C->encrypt("Pelle"), "Cryyr" )
test_eq( C->decrypt("Cryyr"), "Pelle" )
|
e6065d | 2003-03-19 | Martin Nilsson | | dnl --- Jay Kominek ROT13 conformance test
|
7093e3 | 2004-02-14 | Martin Nilsson | | test_eq( C->encrypt("ABCDEFGHIJKLMNOPQRSTUVWXYZ"),
"NOPQRSTUVWXYZABCDEFGHIJKLM" )
test_eq( C->encrypt("abcdefghijklmnopqrstuvwxyz"),
"nopqrstuvwxyzabcdefghijklm" )
test_eq( C->encrypt("0123456789-= "), "0123456789-= " )
test_eq( C->encrypt("!@#$%^&*()_+"), "!@#$%^&*()_+" )
test_eq( C->encrypt("[]{};':\",./<>?"),[[ "[]{};':\",./<>?" ]])
|
e6065d | 2003-03-19 | Martin Nilsson | | dnl --- End of Jay Kominek ROT 13 conformance test
test_do( C->set_rot_key(2) )
|
7093e3 | 2004-02-14 | Martin Nilsson | | test_eq( C->encrypt("Pelle"), "Rgnng" )
test_eq( C->decrypt("Rgnng"), "Pelle" )
|
e6065d | 2003-03-19 | Martin Nilsson | | test_do( C->set_rot_key(3, "ABCabcåäö"/1) )
|
7093e3 | 2004-02-14 | Martin Nilsson | | test_eq( C->encrypt("Abbas"), "aääås" )
test_eq( C->decrypt("aääås"), "Abbas" )
|
f2deb0 | 2003-11-30 | Martin Nilsson | | test_do( C->set_null_chars(0.2, "xyz"/1) )
|
7093e3 | 2004-02-14 | Martin Nilsson | | test_eq( C->decrypt(C->encrypt("A"*100)), "A"*100 )
|
e6065d | 2003-03-19 | Martin Nilsson | |
test_do( add_constant("C") )
|
2e0900 | 2004-02-03 | Martin Nilsson | |
|
e83cc6 | 2008-04-15 | Martin Nilsson | | test_eq( Crypto.rot13("Pelle"), "Cryyr" )
test_eq( Crypto.rot13("Cryyr"), "Pelle" )
|
2e0900 | 2004-02-03 | Martin Nilsson | |
dnl
dnl _Crypto tests
dnl
// DES
|
60d22c | 2004-02-28 | Martin Nilsson | | cond_resolv(Crypto.DES.name, [[
|
ab48b5 | 2004-02-06 | Martin Nilsson | | test_eq(
S(Crypto.DES()->set_encrypt_key(H("0101010101010180"))
->crypt(H("0000000000000000"))),
"9cc62df43b6eed74")
test_eq(
S(Crypto.DES()->set_encrypt_key(H("8001010101010101"))
->crypt(H("0000000000000040"))),
"a380e02a6be54696")
test_eq(
S(Crypto.DES()->set_encrypt_key(H("08192a3b4c5d6e7f"))
->crypt(H("0000000000000000"))),
"25ddac3e96176467")
test_eq(
S(Crypto.DES()->set_encrypt_key(H("0123456789abcdef"))
->crypt("Now is t")),
"3fa40e8a984d4815")
test_eq(
S(Crypto.DES()->set_encrypt_key(H("0123456789abcdef"))
->crypt(H("0123456789abcde7"))),
"c95744256a5ed31d")
test_eq(
Crypto.DES()->set_decrypt_key(H("0123456789abcdef"))
->crypt(H("3fa40e8a984d4815")),
"Now is t")
|
60d22c | 2004-02-28 | Martin Nilsson | | ]])
|
2e0900 | 2004-02-03 | Martin Nilsson | |
// DES3 (EDE with AAA key == DES)
|
60d22c | 2004-02-28 | Martin Nilsson | | cond_resolv(Crypto.DES3.name, [[
|
ab48b5 | 2004-02-06 | Martin Nilsson | | test_eq(
S(Crypto.DES3()->set_encrypt_key(H("0101010101010180")*3)
->crypt(H("0000000000000000"))),
"9cc62df43b6eed74")
test_eq(
S(Crypto.DES3()->set_encrypt_key(H("8001010101010101")*3)
->crypt(H("0000000000000040"))),
"a380e02a6be54696")
test_eq(
S(Crypto.DES3()->set_encrypt_key(H("08192a3b4c5d6e7f")*3)
->crypt(H("0000000000000000"))),
"25ddac3e96176467")
test_eq(
S(Crypto.DES3()->set_encrypt_key(H("0123456789abcdef")*3)
->crypt("Now is t")),
"3fa40e8a984d4815")
test_eq(
S(Crypto.DES3()->set_encrypt_key(H("0123456789abcdef")*3)
->crypt(H("0123456789abcde7"))),
"c95744256a5ed31d")
test_eq(
Crypto.DES3()->set_decrypt_key(H("0123456789abcdef")*3)
->crypt(H("3fa40e8a984d4815")),
"Now is t")
|
60d22c | 2004-02-28 | Martin Nilsson | | ]])
|
2e0900 | 2004-02-03 | Martin Nilsson | |
// IDEA
|
60d22c | 2004-02-28 | Martin Nilsson | | cond_resolv(Crypto.IDEA.name, [[
|
ab48b5 | 2004-02-06 | Martin Nilsson | | test_eq(
S(Crypto.IDEA()
->set_encrypt_key(H("0123456789abcdef0123456789abcdef"))
->crypt(H("0123456789abcde7"))),
"2011aacef6f4bc7f")
|
60d22c | 2004-02-28 | Martin Nilsson | | ]])
|
2e0900 | 2004-02-03 | Martin Nilsson | |
// CAST
|
60d22c | 2004-02-28 | Martin Nilsson | | cond_resolv(Crypto.CAST.name, [[
|
ab48b5 | 2004-02-06 | Martin Nilsson | | test_eq(
S(Crypto.CAST()
->set_encrypt_key(H("0123456712345678234567893456789A"))
->crypt(H("0123456789ABCDEF"))),
"238b4fe5847e44b2")
test_eq(
S(Crypto.CAST()
->set_encrypt_key(H("01234567123456782345"))
->crypt(H("0123456789ABCDEF"))),
"eb6a711a2c02271b")
test_eq(
S(Crypto.CAST()
->set_encrypt_key(H("0123456712"))
->crypt(H("0123456789ABCDEF"))),
"7ac816d16e9b302e")
test_eq(
S(Crypto.CAST()
->set_decrypt_key(H("0123456712345678234567893456789A"))
->crypt(H("238B4FE5847E44B2"))),
"0123456789abcdef")
test_eq(
S(Crypto.CAST()
->set_decrypt_key(H("01234567123456782345"))
->crypt(H("EB6A711A2C02271B"))),
"0123456789abcdef")
test_eq(
S(Crypto.CAST()
->set_decrypt_key(H("0123456712"))
->crypt(H("7AC816D16E9B302E"))),
"0123456789abcdef")
|
60d22c | 2004-02-28 | Martin Nilsson | | ]])
|
2e0900 | 2004-02-03 | Martin Nilsson | |
// ARCFOUR
|
60d22c | 2004-02-28 | Martin Nilsson | | cond_resolv(Crypto.Arcfour.name, [[
|
ab48b5 | 2004-02-06 | Martin Nilsson | | test_eq(
S(Crypto.Arcfour()->set_encrypt_key(H("0123456789abcdef"))
->crypt(H("0123456789abcdef"))),
"75b7878099e0c596")
test_eq(
S(Crypto.Arcfour()->set_encrypt_key(H("0123456789abcdef"))
->crypt(H("0000000000000000"))),
"7494c2e7104b0879")
test_eq(
S(Crypto.Arcfour()->set_encrypt_key(H("0000000000000000"))
->crypt(H("0000000000000000"))),
"de188941a3375d3a")
test_eq(
S(Crypto.Arcfour()->set_encrypt_key(H("ef012345"))
->crypt(H("00000000000000000000"))),
"d6a141a7ec3c38dfbd61")
|
2e0900 | 2004-02-03 | Martin Nilsson | |
|
ab48b5 | 2004-02-06 | Martin Nilsson | | test_eq(
S(Crypto.Arcfour()
->set_encrypt_key(H("0123456789abcdef"))
->crypt(H(
|
2e0900 | 2004-02-03 | Martin Nilsson | | "0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
"0101010101010101010101010101010101010101010101010101010101010101"
|
ab48b5 | 2004-02-06 | Martin Nilsson | | "0101010101010101010101010101010101010101010101010101010101010101"))),
|
2e0900 | 2004-02-03 | Martin Nilsson | | "7595c3e6114a09780c4ad452338e1ffd9a1be9498f813d76533449b6778dcad8"
"c78a8d2ba9ac66085d0e53d59c26c2d1c490c1ebbe0ce66d1b6b1b13b6b919b8"
"47c25a91447a95e75e4ef16779cde8bf0a95850e32af9689444fd377108f98fd"
"cbd4e726567500990bcc7e0ca3c4aaa304a387d20f3b8fbbcd42a1bd311d7a43"
"03dda5ab078896ae80c18b0af66dff319616eb784e495ad2ce90d7f772a81747"
"b65f62093b1e0db9e5ba532fafec47508323e671327df9444432cb7367cec82f"
"5d44c0d00b67d650a075cd4b70dedd77eb9b10231b6b5b741347396d62897421"
"d43df9b42e446e358e9c11a9b2184ecbef0cd8e7a877ef968f1390ec9b3d35a5"
"585cb009290e2fcde7b5ec66d9084be44055a619d9dd7fc3166f9487f7cb2729"
"12426445998514c15d53a18c864ce3a2b7555793988126520eacf2e3066e230c"
"91bee4dd5304f5fd0405b35bd99c73135d3d9bc335ee049ef69b3867bf2d7bd1"
"eaa595d8bfc0066ff8d31509eb0c6caa006c807a623ef84c3d33c195d23ee320"
"c40de0558157c822d4b8c569d849aed59d4e0fd7f379586b4b7ff684ed6a189f"
"7486d49b9c4bad9ba24b96abf924372c8a8fffb10d55354900a77a3db5f205e1"
"b99fcd8660863a159ad4abe40fa48934163ddde542a6585540fd683cbfd8c00f"
|
ab48b5 | 2004-02-06 | Martin Nilsson | | "12129a284deacc4cdefe58be7137541c047126c8d49e2755ab181ab7e940b0c0")
|
60d22c | 2004-02-28 | Martin Nilsson | | ]])
|
2e0900 | 2004-02-03 | Martin Nilsson | |
// HMAC
|
60d22c | 2004-02-28 | Martin Nilsson | | cond_resolv(Crypto.MD5.name, [[
|
2e0900 | 2004-02-03 | Martin Nilsson | | test_eq([[
|
ab48b5 | 2004-02-06 | Martin Nilsson | | S(Crypto.HMAC(Crypto.MD5)("")(""))]],
"74e6f7298a9c2d168935f58c001bad88")
|
2e0900 | 2004-02-03 | Martin Nilsson | | // Test vectors for md5 from RFC-2104
test_eq([[
|
ab48b5 | 2004-02-06 | Martin Nilsson | | S(Crypto.HMAC(Crypto.MD5)("\013" * 16)("Hi There"))]],
"9294727a3638bb1c13f48ef8158bfc9d")
|
2e0900 | 2004-02-03 | Martin Nilsson | | test_eq([[
|
ab48b5 | 2004-02-06 | Martin Nilsson | | S(Crypto.HMAC(Crypto.MD5)("Jefe")("what do ya want for nothing?"))]],
"750c783e6ab0b503eaa86e310a5db738")
|
2e0900 | 2004-02-03 | Martin Nilsson | | test_eq([[
|
ab48b5 | 2004-02-06 | Martin Nilsson | | S(Crypto.HMAC(Crypto.MD5)("\252" * 16)("\335" * 50))]],
"56be34521d144c88dbb8c733f0e8b3f6")
|
60d22c | 2004-02-28 | Martin Nilsson | | ]])
|
2e0900 | 2004-02-03 | Martin Nilsson | |
// Similar test vectors for sha; not verified with other implementations
|
60d22c | 2004-02-28 | Martin Nilsson | | cond_resolv(Crypto.SHA1.name, [[
|
2e0900 | 2004-02-03 | Martin Nilsson | | test_eq([[
|
ab48b5 | 2004-02-06 | Martin Nilsson | | S(Crypto.HMAC(Crypto.SHA1)("")(""))]],
"fbdb1d1b18aa6c08324b7d64b71fb76370690e1d")
|
2e0900 | 2004-02-03 | Martin Nilsson | | test_eq([[
|
ab48b5 | 2004-02-06 | Martin Nilsson | | S(Crypto.HMAC(Crypto.SHA1)("\013" * 16)("Hi There"))]],
"675b0b3a1b4ddf4e124872da6c2f632bfed957e9")
|
2e0900 | 2004-02-03 | Martin Nilsson | | test_eq([[
|
ab48b5 | 2004-02-06 | Martin Nilsson | | S(Crypto.HMAC(Crypto.SHA1)("Jefe")("what do ya want for nothing?"))]],
"effcdf6ae5eb2fa2d27416d5f184df9c259a7c79")
|
2e0900 | 2004-02-03 | Martin Nilsson | | test_eq([[
|
ab48b5 | 2004-02-06 | Martin Nilsson | | S(Crypto.HMAC(Crypto.SHA1)("\252" * 16)("\335" * 50))]],
"d730594d167e35d5956fd8003d0db3d3f46dc7bb")
|
60d22c | 2004-02-28 | Martin Nilsson | | ]])
|
2e0900 | 2004-02-03 | Martin Nilsson | |
// CRYPT_MD5
|
388632 | 2004-03-08 | Martin Nilsson | | cond_resolv(Nettle.crypt_md5, [[
test_true([[stringp(Crypto.make_crypt_md5(""))]])
test_eq([[Crypto.make_crypt_md5("","")]],
|
2e0900 | 2004-02-03 | Martin Nilsson | | [["$1$$qRPK7m23GJusamGpoGLby/"]])
|
388632 | 2004-03-08 | Martin Nilsson | | test_eq([[Crypto.make_crypt_md5("","$xyz")]],
|
2e0900 | 2004-02-03 | Martin Nilsson | | [["$1$$qRPK7m23GJusamGpoGLby/"]])
|
388632 | 2004-03-08 | Martin Nilsson | | test_eq([[Crypto.make_crypt_md5("Hello","sl5hO7j4")]],
|
2e0900 | 2004-02-03 | Martin Nilsson | | [["$1$sl5hO7j4$glLmY.ttmi1hWK8ucIrig."]])
|
388632 | 2004-03-08 | Martin Nilsson | | test_eq([[Crypto.verify_crypt_md5("Hello","$1$sl5hO7j4$glLmY.ttmi1hWK8ucIrig.")]],
[[1]])
test_eq([[Crypto.verify_crypt_md5("Hellx","$1$sl5hO7j4$glLmY.ttmi1hWK8ucIrig.")]],
[[0]])
|
60d22c | 2004-02-28 | Martin Nilsson | | ]])
|
2e0900 | 2004-02-03 | Martin Nilsson | |
|
7940a8 | 2013-03-07 | Henrik Grubbström (Grubba) | | // crypt_hash
dnl from http://www.akkadia.org/drepper/SHA-crypt.txt:sha256crypt.c
test_eq(Crypto.SHA256.crypt_hash("Hello world!", "saltstring", 5000),
"5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5")
test_eq(Crypto.SHA256.crypt_hash("Hello world!",
"saltstringsaltstring", 10000),
"3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA")
test_eq(Crypto.SHA256.crypt_hash("This is just a test",
"toolongsaltstring", 5000),
"Un/5jzAHMgOGZ5.mWJpuVolil07guHPvOW8mGRcvxa5")
test_eq(Crypto.SHA256.crypt_hash("a very much longer text to encrypt. "
"This one even stretches over more"
"than one line.",
"anotherlongsaltstring", 1400),
"Rx.j8H.h8HjEDGomFU8bDkXm3XIUnzyxf12oP84Bnq1")
test_eq(Crypto.SHA256.crypt_hash("we have a short salt string but "
"not a short password",
"short", 77777),
"JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/")
test_eq(Crypto.SHA256.crypt_hash("a short string", "asaltof16chars..", 123456),
"gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/cZKmF/wJvD")
test_eq(Crypto.SHA256.crypt_hash("the minimum number is still observed",
"roundstoolow", 10),
"yfvwcWrQ8l/K0DAWyuPMDNHpIVlTQebY9l/gL972bIC")
cond_resolv(Crypto.SHA512, [[
dnl from http://www.akkadia.org/drepper/SHA-crypt.txt:sha512crypt.c
|
7769b7 | 2013-04-17 | Martin Nilsson | | test_eq(Crypto.SHA512.crypt_hash("Hello world!", "saltstring", 5000),
|
7940a8 | 2013-03-07 | Henrik Grubbström (Grubba) | | "svn8UoSVapNtMuq1ukKS4tPQd8iKwSMHWjl/O817G3u"
"BnIFNjnQJuesI68u4OTLiBFdcbYEdFCoEOfaS35inz1")
|
7769b7 | 2013-04-17 | Martin Nilsson | | test_eq(Crypto.SHA512.crypt_hash("Hello world!",
|
7940a8 | 2013-03-07 | Henrik Grubbström (Grubba) | | "saltstringsaltstring", 10000),
"OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sbHbbMCVNSn"
"CM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v.")
|
7769b7 | 2013-04-17 | Martin Nilsson | | test_eq(Crypto.SHA512.crypt_hash("This is just a test",
|
7940a8 | 2013-03-07 | Henrik Grubbström (Grubba) | | "toolongsaltstring", 5000),
"lQ8jolhgVRVhY4b5pZKaysCLi0QBxGoNeKQzQ3glMhw"
"llF7oGDZxUhx1yxdYcz/e1JSbq3y6JMxxl8audkUEm0")
|
7769b7 | 2013-04-17 | Martin Nilsson | | test_eq(Crypto.SHA512.crypt_hash("a very much longer text to encrypt. "
|
7940a8 | 2013-03-07 | Henrik Grubbström (Grubba) | | "This one even stretches over more"
"than one line.",
"anotherlongsaltstring", 1400),
"POfYwTEok97VWcjxIiSOjiykti.o/pQs.wPvMxQ6Fm7"
"I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1")
|
7769b7 | 2013-04-17 | Martin Nilsson | | test_eq(Crypto.SHA512.crypt_hash("we have a short salt string but "
|
7940a8 | 2013-03-07 | Henrik Grubbström (Grubba) | | "not a short password",
"short", 77777),
"WuQyW2YR.hBNpjjRhpYD/ifIw05xdfeEyQoMxIXbkvr"
"0gge1a1x3yRULJ5CCaUeOxFmtlcGZelFl5CxtgfiAc0")
|
7769b7 | 2013-04-17 | Martin Nilsson | | test_eq(Crypto.SHA512.crypt_hash("a short string", "asaltof16chars..", 123456),
|
7940a8 | 2013-03-07 | Henrik Grubbström (Grubba) | | "BtCwjqMJGx5hrJhZywWvt0RLE8uZ4oPwcelCjmw2kSY"
"u.Ec6ycULevoBK25fs2xXgMNrCzIMVcgEJAstJeonj1")
|
7769b7 | 2013-04-17 | Martin Nilsson | | test_eq(Crypto.SHA512.crypt_hash("the minimum number is still observed",
|
7940a8 | 2013-03-07 | Henrik Grubbström (Grubba) | | "roundstoolow", 10),
"kUMsbe306n21p9R.FRkW3IGn.S9NPN0x50YhH1xhLsP"
"uWGsUSklZt58jaTfF4ZEQpyUNGc0dqbpBYYBaHHrsX.")
]])
|
2e0900 | 2004-02-03 | Martin Nilsson | | // pipe
|
ee0cb7 | 2004-03-06 | Martin Nilsson | | cond([[ master()->resolv("Crypto.IDEA.name") && master()->resolv("Gmp.mpz") ]],
[[
|
2e0900 | 2004-02-03 | Martin Nilsson | | test_eq(
|
ae6974 | 2004-02-13 | Martin Nilsson | | Crypto.Pipe( Crypto.DES, Crypto.AES, Crypto.IDEA,
Crypto.CAST, Crypto.Arcfour )->name(),
"Pipe(des, aes, idea, cast128, arcfour)")
|
2e0900 | 2004-02-03 | Martin Nilsson | | test_equal(
|
ae6974 | 2004-02-13 | Martin Nilsson | | Crypto.Pipe( Crypto.DES, Crypto.AES, Crypto.IDEA,
Crypto.CAST, Crypto.Arcfour )->key_size(),
|
2e0900 | 2004-02-03 | Martin Nilsson | | ({ 0, 0, 0, 0, 0 }) )
test_eq(
|
ae6974 | 2004-02-13 | Martin Nilsson | | Crypto.Pipe( Crypto.DES, Crypto.AES, Crypto.IDEA,
Crypto.CAST, Crypto.Arcfour )->block_size(), 16)
|
2e0900 | 2004-02-03 | Martin Nilsson | | test_eq(
|
ae6974 | 2004-02-13 | Martin Nilsson | | Crypto.Pipe( Crypto.DES, Crypto.IDEA, Crypto.CAST,
Crypto.Arcfour )->block_size(), 8)
|
2e0900 | 2004-02-03 | Martin Nilsson | | test_eq(
|
ae6974 | 2004-02-13 | Martin Nilsson | | S(Crypto.Pipe( Crypto.DES, Crypto.AES, Crypto.IDEA,
Crypto.CAST )->
set_encrypt_key( Crypto.DES.fix_parity("A"*8), "B"*32, "C"*16,
"D"*16 )->crypt("F"*16)),
"fc222f3584addf1a5f974e104a3e2231" )
|
2e0900 | 2004-02-03 | Martin Nilsson | | test_eq(
|
ae6974 | 2004-02-13 | Martin Nilsson | | Crypto.Pipe( Crypto.DES, Crypto.AES, Crypto.IDEA,
Crypto.CAST )->
set_decrypt_key( Crypto.DES.fix_parity("A"*8), "B"*32, "C"*16,
|
2e0900 | 2004-02-03 | Martin Nilsson | | "D"*16 )->
|
ae6974 | 2004-02-13 | Martin Nilsson | | crypt(H("fc222f3584addf1a5f974e104a3e2231")),
|
2e0900 | 2004-02-03 | Martin Nilsson | | "F"*16 )
|
60d22c | 2004-02-28 | Martin Nilsson | | ]])
|
ae6974 | 2004-02-13 | Martin Nilsson | |
|
460a04 | 2004-02-04 | Martin Nilsson | | // Rijndael CBC decrypt
|
60d22c | 2004-02-28 | Martin Nilsson | | cond_resolv(Crypto.AES.name, [[
|
460a04 | 2004-02-04 | Martin Nilsson | | test_any([[
|
d8c93a | 2014-05-02 | Henrik Grubbström (Grubba) | | object aes_cbc = Crypto.AES.CBC();
|
460a04 | 2004-02-04 | Martin Nilsson | | aes_cbc->set_decrypt_key(String.hex2string("0"*32));
aes_cbc->set_iv(String.hex2string("0"*32));
string ct = String.hex2string("0"*32);
for(int i = 0; i < 10000; i++) {
ct = aes_cbc->crypt(ct);
}
return ct;
]], [[ String.hex2string("FACA37E0B0C85373DF706E73F7C9AF86") ]])
|
60d22c | 2004-02-28 | Martin Nilsson | | ]])
|
ab48b5 | 2004-02-06 | Martin Nilsson | |
test_do( add_constant( "H" ) )
test_do( add_constant( "S" ) )
|
1c4092 | 2013-05-20 | Martin Nilsson | |
test_do([[
int pwtest(string p, void|string s) {
return Crypto.Password.verify( p, Crypto.Password.hash(p, s) );
};
add_constant( "P", pwtest );
]])
test_true( P("hej") )
test_true( P("hej",0) )
test_true( P("hej","crypt") )
test_true( P("hej","{crypt}") )
cond_resolv(Crypto.SHA512, [[
test_true( P("hej","6") )
test_true( has_prefix(Crypto.Password.hash("hej","6"), "$6$") )
test_true( P("hej","$6$") )
test_true( has_prefix(Crypto.Password.hash("hej","$6$"), "$6$") )
]])
test_true( P("hej","5") )
test_true( has_prefix(Crypto.Password.hash("hej","5"), "$5$") )
test_true( P("hej","$5$") )
test_true( has_prefix(Crypto.Password.hash("hej","$5$"), "$5$") )
test_true( P("hej","1") )
test_true( has_prefix(Crypto.Password.hash("hej","1"), "$1$") )
test_true( P("hej","$1$") )
test_true( has_prefix(Crypto.Password.hash("hej","$1$"), "$1$") )
test_true( P("hej","sha") )
test_true( has_prefix(Crypto.Password.hash("hej","sha"), "{SHA}") )
test_true( P("hej","{sha}") )
test_true( has_prefix(Crypto.Password.hash("hej","{sha}"), "{SHA}") )
test_true( P("hej","ssha") )
test_true( has_prefix(Crypto.Password.hash("hej","ssha"), "{SSHA}") )
test_true( P("hej","{ssha}") )
test_true( has_prefix(Crypto.Password.hash("hej","{ssha}"), "{SSHA}") )
test_true( P("hej","md5") )
test_true( has_prefix(Crypto.Password.hash("hej","md5"), "{MD5}") )
test_true( P("hej","{md5}") )
test_true( has_prefix(Crypto.Password.hash("hej","{md5}"), "{MD5}") )
test_true( P("hej","smd5") )
test_true( has_prefix(Crypto.Password.hash("hej","smd5"), "{SMD5}") )
test_true( P("hej","{smd5}") )
test_true( has_prefix(Crypto.Password.hash("hej","{smd5}"), "{SMD5}") )
test_eval_error( Crypto.Password.hash("hej","hej") )
test_false( Crypto.Password.verify("hej","{}") )
test_false( Crypto.Password.verify("hej","{x}") )
test_false( Crypto.Password.verify("hej","{md5}") )
test_false( Crypto.Password.verify("hej","{sha}") )
|
73029c | 2013-05-20 | Martin Nilsson | | test_true( Crypto.Password.verify("hej","{crypt}") )
|
1c4092 | 2013-05-20 | Martin Nilsson | | Crypto.Password.verify("hej","$x$");
Crypto.Password.verify("hej","$1$$");
Crypto.Password.verify("hej","$5$$");
Crypto.Password.verify("hej","$6$$");
test_do( add_constant( "P" ) )
|
0ec849 | 2014-10-13 | Martin Nilsson | | test_true( Crypto.DH.MODPGroup1 )
test_true( Crypto.DH.MODPGroup2 )
test_true( Crypto.DH.MODPGroup5 )
test_true( Crypto.DH.MODPGroup14 )
test_true( Crypto.DH.MODPGroup15 )
test_true( Crypto.DH.MODPGroup16 )
test_true( Crypto.DH.MODPGroup17 )
test_true( Crypto.DH.MODPGroup18 )
test_true( Crypto.DH.MODPGroup22 )
test_true( Crypto.DH.MODPGroup23 )
test_true( Crypto.DH.MODPGroup24 )
|
2f3fce | 2015-01-25 | Martin Nilsson | | test_true( Crypto.DH.FFDHE2048 )
|
ea68ec | 2015-03-05 | Martin Nilsson | | test_true( Crypto.DH.FFDHE2432 )
|
2f3fce | 2015-01-25 | Martin Nilsson | | test_true( Crypto.DH.FFDHE3072 )
test_true( Crypto.DH.FFDHE4096 )
test_true( Crypto.DH.FFDHE8192 )
|
ea68ec | 2015-03-05 | Martin Nilsson | | dnl q values from draft-ietf-tls-negotiated-ff-dhe-06
|
2f3fce | 2015-01-25 | Martin Nilsson | | test_eq( Crypto.DH.FFDHE2048.q, Gmp.mpz(#"
7FFFFFFF FFFFFFFF D6FC2A2C 515DA54D 57EE2B10 139E9E78
EC5CE2C1 E7169B4A D4F09B20 8A3219FD E649CEE7 124D9F7C
BE97F1B1 B1863AEC 7B40D901 576230BD 69EF8F6A EAFEB2B0
9219FA8F AF833768 42B1B2AA 9EF68D79 DAAB89AF 3FABE49A
CC278638 707345BB F15344ED 79F7F439 0EF8AC50 9B56F39A
98566527 A41D3CBD 5E0558C1 59927DB0 E88454A5 D96471FD
DCB56D5B B06BFA34 0EA7A151 EF1CA6FA 572B76F3 B1B95D8C
8583D3E4 770536B8 4F017E70 E6FBF176 601A0266 941A17B0
C8B97F4E 74C2C1FF C7278919 777940C1 E1FF1D8D A637D6B9
9DDAFE5E 17611002 E2C778C1 BE8B41D9 6379A513 60D977FD
4435A11C 30942E4B FFFFFFFF FFFFFFFF
",16) )
|
0ec849 | 2014-10-13 | Martin Nilsson | |
|
2f3fce | 2015-01-25 | Martin Nilsson | | test_eq( Crypto.DH.FFDHE3072.q, Gmp.mpz(#"
|
0ec849 | 2014-10-13 | Martin Nilsson | | 7FFFFFFF FFFFFFFF D6FC2A2C 515DA54D 57EE2B10 139E9E78
EC5CE2C1 E7169B4A D4F09B20 8A3219FD E649CEE7 124D9F7C
BE97F1B1 B1863AEC 7B40D901 576230BD 69EF8F6A EAFEB2B0
9219FA8F AF833768 42B1B2AA 9EF68D79 DAAB89AF 3FABE49A
CC278638 707345BB F15344ED 79F7F439 0EF8AC50 9B56F39A
98566527 A41D3CBD 5E0558C1 59927DB0 E88454A5 D96471FD
DCB56D5B B06BFA34 0EA7A151 EF1CA6FA 572B76F3 B1B95D8C
8583D3E4 770536B8 4F017E70 E6FBF176 601A0266 941A17B0
C8B97F4E 74C2C1FF C7278919 777940C1 E1FF1D8D A637D6B9
9DDAFE5E 17611002 E2C778C1 BE8B41D9 6379A513 60D977FD
4435A11C 308FE7EE 6F1AAD9D B28C81AD DE1A7A6F 7CCE011C
30DA37E4 EB736483 BD6C8E93 48FBFBF7 2CC6587D 60C36C8E
577F0984 C289C938 5A098649 DE21BCA2 7A7EA229 716BA6E9
B279710F 38FAA5FF AE574155 CE4EFB4F 743695E2 911B1D06
D5E290CB CD86F56D 0EDFCD21 6AE22427 055E6835 FD29EEF7
9E0D9077 1FEACEBE 12F20E95 B363171B FFFFFFFF FFFFFFFF
",16) )
|
2f3fce | 2015-01-25 | Martin Nilsson | | test_eq( Crypto.DH.FFDHE4096.q, Gmp.mpz(#"
|
0ec849 | 2014-10-13 | Martin Nilsson | | 7FFFFFFF FFFFFFFF D6FC2A2C 515DA54D 57EE2B10 139E9E78
EC5CE2C1 E7169B4A D4F09B20 8A3219FD E649CEE7 124D9F7C
BE97F1B1 B1863AEC 7B40D901 576230BD 69EF8F6A EAFEB2B0
9219FA8F AF833768 42B1B2AA 9EF68D79 DAAB89AF 3FABE49A
CC278638 707345BB F15344ED 79F7F439 0EF8AC50 9B56F39A
98566527 A41D3CBD 5E0558C1 59927DB0 E88454A5 D96471FD
DCB56D5B B06BFA34 0EA7A151 EF1CA6FA 572B76F3 B1B95D8C
8583D3E4 770536B8 4F017E70 E6FBF176 601A0266 941A17B0
C8B97F4E 74C2C1FF C7278919 777940C1 E1FF1D8D A637D6B9
9DDAFE5E 17611002 E2C778C1 BE8B41D9 6379A513 60D977FD
4435A11C 308FE7EE 6F1AAD9D B28C81AD DE1A7A6F 7CCE011C
30DA37E4 EB736483 BD6C8E93 48FBFBF7 2CC6587D 60C36C8E
577F0984 C289C938 5A098649 DE21BCA2 7A7EA229 716BA6E9
B279710F 38FAA5FF AE574155 CE4EFB4F 743695E2 911B1D06
D5E290CB CD86F56D 0EDFCD21 6AE22427 055E6835 FD29EEF7
9E0D9077 1FEACEBE 12F20E95 B34F0F78 B737A961 8B26FA7D
BC9874F2 72C42BDB 563EAFA1 6B4FB68C 3BB1E78E AA81A002
43FAADD2 BF18E63D 389AE443 77DA18C5 76B50F00 96CF3419
5483B005 48C09862 36E3BC7C B8D6801C 0494CCD1 99E5C5BD
0D0EDC9E B8A0001E 15276754 FCC68566 054148E6 E764BEE7
C764DAAD 3FC45235 A6DAD428 FA20C170 E345003F 2F32AFB5
7FFFFFFF FFFFFFFF
",16) )
|
ea68ec | 2015-03-05 | Martin Nilsson | | test_eq( Crypto.DH.FFDHE6144.q, Gmp.mpz(#"
7FFFFFFF FFFFFFFF D6FC2A2C 515DA54D 57EE2B10 139E9E78
EC5CE2C1 E7169B4A D4F09B20 8A3219FD E649CEE7 124D9F7C
BE97F1B1 B1863AEC 7B40D901 576230BD 69EF8F6A EAFEB2B0
9219FA8F AF833768 42B1B2AA 9EF68D79 DAAB89AF 3FABE49A
CC278638 707345BB F15344ED 79F7F439 0EF8AC50 9B56F39A
98566527 A41D3CBD 5E0558C1 59927DB0 E88454A5 D96471FD
DCB56D5B B06BFA34 0EA7A151 EF1CA6FA 572B76F3 B1B95D8C
8583D3E4 770536B8 4F017E70 E6FBF176 601A0266 941A17B0
C8B97F4E 74C2C1FF C7278919 777940C1 E1FF1D8D A637D6B9
9DDAFE5E 17611002 E2C778C1 BE8B41D9 6379A513 60D977FD
4435A11C 308FE7EE 6F1AAD9D B28C81AD DE1A7A6F 7CCE011C
30DA37E4 EB736483 BD6C8E93 48FBFBF7 2CC6587D 60C36C8E
577F0984 C289C938 5A098649 DE21BCA2 7A7EA229 716BA6E9
B279710F 38FAA5FF AE574155 CE4EFB4F 743695E2 911B1D06
D5E290CB CD86F56D 0EDFCD21 6AE22427 055E6835 FD29EEF7
9E0D9077 1FEACEBE 12F20E95 B34F0F78 B737A961 8B26FA7D
BC9874F2 72C42BDB 563EAFA1 6B4FB68C 3BB1E78E AA81A002
43FAADD2 BF18E63D 389AE443 77DA18C5 76B50F00 96CF3419
5483B005 48C09862 36E3BC7C B8D6801C 0494CCD1 99E5C5BD
0D0EDC9E B8A0001E 15276754 FCC68566 054148E6 E764BEE7
C764DAAD 3FC45235 A6DAD428 FA20C170 E345003F 2F06EC81
05FEB25B 2281B63D 2733BE96 1C29951D 11DD2221 657A9F53
1DDA2A19 4DBB1264 48BDEEB2 58E07EA6 59C74619 A6380E1D
66D6832B FE67F638 CD8FAE1F 2723020F 9C40A3FD A67EDA3B
D29238FB D4D4B488 5C2A9917 6DB1A06C 50077849 1A8288F1
855F60FF FCF1D137 3FD94FC6 0C1811E1 AC3F1C6D 003BECDA
3B1F2725 CA595DE0 CA63328F 3BE57CC9 77556011 95140DFB
59D39CE0 91308B41 05746DAC 23D33E5F 7CE4848D A316A9C6
6B9581BA 3573BFAF 31149618 8AB15423 282EE416 DC2A19C5
724FA91A E4ADC88B C66796EA E5677A01 F64E8C08 63139582
2D9DB8FC EE35C06B 1FEEA547 4D6D8F34 B1534A93 6A18B0E0
D20EAB86 BC9C6D6A 5207194E 68720732 FFFFFFFF FFFFFFFF
",16) )
|
2f3fce | 2015-01-25 | Martin Nilsson | | test_eq( Crypto.DH.FFDHE8192.q, Gmp.mpz(#"
|
0ec849 | 2014-10-13 | Martin Nilsson | | 7FFFFFFF FFFFFFFF D6FC2A2C 515DA54D 57EE2B10 139E9E78
EC5CE2C1 E7169B4A D4F09B20 8A3219FD E649CEE7 124D9F7C
BE97F1B1 B1863AEC 7B40D901 576230BD 69EF8F6A EAFEB2B0
9219FA8F AF833768 42B1B2AA 9EF68D79 DAAB89AF 3FABE49A
CC278638 707345BB F15344ED 79F7F439 0EF8AC50 9B56F39A
98566527 A41D3CBD 5E0558C1 59927DB0 E88454A5 D96471FD
DCB56D5B B06BFA34 0EA7A151 EF1CA6FA 572B76F3 B1B95D8C
8583D3E4 770536B8 4F017E70 E6FBF176 601A0266 941A17B0
C8B97F4E 74C2C1FF C7278919 777940C1 E1FF1D8D A637D6B9
9DDAFE5E 17611002 E2C778C1 BE8B41D9 6379A513 60D977FD
4435A11C 308FE7EE 6F1AAD9D B28C81AD DE1A7A6F 7CCE011C
30DA37E4 EB736483 BD6C8E93 48FBFBF7 2CC6587D 60C36C8E
577F0984 C289C938 5A098649 DE21BCA2 7A7EA229 716BA6E9
B279710F 38FAA5FF AE574155 CE4EFB4F 743695E2 911B1D06
D5E290CB CD86F56D 0EDFCD21 6AE22427 055E6835 FD29EEF7
9E0D9077 1FEACEBE 12F20E95 B34F0F78 B737A961 8B26FA7D
BC9874F2 72C42BDB 563EAFA1 6B4FB68C 3BB1E78E AA81A002
43FAADD2 BF18E63D 389AE443 77DA18C5 76B50F00 96CF3419
5483B005 48C09862 36E3BC7C B8D6801C 0494CCD1 99E5C5BD
0D0EDC9E B8A0001E 15276754 FCC68566 054148E6 E764BEE7
C764DAAD 3FC45235 A6DAD428 FA20C170 E345003F 2F06EC81
05FEB25B 2281B63D 2733BE96 1C29951D 11DD2221 657A9F53
1DDA2A19 4DBB1264 48BDEEB2 58E07EA6 59C74619 A6380E1D
66D6832B FE67F638 CD8FAE1F 2723020F 9C40A3FD A67EDA3B
D29238FB D4D4B488 5C2A9917 6DB1A06C 50077849 1A8288F1
855F60FF FCF1D137 3FD94FC6 0C1811E1 AC3F1C6D 003BECDA
3B1F2725 CA595DE0 CA63328F 3BE57CC9 77556011 95140DFB
59D39CE0 91308B41 05746DAC 23D33E5F 7CE4848D A316A9C6
6B9581BA 3573BFAF 31149618 8AB15423 282EE416 DC2A19C5
724FA91A E4ADC88B C66796EA E5677A01 F64E8C08 63139582
2D9DB8FC EE35C06B 1FEEA547 4D6D8F34 B1534A93 6A18B0E0
D20EAB86 BC9C6D6A 5207194E 67FA3555 1B568026 7B00641C
0F212D18 ECA8D732 7ED91FE7 64A84EA1 B43FF5B4 F6E8E62F
05C661DE FB258877 C35B18A1 51D5C414 AAAD97BA 3E499332
E596078E 600DEB81 149C441C E95782F2 2A282563 C5BAC141
1423605D 1AE1AFAE 2C8B0660 237EC128 AA0FE346 4E435811
5DB84CC3 B523073A 28D45498 84B81FF7 0E10BF36 1C137296
28D5348F 07211E7E 4CF4F18B 286090BD B1240B66 D6CD4AFC
EADC00CA 446CE050 50FF183A D2BBF118 C1FC0EA5 1F97D22B
8F7E4670 5D4527F4 5B42AEFF 39585337 6F697DD5 FDF2C518
7D7D5F0E 2EB8D43F 17BA0F7C 60FF437F 535DFEF2 9833BF86
CBE88EA4 FBD4221E 84117283 54FA30A7 008F154A 41C7FC46
6B4645DB E2E32126 7FFFFFFF FFFFFFFF
",16) )
|
1169d9 | 2004-05-02 | Martin Nilsson | | END_MARKER
|