Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit 0a3ad40

Browse files
authored
Test cases for A128/192GCM decryption
1 parent 8d0705b commit 0a3ad40

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/test_jwe_encryption.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,22 @@ def test_decrypt_a256gcm
9292
assert_equal decrypted['body']['mapping']['customer_identifier'], 'CUST_12345'
9393
assert !decrypted['body']['encrypted_data']
9494
end
95+
96+
def test_decrypt_a128gcm
97+
resp = File.read('./test/mock/jwe-response-a128gcm.json')
98+
jwe = McAPI::Encryption::JweEncryption.new(@test_config)
99+
decrypted = JSON.parse(jwe.decrypt(resp))
100+
assert_equal decrypted['body']['mapping']['customer_identifier'], 'CUST_12345'
101+
assert !decrypted['body']['encrypted_data']
102+
end
103+
104+
def test_decrypt_a192gcm
105+
resp = File.read('./test/mock/jwe-response-a192gcm.json')
106+
jwe = McAPI::Encryption::JweEncryption.new(@test_config)
107+
decrypted = JSON.parse(jwe.decrypt(resp))
108+
assert_equal decrypted['body']['mapping']['customer_identifier'], 'CUST_12345'
109+
assert !decrypted['body']['encrypted_data']
110+
end
95111

96112
def test_decrypt_cbc
97113
resp = File.read('./test/mock/jwe-response-cbc.json')

0 commit comments

Comments
 (0)