Skip to content

Commit

Permalink
add negative test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
wuriyanto48 committed Aug 31, 2023
1 parent 6b62c92 commit 2a22ce4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/test.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
-- test should return a value of "t", which means the test cases are working as expected --

-- AES GCM test --
select 'hello world' = pgcrypsi_aes_128_gcm_decrypt('abc$#128djdyAgbj', pgcrypsi_aes_128_gcm_encrypt('abc$#128djdyAgbj', 'hello world')) as res;
select 'hello world' = pgcrypsi_aes_192_gcm_decrypt('abc$#128djdyAgbjau&YAnmc', pgcrypsi_aes_192_gcm_encrypt('abc$#128djdyAgbjau&YAnmc', 'hello world')) as res;
select 'hello world' = pgcrypsi_aes_256_gcm_decrypt('abc$#128djdyAgbjau&YAnmcbagryt5x', pgcrypsi_aes_256_gcm_encrypt('abc$#128djdyAgbjau&YAnmcbagryt5x', 'hello world')) as res;
select 'hello world' = pgcrypsi_aes_128_gcm_decrypt('abc$#128djdyAgbj', pgcrypsi_aes_128_gcm_encrypt('abc$#128djdyAgbj', 'hello world')) as res_pgcrypsi_aes_128_gcm_decrypt_valid;
select 'hello world' = pgcrypsi_aes_192_gcm_decrypt('abc$#128djdyAgbjau&YAnmc', pgcrypsi_aes_192_gcm_encrypt('abc$#128djdyAgbjau&YAnmc', 'hello world')) as res_pgcrypsi_aes_192_gcm_decrypt_valid;
select 'hello world' = pgcrypsi_aes_256_gcm_decrypt('abc$#128djdyAgbjau&YAnmcbagryt5x', pgcrypsi_aes_256_gcm_encrypt('abc$#128djdyAgbjau&YAnmcbagryt5x', 'hello world')) as res_pgcrypsi_aes_256_gcm_decrypt_valid;

select 'hello world' != pgcrypsi_aes_128_gcm_decrypt('abc$#128djdyAgbj', pgcrypsi_aes_128_gcm_encrypt('abc$#128djdyAgbj', 'hello worldie')) as res_pgcrypsi_aes_128_gcm_decrypt_invalid;
select 'hello world' != pgcrypsi_aes_192_gcm_decrypt('abc$#128djdyAgbjau&YAnmc', pgcrypsi_aes_192_gcm_encrypt('abc$#128djdyAgbjau&YAnmc', 'hello worldie')) as res_pgcrypsi_aes_192_gcm_decrypt_invalid;
select 'hello world' != pgcrypsi_aes_256_gcm_decrypt('abc$#128djdyAgbjau&YAnmcbagryt5x', pgcrypsi_aes_256_gcm_encrypt('abc$#128djdyAgbjau&YAnmcbagryt5x', 'hello worldie')) as res_pgcrypsi_aes_256_gcm_decrypt_invalid;

0 comments on commit 2a22ce4

Please sign in to comment.