# HG changeset patch # User alanb # Date 1464627353 -3600 # Node ID c57fc9cfae33ace6e199eeeeecf86461801ea5b3 # Parent 4af80d6e9e4d0d1a12e9ec6e077f485d637a5fb0# Parent b29b75c25015cc935b5becd052866d2606f64648 Merge diff -r 4af80d6e9e4d -r c57fc9cfae33 jdk/LICENSE --- a/jdk/LICENSE Mon May 30 17:38:05 2016 +0100 +++ b/jdk/LICENSE Mon May 30 17:55:53 2016 +0100 @@ -3,7 +3,7 @@ Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -287,8 +287,8 @@ more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., 59 - Temple Place, Suite 330, Boston, MA 02111-1307 USA + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. diff -r 4af80d6e9e4d -r c57fc9cfae33 jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java --- a/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java Mon May 30 17:38:05 2016 +0100 +++ b/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java Mon May 30 17:55:53 2016 +0100 @@ -91,6 +91,30 @@ } /* + * Retrieving the cipher's provider name for the debug purposes + * can throw an exception by itself. + */ + private static String safeProviderName(Cipher cipher) { + try { + return cipher.getProvider().toString(); + } catch (Exception e) { + if (debug != null && Debug.isOn("handshake")) { + System.out.println("Retrieving The Cipher provider name" + + " caused exception " + e.getMessage()); + } + } + try { + return cipher.toString() + " (provider name not available)"; + } catch (Exception e) { + if (debug != null && Debug.isOn("handshake")) { + System.out.println("Retrieving The Cipher name" + + " caused exception " + e.getMessage()); + } + } + return "(cipher/provider names not available)"; + } + + /* * Server gets the PKCS #1 (block format 02) data, decrypts * it with its private key. */ @@ -132,15 +156,19 @@ cipher.getProvider().getName()); } catch (InvalidKeyException | UnsupportedOperationException iue) { if (debug != null && Debug.isOn("handshake")) { - System.out.println("The Cipher provider " + - cipher.getProvider().getName() + - " caused exception: " + iue.getMessage()); + System.out.println("The Cipher provider " + + safeProviderName(cipher) + + " caused exception: " + iue.getMessage()); } needFailover = true; } if (needFailover) { + // The cipher might be spoiled by unsuccessful call to init(), + // so request a fresh instance + cipher = JsseJce.getCipher(JsseJce.CIPHER_RSA_PKCS1); + // Use DECRYPT_MODE and dispose the previous initialization. cipher.init(Cipher.DECRYPT_MODE, privateKey); boolean failed = false;