2021-08-10 15:08:46 +02:00
|
|
|
--
|
|
|
|
-- Cast5 cipher
|
|
|
|
--
|
|
|
|
-- test vectors from RFC2144
|
|
|
|
-- 128 bit key
|
2021-12-08 06:01:35 +01:00
|
|
|
SELECT encrypt('\x0123456789ABCDEF', '\x0123456712345678234567893456789A', 'cast5-ecb/pad:none');
|
2022-05-06 14:41:36 +02:00
|
|
|
ERROR: encrypt error: Cipher cannot be initialized
|
2021-08-10 15:08:46 +02:00
|
|
|
-- 80 bit key
|
2021-12-08 06:01:35 +01:00
|
|
|
SELECT encrypt('\x0123456789ABCDEF', '\x01234567123456782345', 'cast5-ecb/pad:none');
|
2022-05-06 14:41:36 +02:00
|
|
|
ERROR: encrypt error: Cipher cannot be initialized
|
2021-08-10 15:08:46 +02:00
|
|
|
-- 40 bit key
|
2021-12-08 06:01:35 +01:00
|
|
|
SELECT encrypt('\x0123456789ABCDEF', '\x0123456712', 'cast5-ecb/pad:none');
|
2022-05-06 14:41:36 +02:00
|
|
|
ERROR: encrypt error: Cipher cannot be initialized
|
2021-08-10 15:08:46 +02:00
|
|
|
-- cbc
|
|
|
|
-- empty data
|
2021-12-08 06:01:35 +01:00
|
|
|
select encrypt('', 'foo', 'cast5');
|
2022-05-06 14:41:36 +02:00
|
|
|
ERROR: encrypt error: Cipher cannot be initialized
|
2021-08-10 15:08:46 +02:00
|
|
|
-- 10 bytes key
|
2021-12-08 06:01:35 +01:00
|
|
|
select encrypt('foo', '0123456789', 'cast5');
|
2022-05-06 14:41:36 +02:00
|
|
|
ERROR: encrypt error: Cipher cannot be initialized
|
2021-08-10 15:08:46 +02:00
|
|
|
-- decrypt
|
2021-12-08 06:01:35 +01:00
|
|
|
select encode(decrypt(encrypt('foo', '0123456', 'cast5'), '0123456', 'cast5'), 'escape');
|
2022-05-06 14:41:36 +02:00
|
|
|
ERROR: encrypt error: Cipher cannot be initialized
|
2021-08-10 15:08:46 +02:00
|
|
|
-- iv
|
2021-12-08 06:01:35 +01:00
|
|
|
select encrypt_iv('foo', '0123456', 'abcd', 'cast5');
|
2022-05-06 14:41:36 +02:00
|
|
|
ERROR: encrypt_iv error: Cipher cannot be initialized
|
2021-12-08 06:01:35 +01:00
|
|
|
select encode(decrypt_iv('\x384a970695ce016a', '0123456', 'abcd', 'cast5'), 'escape');
|
2022-05-06 14:41:36 +02:00
|
|
|
ERROR: decrypt_iv error: Cipher cannot be initialized
|
2021-08-10 15:08:46 +02:00
|
|
|
-- long message
|
2021-12-08 06:01:35 +01:00
|
|
|
select encrypt('Lets try a longer message.', '0123456789', 'cast5');
|
2022-05-06 14:41:36 +02:00
|
|
|
ERROR: encrypt error: Cipher cannot be initialized
|
2021-12-08 06:01:35 +01:00
|
|
|
select encode(decrypt(encrypt('Lets try a longer message.', '0123456789', 'cast5'), '0123456789', 'cast5'), 'escape');
|
2022-05-06 14:41:36 +02:00
|
|
|
ERROR: encrypt error: Cipher cannot be initialized
|