提交 6a158108 编写于 作者: I igerasim

8156502: Use short name of SupportedEllipticCurvesExtension.java

Reviewed-by: vinnie
上级 96ed4dfd
......@@ -1381,12 +1381,12 @@ final class ClientHandshaker extends Handshaker {
// add elliptic curves and point format extensions
if (cipherSuites.containsEC()) {
SupportedEllipticCurvesExtension ece =
SupportedEllipticCurvesExtension.createExtension(algorithmConstraints);
EllipticCurvesExtension ece =
EllipticCurvesExtension.createExtension(algorithmConstraints);
if (ece != null) {
clientHelloMessage.extensions.add(ece);
clientHelloMessage.extensions.add(
SupportedEllipticPointFormatsExtension.DEFAULT);
EllipticPointFormatsExtension.DEFAULT);
}
}
......
......@@ -60,7 +60,7 @@ final class ECDHCrypt {
try {
KeyPairGenerator kpg = JsseJce.getKeyPairGenerator("EC");
ECGenParameterSpec params =
SupportedEllipticCurvesExtension.getECGenParamSpec(curveId);
EllipticCurvesExtension.getECGenParamSpec(curveId);
kpg.initialize(params, random);
KeyPair kp = kpg.generateKeyPair();
privateKey = kp.getPrivate();
......
......@@ -41,7 +41,7 @@ import javax.net.ssl.SSLProtocolException;
import sun.security.action.GetPropertyAction;
final class SupportedEllipticCurvesExtension extends HelloExtension {
final class EllipticCurvesExtension extends HelloExtension {
/* Class and subclass dynamic debugging support */
private static final Debug debug = Debug.getInstance("ssl");
......@@ -226,12 +226,12 @@ final class SupportedEllipticCurvesExtension extends HelloExtension {
return false;
}
private SupportedEllipticCurvesExtension(int[] curveIds) {
private EllipticCurvesExtension(int[] curveIds) {
super(ExtensionType.EXT_ELLIPTIC_CURVES);
this.curveIds = curveIds;
}
SupportedEllipticCurvesExtension(HandshakeInStream s, int len)
EllipticCurvesExtension(HandshakeInStream s, int len)
throws IOException {
super(ExtensionType.EXT_ELLIPTIC_CURVES);
int k = s.getInt16();
......@@ -255,7 +255,7 @@ final class SupportedEllipticCurvesExtension extends HelloExtension {
return getActiveCurves(constraints) >= 0;
}
static SupportedEllipticCurvesExtension createExtension(
static EllipticCurvesExtension createExtension(
AlgorithmConstraints constraints) {
ArrayList<Integer> idList = new ArrayList<>(supportedCurveIds.length);
......@@ -274,7 +274,7 @@ final class SupportedEllipticCurvesExtension extends HelloExtension {
ids[i++] = id;
}
return new SupportedEllipticCurvesExtension(ids);
return new EllipticCurvesExtension(ids);
}
return null;
......
/*
* Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2016, 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
......@@ -31,24 +31,24 @@ import java.util.List;
import javax.net.ssl.SSLProtocolException;
final class SupportedEllipticPointFormatsExtension extends HelloExtension {
final class EllipticPointFormatsExtension extends HelloExtension {
final static int FMT_UNCOMPRESSED = 0;
final static int FMT_ANSIX962_COMPRESSED_PRIME = 1;
final static int FMT_ANSIX962_COMPRESSED_CHAR2 = 2;
static final HelloExtension DEFAULT =
new SupportedEllipticPointFormatsExtension(
new EllipticPointFormatsExtension(
new byte[] {FMT_UNCOMPRESSED});
private final byte[] formats;
private SupportedEllipticPointFormatsExtension(byte[] formats) {
private EllipticPointFormatsExtension(byte[] formats) {
super(ExtensionType.EXT_EC_POINT_FORMATS);
this.formats = formats;
}
SupportedEllipticPointFormatsExtension(HandshakeInStream s, int len)
EllipticPointFormatsExtension(HandshakeInStream s, int len)
throws IOException {
super(ExtensionType.EXT_EC_POINT_FORMATS);
formats = s.getBytes8();
......
......@@ -1010,7 +1010,7 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange {
ECParameterSpec params = publicKey.getParams();
ECPoint point = publicKey.getW();
pointBytes = JsseJce.encodePoint(point, params.getCurve());
curveId = SupportedEllipticCurvesExtension.getCurveIndex(params);
curveId = EllipticCurvesExtension.getCurveIndex(params);
if (privateKey == null) {
// ECDH_anon
......@@ -1048,13 +1048,11 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange {
// the supported curves during the exchange of the Hello messages.
if (curveType == CURVE_NAMED_CURVE) {
curveId = input.getInt16();
if (SupportedEllipticCurvesExtension.isSupported(curveId)
== false) {
if (!EllipticCurvesExtension.isSupported(curveId)) {
throw new SSLHandshakeException(
"Unsupported curveId: " + curveId);
}
String curveOid =
SupportedEllipticCurvesExtension.getCurveOid(curveId);
String curveOid = EllipticCurvesExtension.getCurveOid(curveId);
if (curveOid == null) {
throw new SSLHandshakeException(
"Unknown named curve: " + curveId);
......
......@@ -647,7 +647,7 @@ abstract class Handshaker {
boolean available = true;
if (suite.keyExchange.isEC) {
if (!checkedCurves) {
hasCurves = SupportedEllipticCurvesExtension
hasCurves = EllipticCurvesExtension
.hasActiveCurves(algorithmConstraints);
checkedCurves = true;
......@@ -738,7 +738,7 @@ abstract class Handshaker {
boolean available = true;
if (suite.keyExchange.isEC) {
if (!checkedCurves) {
hasCurves = SupportedEllipticCurvesExtension
hasCurves = EllipticCurvesExtension
.hasActiveCurves(algorithmConstraints);
checkedCurves = true;
......
/*
* Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2016, 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
......@@ -49,8 +49,8 @@ import javax.net.ssl.*;
* explicitly support.
* . ServerNameExtension: the server_name extension.
* . SignatureAlgorithmsExtension: the signature_algorithms extension.
* . SupportedEllipticCurvesExtension: the ECC supported curves extension.
* . SupportedEllipticPointFormatsExtension: the ECC supported point formats
* . EllipticCurvesExtension: the ECC supported curves extension.
* . EllipticPointFormatsExtension: the ECC supported point formats
* (compressed/uncompressed) extension.
*
* @since 1.6
......@@ -79,10 +79,9 @@ final class HelloExtensions {
} else if (extType == ExtensionType.EXT_SIGNATURE_ALGORITHMS) {
extension = new SignatureAlgorithmsExtension(s, extlen);
} else if (extType == ExtensionType.EXT_ELLIPTIC_CURVES) {
extension = new SupportedEllipticCurvesExtension(s, extlen);
extension = new EllipticCurvesExtension(s, extlen);
} else if (extType == ExtensionType.EXT_EC_POINT_FORMATS) {
extension =
new SupportedEllipticPointFormatsExtension(s, extlen);
extension = new EllipticPointFormatsExtension(s, extlen);
} else if (extType == ExtensionType.EXT_RENEGOTIATION_INFO) {
extension = new RenegotiationInfoExtension(s, extlen);
} else {
......
......@@ -93,7 +93,7 @@ final class ServerHandshaker extends Handshaker {
private ProtocolVersion clientRequestedVersion;
// client supported elliptic curves
private SupportedEllipticCurvesExtension requestedCurves;
private EllipticCurvesExtension requestedCurves;
// the preferable signature algorithm used by ServerKeyExchange message
SignatureAndHashAlgorithm preferableSignatureAlgorithm;
......@@ -683,7 +683,7 @@ final class ServerHandshaker extends Handshaker {
throw new SSLException("Client did not resume a session");
}
requestedCurves = (SupportedEllipticCurvesExtension)
requestedCurves = (EllipticCurvesExtension)
mesg.extensions.get(ExtensionType.EXT_ELLIPTIC_CURVES);
// We only need to handle the "signature_algorithm" extension
......@@ -1422,7 +1422,7 @@ final class ServerHandshaker extends Handshaker {
private boolean setupEphemeralECDHKeys() {
int index = (requestedCurves != null) ?
requestedCurves.getPreferredCurve(algorithmConstraints) :
SupportedEllipticCurvesExtension.getActiveCurves(algorithmConstraints);
EllipticCurvesExtension.getActiveCurves(algorithmConstraints);
if (index < 0) {
// no match found, cannot use this ciphersuite
return false;
......@@ -1477,8 +1477,8 @@ final class ServerHandshaker extends Handshaker {
return false;
}
ECParameterSpec params = ((ECPublicKey)publicKey).getParams();
int id = SupportedEllipticCurvesExtension.getCurveIndex(params);
if ((id <= 0) || !SupportedEllipticCurvesExtension.isSupported(id) ||
int id = EllipticCurvesExtension.getCurveIndex(params);
if ((id <= 0) || !EllipticCurvesExtension.isSupported(id) ||
((requestedCurves != null) && !requestedCurves.contains(id))) {
return false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册