/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
*
* @author Andreas Sterbenz
* @since 1.6
*/
+ "initialized using a TlsKeyMaterialParameterSpec";
private int protocolVersion;
public TlsKeyMaterialGenerator() {
}
throw new InvalidParameterException(MSG);
}
if (params instanceof TlsKeyMaterialParameterSpec == false) {
throw new InvalidAlgorithmParameterException(MSG);
}
throw new InvalidAlgorithmParameterException(
"Key format must be RAW");
}
| spec.getMinorVersion();
throw new InvalidAlgorithmParameterException(
"Only SSL 3.0, TLS 1.0/1.1/1.2 supported");
}
}
throw new InvalidParameterException(MSG);
}
throw new IllegalStateException(
"TlsKeyMaterialGenerator must be initialized");
}
try {
return engineGenerateKey0();
} catch (GeneralSecurityException e) {
throw new ProviderException(e);
}
}
keyBlockLen <<= 1;
byte[] keyBlock = new byte[keyBlockLen];
// These may be used again later for exportable suite calculations.
// generate key block
if (protocolVersion >= 0x0303) {
// TLS 1.2
} else if (protocolVersion >= 0x0301) {
// TLS 1.0/1.1
} else {
// SSL
keyBlock = new byte[keyBlockLen];
byte[] tmp = new byte[20];
remaining > 0;
i++, remaining -= 16) {
if (remaining >= 16) {
} else {
}
}
}
// partition keyblock into individual secrets
int ofs = 0;
// mac keys
}
// cipher keys
byte[] clientKeyBytes = new byte[keyLength];
byte[] serverKeyBytes = new byte[keyLength];
if (isExportable == false) {
// cipher keys
// IV keys if needed.
if (ivLength != 0) {
}
} else {
// if exportable suites, calculate the alternate
// cipher key expansion and IV generation
if (protocolVersion >= 0x0302) {
// TLS 1.1+
throw new RuntimeException(
"Internal Error: TLS 1.1+ should not be negotiating" +
"exportable ciphersuites");
} else if (protocolVersion == 0x0301) {
// TLS 1.0
if (ivLength != 0) {
}
} else {
// SSLv3
tmp = new byte[expandedKeyLength];
if (ivLength != 0) {
}
}
}
}
}