8035166: Remove dependency on EC classes from pkcs11 provider
Move the sun.security.ec.ECParameters and its related classes to sun.security.util package. Reviewed-by: mullan, vinnie
This commit is contained in:
parent
23f341125f
commit
3d60beae0d
jdk/src/share/classes
org/jcp/xml/dsig/internal/dom
sun/security
@ -364,7 +364,7 @@ public abstract class DOMKeyValue extends DOMStructure implements KeyValue {
|
||||
}
|
||||
|
||||
void getMethods() throws ClassNotFoundException, NoSuchMethodException {
|
||||
Class<?> c = Class.forName("sun.security.ec.ECParameters");
|
||||
Class<?> c = Class.forName("sun.security.util.ECParameters");
|
||||
Class<?>[] params = new Class<?>[] { ECPoint.class,
|
||||
EllipticCurve.class };
|
||||
encodePoint = c.getMethod("encodePoint", params);
|
||||
@ -372,7 +372,7 @@ public abstract class DOMKeyValue extends DOMStructure implements KeyValue {
|
||||
getCurveName = c.getMethod("getCurveName", params);
|
||||
params = new Class<?>[] { byte[].class, EllipticCurve.class };
|
||||
decodePoint = c.getMethod("decodePoint", params);
|
||||
c = Class.forName("sun.security.ec.NamedCurve");
|
||||
c = Class.forName("sun.security.util.NamedCurve");
|
||||
params = new Class<?>[] { String.class };
|
||||
getECParameterSpec = c.getMethod("getECParameterSpec", params);
|
||||
}
|
||||
@ -477,7 +477,7 @@ public abstract class DOMKeyValue extends DOMStructure implements KeyValue {
|
||||
throw new MarshalException(ite);
|
||||
}
|
||||
/*
|
||||
ecPoint = sun.security.ec.ECParameters.decodePoint(
|
||||
ecPoint = sun.security.util.ECParameters.decodePoint(
|
||||
Base64.decode(curElem), ecParams.getCurve());
|
||||
*/
|
||||
ECPublicKeySpec spec = new ECPublicKeySpec(ecPoint, ecParams);
|
||||
|
@ -32,11 +32,10 @@ import java.security.spec.ECGenParameterSpec;
|
||||
import java.security.spec.ECParameterSpec;
|
||||
import java.security.spec.ECPoint;
|
||||
|
||||
import sun.security.ec.NamedCurve;
|
||||
import sun.security.ec.ECParameters;
|
||||
import sun.security.ec.ECPrivateKeyImpl;
|
||||
import sun.security.ec.ECPublicKeyImpl;
|
||||
import sun.security.jca.JCAUtil;
|
||||
import sun.security.util.ECParameters;
|
||||
import sun.security.util.ECUtil;
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,11 @@ import java.security.*;
|
||||
import java.security.interfaces.*;
|
||||
import java.security.spec.*;
|
||||
|
||||
import sun.security.util.*;
|
||||
import sun.security.util.DerInputStream;
|
||||
import sun.security.util.DerOutputStream;
|
||||
import sun.security.util.DerValue;
|
||||
import sun.security.util.ECParameters;
|
||||
import sun.security.util.ECUtil;
|
||||
import sun.security.x509.AlgorithmId;
|
||||
import sun.security.pkcs.PKCS8Key;
|
||||
|
||||
|
@ -31,7 +31,9 @@ import java.security.*;
|
||||
import java.security.interfaces.*;
|
||||
import java.security.spec.*;
|
||||
|
||||
import sun.security.util.*;
|
||||
import sun.security.util.ECParameters;
|
||||
import sun.security.util.ECUtil;
|
||||
|
||||
import sun.security.x509.*;
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2014, 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
|
||||
@ -29,6 +29,8 @@ import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
import sun.security.util.CurveDB;
|
||||
import sun.security.util.NamedCurve;
|
||||
|
||||
/**
|
||||
* Defines the entries of the SunEC provider.
|
||||
@ -55,7 +57,7 @@ final class SunECEntries {
|
||||
/*
|
||||
* Algorithm Parameter engine
|
||||
*/
|
||||
map.put("AlgorithmParameters.EC", "sun.security.ec.ECParameters");
|
||||
map.put("AlgorithmParameters.EC", "sun.security.util.ECParameters");
|
||||
map.put("Alg.Alias.AlgorithmParameters.EllipticCurve", "EC");
|
||||
map.put("Alg.Alias.AlgorithmParameters.1.2.840.10045.2.1", "EC");
|
||||
|
||||
|
@ -67,8 +67,6 @@ import sun.security.util.Debug;
|
||||
import sun.security.util.DerValue;
|
||||
import sun.security.util.ECUtil;
|
||||
|
||||
import sun.security.ec.ECParameters;
|
||||
|
||||
import sun.security.pkcs11.Secmod.*;
|
||||
import static sun.security.pkcs11.P11Util.*;
|
||||
|
||||
|
@ -593,7 +593,7 @@ public final class SunPKCS11 extends AuthProvider {
|
||||
|
||||
// AlgorithmParameters for EC.
|
||||
// Only needed until we have an EC implementation in the SUN provider.
|
||||
d(AGP, "EC", "sun.security.ec.ECParameters",
|
||||
d(AGP, "EC", "sun.security.util.ECParameters",
|
||||
s("1.2.840.10045.2.1"),
|
||||
m(CKM_EC_KEY_PAIR_GEN, CKM_ECDH1_DERIVE,
|
||||
CKM_ECDSA, CKM_ECDSA_SHA1));
|
||||
@ -1032,7 +1032,7 @@ public final class SunPKCS11 extends AuthProvider {
|
||||
} else if (type == KS) {
|
||||
return token.getKeyStore();
|
||||
} else if (type == AGP) {
|
||||
return new sun.security.ec.ECParameters();
|
||||
return new sun.security.util.ECParameters();
|
||||
} else {
|
||||
throw new NoSuchAlgorithmException("Unknown type: " + type);
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ final class SupportedEllipticCurvesExtension extends HelloExtension {
|
||||
private final static int ARBITRARY_PRIME = 0xff01;
|
||||
private final static int ARBITRARY_CHAR2 = 0xff02;
|
||||
|
||||
// See sun.security.ec.NamedCurve for the OIDs
|
||||
// See sun.security.util.NamedCurve for the OIDs
|
||||
private final static String[] NAMED_CURVE_OID_TABLE = new String[] {
|
||||
null, // (0) unused
|
||||
"1.3.132.0.1", // (1) sect163k1, NIST K-163
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2014, 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
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.security.ec;
|
||||
package sun.security.util;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
@ -54,10 +54,10 @@ public class CurveDB {
|
||||
|
||||
private static Collection<? extends NamedCurve> specCollection;
|
||||
|
||||
static final String SPLIT_PATTERN = ",|\\[|\\]";
|
||||
public static final String SPLIT_PATTERN = ",|\\[|\\]";
|
||||
|
||||
// Used by SunECEntries
|
||||
static Collection<? extends NamedCurve>getSupportedCurves() {
|
||||
public static Collection<? extends NamedCurve>getSupportedCurves() {
|
||||
return specCollection;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2014, 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
|
||||
@ -23,15 +23,13 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.security.ec;
|
||||
package sun.security.util;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.security.*;
|
||||
import java.security.spec.*;
|
||||
|
||||
import sun.security.util.*;
|
||||
|
||||
/**
|
||||
* This class implements encoding and decoding of Elliptic Curve parameters
|
||||
* as specified in RFC 3279.
|
||||
@ -77,7 +75,7 @@ import sun.security.util.*;
|
||||
public final class ECParameters extends AlgorithmParametersSpi {
|
||||
|
||||
// used by ECPublicKeyImpl and ECPrivateKeyImpl
|
||||
static AlgorithmParameters getAlgorithmParameters(ECParameterSpec spec)
|
||||
public static AlgorithmParameters getAlgorithmParameters(ECParameterSpec spec)
|
||||
throws InvalidKeyException {
|
||||
try {
|
||||
AlgorithmParameters params =
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2014, 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
|
||||
@ -23,16 +23,13 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.security.ec;
|
||||
package sun.security.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
|
||||
import java.security.spec.*;
|
||||
|
||||
import sun.security.util.DerOutputStream;
|
||||
import sun.security.util.ObjectIdentifier;
|
||||
|
||||
|
||||
/**
|
||||
* Contains Elliptic Curve parameters.
|
||||
@ -40,7 +37,7 @@ import sun.security.util.ObjectIdentifier;
|
||||
* @since 1.6
|
||||
* @author Andreas Sterbenz
|
||||
*/
|
||||
class NamedCurve extends ECParameterSpec {
|
||||
public final class NamedCurve extends ECParameterSpec {
|
||||
|
||||
// friendly name for toString() output
|
||||
private final String name;
|
||||
@ -68,15 +65,15 @@ class NamedCurve extends ECParameterSpec {
|
||||
encoded = out.toByteArray();
|
||||
}
|
||||
|
||||
String getName() {
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
byte[] getEncoded() {
|
||||
public byte[] getEncoded() {
|
||||
return encoded.clone();
|
||||
}
|
||||
|
||||
String getObjectId() {
|
||||
public String getObjectId() {
|
||||
return oid;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user