2021-08-10 15:08:46 +02:00
|
|
|
--
|
|
|
|
-- DES cipher
|
|
|
|
--
|
|
|
|
-- no official test vectors atm
|
|
|
|
-- from blowfish.sql
|
2021-12-08 06:01:35 +01:00
|
|
|
SELECT encrypt('\x0123456789abcdef', '\xfedcba9876543210', 'des-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
|
|
|
-- empty data
|
2021-12-08 06:01:35 +01:00
|
|
|
select encrypt('', 'foo', 'des');
|
2022-05-06 14:41:36 +02:00
|
|
|
ERROR: encrypt error: Cipher cannot be initialized
|
2021-08-10 15:08:46 +02:00
|
|
|
-- 8 bytes key
|
2021-12-08 06:01:35 +01:00
|
|
|
select encrypt('foo', '01234589', 'des');
|
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', 'des'), '0123456', 'des'), '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', 'des');
|
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('\x50735067b073bb93', '0123456', 'abcd', 'des'), '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.', '01234567', 'des');
|
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.', '01234567', 'des'), '01234567', 'des'), 'escape');
|
2022-05-06 14:41:36 +02:00
|
|
|
ERROR: encrypt error: Cipher cannot be initialized
|