Skip to content

Commit

Permalink
[fix] [#3] Fix unit test for Java 21+ (@iarenaza)
Browse files Browse the repository at this point in the history
JDK-8302017 [1] introduced a change in the way padding errors are handled in RSA.
As a consequence, a new exception message was introduced that wasn't accounted for in the unit tests.

[1] Ref. <https://bugs.openjdk.org/browse/JDK-8302017> and associated back-porting issues
  • Loading branch information
ptaoussanis committed Jan 4, 2024
1 parent 178a729 commit 2509db6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/taoensso/tempel_tests.clj
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,8 @@
(is= (dec (enc ba-cnt kc1 {:ba-aad ba-aad
:ba-akm ba-akm}) kc1 {:ba-akm ba-akm }) {:cnt cnt, :aad "aad"} "+AKM, +AAD")

(is= (dec (enc ba-cnt kc1 { }) kc2 { }) {:err #{"Decryption error" "Message is larger than modulus"}} "Bad key")
(is= (dec (enc ba-cnt kc1 {:ba-akm ba-akm}) kc1 {:ba-akm ba-!akm}) {:err "Unexpected HMAC" #_"Tag mismatch"} "Bad AKM")
(is= (dec (enc ba-cnt kc1 { }) kc2 { }) {:err #{"Decryption error" "Message is larger than modulus" "Padding error in decryption"}} "Bad key")
(is= (dec (enc ba-cnt kc1 {:ba-akm ba-akm}) kc1 {:ba-akm ba-!akm}) {:err "Unexpected HMAC" #_"Tag mismatch"} "Bad AKM")

(is= (pd (enc ba-cnt kc1 { })) {:kind :encrypted-with-1-keypair, :key-algo :rsa-1024, :key-id "a" } "Public data")
(is= (pd (enc ba-cnt kc1 {:ba-aad ba-aad})) {:kind :encrypted-with-1-keypair, :key-algo :rsa-1024, :key-id "a", :aad "aad"} "Public data +AAD")
Expand Down

0 comments on commit 2509db6

Please sign in to comment.