src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2018, 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 |
87 throw new InvalidAlgorithmParameterException(MSG); |
87 throw new InvalidAlgorithmParameterException(MSG); |
88 } |
88 } |
89 |
89 |
90 TlsRsaPremasterSecretParameterSpec spec = |
90 TlsRsaPremasterSecretParameterSpec spec = |
91 (TlsRsaPremasterSecretParameterSpec) params; |
91 (TlsRsaPremasterSecretParameterSpec) params; |
|
92 int tlsVersion = (spec.getMajorVersion() << 8) | spec.getMinorVersion(); |
92 |
93 |
93 int version = (spec.getMajorVersion() << 8) | spec.getMinorVersion(); |
94 if ((tlsVersion == 0x0300 && !supportSSLv3) || |
94 |
95 (tlsVersion < 0x0300) || (tlsVersion > 0x0303)) { |
95 if ((version == 0x0300 && !supportSSLv3) || (version < 0x0300) || |
|
96 (version > 0x0302)) { |
|
97 throw new InvalidAlgorithmParameterException |
96 throw new InvalidAlgorithmParameterException |
98 ("Only" + (supportSSLv3? " SSL 3.0,": "") + |
97 ("Only" + (supportSSLv3? " SSL 3.0,": "") + |
99 " TLS 1.0, and TLS 1.1 are supported (0x" + |
98 " TLS 1.0, TLS 1.1 and TLS 1.2 are supported (" + |
100 Integer.toHexString(version) + ")"); |
99 tlsVersion + ")"); |
101 } |
100 } |
102 this.spec = spec; |
101 this.spec = spec; |
103 } |
102 } |
104 |
103 |
105 protected void engineInit(int keysize, SecureRandom random) { |
104 protected void engineInit(int keysize, SecureRandom random) { |