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

Commit 8d0705b

Browse files
authored
Adding cases for A128/192GCM decryption
1 parent 6b3425f commit 8d0705b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/mcapi/encryption/crypto/jwe-crypto.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ def decrypt_data(encrypted_data:)
8686

8787
if enc_method == "A256GCM"
8888
enc_string = "aes-256-gcm"
89+
elsif enc_method == "A128GCM"
90+
enc_string = "aes-128-gcm"
91+
elsif enc_method == "A192GCM"
92+
enc_string = "aes-192-gcm"
8993
elsif enc_method == "A128CBC-HS256"
9094
cek = cek.byteslice(16, cek.length)
9195
enc_string = "aes-128-cbc"
@@ -100,6 +104,12 @@ def decrypt_data(encrypted_data:)
100104
if enc_method == "A256GCM"
101105
cipher.auth_data = encrypted_header
102106
cipher.auth_tag = cipher_tag
107+
elsif enc_method == "A128GCM"
108+
cipher.auth_data = encrypted_header
109+
cipher.auth_tag = cipher_tag
110+
elsif enc_method == "A192GCM"
111+
cipher.auth_data = encrypted_header
112+
cipher.auth_tag = cipher_tag
103113
end
104114

105115
cipher.update(cipher_text) + cipher.final

0 commit comments

Comments
 (0)