From 713d61f7573ab2b7edbc4be4cb6015fac2ffa920 Mon Sep 17 00:00:00 2001 From: Aaron Jense Date: Fri, 29 Jun 2018 10:40:56 -0600 Subject: [PATCH] wolfssl-fips throws a different error message. Check if using fips and assertEquals on the proper expected error message. --- .../wolfssl/provider/jce/test/WolfCryptCipherTest.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/wolfssl/provider/jce/test/WolfCryptCipherTest.java b/src/test/java/com/wolfssl/provider/jce/test/WolfCryptCipherTest.java index 10c3295..1424c02 100644 --- a/src/test/java/com/wolfssl/provider/jce/test/WolfCryptCipherTest.java +++ b/src/test/java/com/wolfssl/provider/jce/test/WolfCryptCipherTest.java @@ -48,6 +48,8 @@ import java.security.NoSuchAlgorithmException; import java.security.InvalidKeyException; import java.security.InvalidAlgorithmParameterException; +import com.wolfssl.wolfcrypt.WolfCrypt; +import com.wolfssl.wolfcrypt.Fips; import com.wolfssl.provider.jce.WolfCryptProvider; import com.wolfssl.wolfcrypt.WolfCryptException; @@ -1158,7 +1160,12 @@ public class WolfCryptCipherTest { fail("Cipher.doFinal should throw exception when data is larger " + "than RSA key size"); } catch (WolfCryptException e) { - assertEquals("Rsa Padding error", e.getMessage()); + if (WolfCrypt.SUCCESS == Fips.wolfCrypt_GetStatus_fips()) { + assertEquals("Rsa Padding error", e.getMessage()); + } else { + assertEquals("Ciphertext to decrypt is out of range", + e.getMessage()); + } } }