postgresql/contrib/pgcrypto/expected/cast5_1.out
Daniel Gustafsson 72bbff4cd6 Add alternative output for OpenSSL 3 without legacy loaded
OpenSSL 3 introduced the concept of providers to support modularization,
and moved the outdated ciphers to the new legacy provider. In case it's
not loaded in the users openssl.cnf file there will be a lot of regress
test failures, so add alternative outputs covering those.

Also document the need to load the legacy provider in order to use older
ciphers with OpenSSL-enabled pgcrypto.

This will be backpatched to all supported version once there is sufficient
testing in the buildfarm of OpenSSL 3.

Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/FEF81714-D479-4512-839B-C769D2605F8A@yesql.se
2021-08-10 15:08:46 +02:00

49 lines
1.8 KiB
Plaintext

--
-- Cast5 cipher
--
-- ensure consistent test output regardless of the default bytea format
SET bytea_output TO escape;
-- test vectors from RFC2144
-- 128 bit key
SELECT encode(encrypt(
decode('01 23 45 67 89 AB CD EF', 'hex'),
decode('01 23 45 67 12 34 56 78 23 45 67 89 34 56 78 9A', 'hex'),
'cast5-ecb/pad:none'), 'hex');
ERROR: encrypt error: Cipher cannot be initialized ?
-- result: 23 8B 4F E5 84 7E 44 B2
-- 80 bit key
SELECT encode(encrypt(
decode('01 23 45 67 89 AB CD EF', 'hex'),
decode('01 23 45 67 12 34 56 78 23 45', 'hex'),
'cast5-ecb/pad:none'), 'hex');
ERROR: encrypt error: Cipher cannot be initialized ?
-- result: EB 6A 71 1A 2C 02 27 1B
-- 40 bit key
SELECT encode(encrypt(
decode('01 23 45 67 89 AB CD EF', 'hex'),
decode('01 23 45 67 12', 'hex'),
'cast5-ecb/pad:none'), 'hex');
ERROR: encrypt error: Cipher cannot be initialized ?
-- result: 7A C8 16 D1 6E 9B 30 2E
-- cbc
-- empty data
select encode( encrypt('', 'foo', 'cast5'), 'hex');
ERROR: encrypt error: Cipher cannot be initialized ?
-- 10 bytes key
select encode( encrypt('foo', '0123456789', 'cast5'), 'hex');
ERROR: encrypt error: Cipher cannot be initialized ?
-- decrypt
select decrypt(encrypt('foo', '0123456', 'cast5'), '0123456', 'cast5');
ERROR: encrypt error: Cipher cannot be initialized ?
-- iv
select encode(encrypt_iv('foo', '0123456', 'abcd', 'cast5'), 'hex');
ERROR: encrypt_iv error: Cipher cannot be initialized ?
select decrypt_iv(decode('384a970695ce016a', 'hex'),
'0123456', 'abcd', 'cast5');
ERROR: decrypt_iv error: Cipher cannot be initialized ?
-- long message
select encode(encrypt('Lets try a longer message.', '0123456789', 'cast5'), 'hex');
ERROR: encrypt error: Cipher cannot be initialized ?
select decrypt(encrypt('Lets try a longer message.', '0123456789', 'cast5'), '0123456789', 'cast5');
ERROR: encrypt error: Cipher cannot be initialized ?