Skip to content

Commit 6731933

Browse files
author
Hiroshi Nakamura
committed
JRUBY-4326: Confusing (and late) OpenSSL error message
Notice the JCE restriction to users when InvalidKeyException is raised. This exception also thrown when IV length or key length is wrong but those length should be checked before initialization.
1 parent 1e037fa commit 6731933

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/java/org/jruby/ext/openssl/Cipher.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,8 @@ private void doInitialize() {
647647
} else {
648648
this.ciph.init(encryptMode ? javax.crypto.Cipher.ENCRYPT_MODE : javax.crypto.Cipher.DECRYPT_MODE, new SimpleSecretKey(realName.split("/")[0], this.key));
649649
}
650+
} catch (java.security.InvalidKeyException ike) {
651+
throw newCipherError(getRuntime(), ike.getMessage() + ": possibly you need to install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for your JRE");
650652
} catch (Exception e) {
651653
if (DEBUG) {
652654
e.printStackTrace();

0 commit comments

Comments
 (0)