--- a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java Thu Sep 25 13:03:27 2014 +0200
+++ b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java Thu Sep 25 12:24:19 2014 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -167,6 +167,11 @@
private static final Debug debug =
Debug.getInstance("jca", "Cipher");
+ private static final Debug pdebug =
+ Debug.getInstance("provider", "Provider");
+ private static final boolean skipDebug =
+ Debug.isOn("engine=") && !Debug.isOn("cipher");
+
/**
* Constant used to initialize cipher to encryption mode.
*/
@@ -1110,6 +1115,21 @@
}
}
+ private static String getOpmodeString(int opmode) {
+ switch (opmode) {
+ case ENCRYPT_MODE:
+ return "encryption";
+ case DECRYPT_MODE:
+ return "decryption";
+ case WRAP_MODE:
+ return "key wrapping";
+ case UNWRAP_MODE:
+ return "key unwrapping";
+ default:
+ return "";
+ }
+ }
+
/**
* Initializes this cipher with a key.
*
@@ -1235,6 +1255,12 @@
initialized = true;
this.opmode = opmode;
+
+ if (!skipDebug && pdebug != null) {
+ pdebug.println("Cipher." + transformation + " " +
+ getOpmodeString(opmode) + " algorithm from: " +
+ this.provider.getName());
+ }
}
/**
@@ -1372,6 +1398,12 @@
initialized = true;
this.opmode = opmode;
+
+ if (!skipDebug && pdebug != null) {
+ pdebug.println("Cipher." + transformation + " " +
+ getOpmodeString(opmode) + " algorithm from: " +
+ this.provider.getName());
+ }
}
/**
@@ -1509,6 +1541,12 @@
initialized = true;
this.opmode = opmode;
+
+ if (!skipDebug && pdebug != null) {
+ pdebug.println("Cipher." + transformation + " " +
+ getOpmodeString(opmode) + " algorithm from: " +
+ this.provider.getName());
+ }
}
/**
@@ -1693,6 +1731,12 @@
initialized = true;
this.opmode = opmode;
+
+ if (!skipDebug && pdebug != null) {
+ pdebug.println("Cipher." + transformation + " " +
+ getOpmodeString(opmode) + " algorithm from: " +
+ this.provider.getName());
+ }
}
/**