jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java
changeset 24194 45f278eb1b37
parent 23733 b9b80421cfa7
equal deleted inserted replaced
24193:8d7364310e93 24194:45f278eb1b37
     1 /*
     1 /*
     2  * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   111             }
   111             }
   112         }
   112         }
   113 
   113 
   114         try {
   114         try {
   115             Cipher cipher = JsseJce.getCipher(JsseJce.CIPHER_RSA_PKCS1);
   115             Cipher cipher = JsseJce.getCipher(JsseJce.CIPHER_RSA_PKCS1);
   116             // Cannot generate key here, please don't use Cipher.UNWRAP_MODE!
       
   117             cipher.init(Cipher.UNWRAP_MODE, privateKey,
   116             cipher.init(Cipher.UNWRAP_MODE, privateKey,
   118                     new TlsRsaPremasterSecretParameterSpec(
   117                     new TlsRsaPremasterSecretParameterSpec(
   119                             maxVersion.v, currentVersion.v),
   118                             maxVersion.v, currentVersion.v),
   120                     generator);
   119                     generator);
   121             preMaster = (SecretKey)cipher.unwrap(encrypted,
   120             preMaster = (SecretKey)cipher.unwrap(encrypted,