Encap/decap in pkeyutl - tests
Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Viktor Dukhovni <viktor@openssl.org> Reviewed-by: Paul Dale <ppzgs1@gmail.com> (Merged from https://github.com/openssl/openssl/pull/25127)
This commit is contained in:
parent
14fa2f5f47
commit
bd3b24c3af
3
test/decap_out.bin
Normal file
3
test/decap_out.bin
Normal file
@ -0,0 +1,3 @@
|
||||
6žW«¡ŠòÌn‘©ú;’ù<1B>¡ÃÄmç Ä¥ÉB[HãÕË#äÓ‡(™‡hŽ]:\³PŸ›xñe¡ƒŽbòé)G¿fõÈ"¨ýËfË ÊýJÝ)ïþÜ<02>ì{ªHm‚\Pú<C383>+¸PÞ¸%èÄ/jÏ™%ç؆È<_æ~–
|
||||
K—JEhßù‡©lEa¼:¢(Ÿå/\Ñ®Íb<C38D>€Ã®©Ê×È-g,AYœ‹4<E280B9>
|
||||
l<EFBFBD>ÚtÚN)~\<5C>HU4y០}qJŸ€”t#<0C>¦}.™üTÅý”?ÚØÏŠÐÿcD=üLõ¨nmv<6D>{—éÅ¿Ô‹È£®
|
4
test/encap_out.bin
Normal file
4
test/encap_out.bin
Normal file
@ -0,0 +1,4 @@
|
||||
╪:Выy┌д░┴5╟Ц═Ъы[ш2Й<╬Й?╚Н╠qу╙1╥╣▄╦╨Фщ>YнMЕ╞╛3Pщ
|
||||
ЛшO▓2rхы┼МЫAd"GГ└m┤2mод7x∙яhЗ7-Ъ@:?N╣гrSЙ▀°Kа║·Х`╚t╔и÷╙сxiИЕ╓╢' MhЬЯ▒≤3r²▐чз┐√Sd╕ПO╠ёЦHT└F╖Ч
|
||||
╝▀kZ'x FшKЫx■q"прЗl@04E┴├лШ▌;c╬iA}UВф▄P6Щk0√┴С%DТРLд.U√═aO╗(L░IЩ╝QгГ╒оA
|
||||
▄[╢uт·ь4s$╗├р%tуB
|
3
test/encap_secret.bin
Normal file
3
test/encap_secret.bin
Normal file
@ -0,0 +1,3 @@
|
||||
6žW«¡ŠòÌn‘©ú;’ù<1B>¡ÃÄmç Ä¥ÉB[HãÕË#äÓ‡(™‡hŽ]:\³PŸ›xñe¡ƒŽbòé)G¿fõÈ"¨ýËfË ÊýJÝ)ïþÜ<02>ì{ªHm‚\Pú<C383>+¸PÞ¸%èÄ/jÏ™%ç؆È<_æ~–
|
||||
K—JEhßù‡©lEa¼:¢(Ÿå/\Ñ®Íb<C38D>€Ã®©Ê×È-g,AYœ‹4<E280B9>
|
||||
l<EFBFBD>ÚtÚN)~\<5C>HU4y០}qJŸ€”t#<0C>¦}.™üTÅý”?ÚØÏŠÐÿcD=üLõ¨nmv<6D>{—éÅ¿Ô‹È£®
|
@ -13,11 +13,11 @@ use File::Spec;
|
||||
use File::Basename;
|
||||
use OpenSSL::Test qw/:DEFAULT srctop_file ok_nofips/;
|
||||
use OpenSSL::Test::Utils;
|
||||
use File::Compare qw/compare_text/;
|
||||
use File::Compare qw/compare_text compare/;
|
||||
|
||||
setup("test_pkeyutl");
|
||||
|
||||
plan tests => 14;
|
||||
plan tests => 19;
|
||||
|
||||
# For the tests below we use the cert itself as the TBS file
|
||||
|
||||
@ -200,3 +200,33 @@ SKIP: {
|
||||
"-rawin");
|
||||
};
|
||||
}
|
||||
|
||||
#Encap/decap tests
|
||||
# openssl pkeyutl -encap -pubin -inkey rsa_pub.pem -secret secret.bin -out encap_out.bin
|
||||
# openssl pkeyutl -decap -inkey rsa_priv.pem -in encap_out.bin -out decap_out.bin
|
||||
# decap_out is equal to secret
|
||||
SKIP: {
|
||||
skip "RSA is not supported by this OpenSSL build", 3
|
||||
if disabled("rsa");
|
||||
|
||||
# Self-compat
|
||||
ok(run(app(([ 'openssl', 'pkeyutl', '-encap', '-pubin', '-kemop', 'RSASVE',
|
||||
'-inkey', srctop_file('test', 'testrsa2048pub.pem'),
|
||||
'-out', 'encap_out.bin', '-secret', 'secret.bin']))),
|
||||
"RSA pubkey encapsulation");
|
||||
ok(run(app(([ 'openssl', 'pkeyutl', '-decap', '-kemop', 'RSASVE',
|
||||
'-inkey', srctop_file('test', 'testrsa2048.pem'),
|
||||
'-in', 'encap_out.bin', '-out', 'decap_out.bin']))),
|
||||
"RSA pubkey decapsulation");
|
||||
is(compare("secret.bin", "decap_out.bin"), 0, "Secret is correctly decapsulated");
|
||||
|
||||
# Pregenerated
|
||||
ok(run(app(([ 'openssl', 'pkeyutl', '-decap', '-kemop', 'RSASVE',
|
||||
'-inkey', srctop_file('test', 'testrsa2048.pem'),
|
||||
'-in', srctop_file('test', 'encap_out.bin'), '-out', 'decap_out_etl.bin']))),
|
||||
"RSA pubkey decapsulation - pregenerated");
|
||||
|
||||
is(compare(srctop_file('test', 'encap_secret.bin'), "decap_out_etl.bin"), 0,
|
||||
"Secret is correctly decapsulated - pregenerated");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user