8130181: Deprecate java.security.Provider(String, double, String), add Provider(Strin

Added Provider constructor which uses version String and use sun.security.util.PROVIDER_VER

Reviewed-by: weijun
This commit is contained in:
Valerie Peng 2016-08-19 06:27:54 +00:00
parent d7fd2d9166
commit c846a862ee
55 changed files with 312 additions and 164 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 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
@ -26,6 +26,7 @@
package apple.security;
import java.security.*;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* The Apple Security Provider.
@ -74,7 +75,7 @@ public final class AppleProvider extends Provider {
public AppleProvider() {
/* We are the Apple provider */
super("Apple", 9.0d, info);
super("Apple", PROVIDER_VER, info);
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -28,6 +28,7 @@ package com.sun.crypto.provider;
import java.security.AccessController;
import java.security.Provider;
import java.security.SecureRandom;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
@ -104,7 +105,7 @@ public final class SunJCE extends Provider {
public SunJCE() {
/* We are the "SunJCE" provider */
super("SunJCE", 9.0d, info);
super("SunJCE", PROVIDER_VER, info);
final String BLOCK_MODES = "ECB|CBC|PCBC|CTR|CTS|CFB|OFB" +
"|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64" +

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -50,9 +50,24 @@ public abstract class AuthProvider extends Provider {
* @param name the provider name.
* @param version the provider version number.
* @param info a description of the provider and its services.
* @deprecated use {@link #AuthProvider(String, String, String)} instead.
*/
@Deprecated(since="9")
protected AuthProvider(String name, double version, String info) {
super(name, version, info);
super(name, Double.toString(version), info);
}
/**
* Constructs a provider with the specified name, version string,
* and information.
*
* @param name the provider name.
* @param versionStr the provider version string.
* @param info a description of the provider and its services.
* @since 9
*/
protected AuthProvider(String name, String versionStr, String info) {
super(name, versionStr, info);
}
/**

View File

@ -67,14 +67,14 @@ import java.util.function.Function;
* <tr><td>{@code Provider.id name}</td>
* <td>{@code String.valueOf(provider.getName())}</td>
* <tr><td>{@code Provider.id version}</td>
* <td>{@code String.valueOf(provider.getVersion())}</td>
* <td>{@code String.valueOf(provider.getVersionStr())}</td>
* <tr><td>{@code Provider.id info}</td>
<td>{@code String.valueOf(provider.getInfo())}</td>
* <tr><td>{@code Provider.id className}</td>
* <td>{@code provider.getClass().getName()}</td>
* </table>
*
* <p>Each provider has a name and a version number. A provider normally
* <p>Each provider has a name and a version string. A provider normally
* identifies itself with a file named {@code java.security.Provider}
* in the resource directory {@code META-INF/services}.
* Security providers are looked up via the {@link ServiceLoader} mechanism
@ -102,11 +102,10 @@ import java.util.function.Function;
public abstract class Provider extends Properties {
// Declare serialVersionUID to be compatible with JDK1.1
static final long serialVersionUID = -4298000515446427739L;
private static final long serialVersionUID = -4298000515446427739L;
private static final sun.security.util.Debug debug =
sun.security.util.Debug.getInstance
("provider", "Provider");
sun.security.util.Debug.getInstance("provider", "Provider");
/**
* The provider name.
@ -129,6 +128,12 @@ public abstract class Provider extends Properties {
*/
private double version;
/**
* The provider version string.
*
* @serial
*/
private String versionStr;
private transient Set<Map.Entry<Object,Object>> entrySet = null;
private transient int entrySetCallCount = 0;
@ -174,19 +179,83 @@ public abstract class Provider extends Properties {
}
}
private static double parseVersionStr(String s) {
try {
int firstDotIdx = s.indexOf('.');
int nextDotIdx = s.indexOf('.', firstDotIdx + 1);
if (nextDotIdx != -1) {
s = s.substring(0, nextDotIdx);
}
int endIdx = s.indexOf('-');
if (endIdx > 0) {
s = s.substring(0, endIdx);
}
endIdx = s.indexOf('+');
if (endIdx > 0) {
s = s.substring(0, endIdx);
}
return Double.parseDouble(s);
} catch (NullPointerException | NumberFormatException e) {
return 0d;
}
}
/**
* Constructs a provider with the specified name, version number,
* and information.
* and information. Calling this constructor is equivalent to call the
* {@link #Provider(String, String, String)} with {@code name}
* name, {@code Double.toString(version)}, and {@code info}.
*
* @param name the provider name.
*
* @param version the provider version number.
*
* @param info a description of the provider and its services.
*
* @deprecated use {@link #Provider(String, String, String)} instead.
*/
@Deprecated(since="9")
protected Provider(String name, double version, String info) {
this.name = name;
this.version = version;
this.versionStr = Double.toString(version);
this.info = info;
putId();
initialized = true;
}
/**
* Constructs a provider with the specified name, version string,
* and information.
*
* <p>The version string contains a version number optionally followed
* by other information separated by one of the characters of '+', '-'.
*
* The format for the version number is:
*
* <blockquote><pre>
* ^[0-9]+(\.[0-9]+)*
* </pre></blockquote>
*
* <p>In order to return the version number in a double, when there are
* more than two components (separated by '.' as defined above), only
* the first two components are retained. The resulting string is then
* passed to {@link Double#valueOf(String)} to generate version number,
* i.e. {@link #getVersion}.
* <p>If the conversion failed, value 0 will be used.
*
* @param name the provider name.
*
* @param versionStr the provider version string.
*
* @param info a description of the provider and its services.
*
* @since 9
*/
protected Provider(String name, String versionStr, String info) {
this.name = name;
this.versionStr = versionStr;
this.version = parseVersionStr(versionStr);
this.info = info;
putId();
initialized = true;
@ -250,11 +319,25 @@ public abstract class Provider extends Properties {
* Returns the version number for this provider.
*
* @return the version number for this provider.
*
* @deprecated use {@link #getVersionStr} instead.
*/
@Deprecated(since="9")
public double getVersion() {
return version;
}
/**
* Returns the version string for this provider.
*
* @return the version string for this provider.
*
* @since 9
*/
public String getVersionStr() {
return versionStr;
}
/**
* Returns a human-readable description of the provider and its
* services. This may return an HTML page, with relevant links.
@ -266,14 +349,14 @@ public abstract class Provider extends Properties {
}
/**
* Returns a string with the name and the version number
* Returns a string with the name and the version string
* of this provider.
*
* @return the string with the name and the version number
* @return the string with the name and the version string
* for this provider.
*/
public String toString() {
return name + " version " + version;
return name + " version " + versionStr;
}
/*
@ -787,11 +870,21 @@ public abstract class Provider extends Properties {
private void putId() {
// note: name and info may be null
super.put("Provider.id name", String.valueOf(name));
super.put("Provider.id version", String.valueOf(version));
super.put("Provider.id version", String.valueOf(versionStr));
super.put("Provider.id info", String.valueOf(info));
super.put("Provider.id className", this.getClass().getName());
}
/**
* Reads the {@code ObjectInputStream} for the default serializable fields.
* If the serialized field {@code versionStr} is found in the STREAM FIELDS,
* its String value will be used to populate both the version string and
* version number. If {@code versionStr} is not found, but {@code version}
* is, then its double value will be used to populate both fields.
*
* @param in the {@code ObjectInputStream} to read
* @serial
*/
private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException {
Map<Object,Object> copy = new HashMap<>();
@ -800,6 +893,13 @@ public abstract class Provider extends Properties {
}
defaults = null;
in.defaultReadObject();
if (this.versionStr == null) {
// set versionStr based on version when not found in serialized bytes
this.versionStr = Double.toString(this.version);
} else {
// otherwise, set version based on versionStr
this.version = parseVersionStr(this.versionStr);
}
implClear();
initialized = true;
putAll(copy);
@ -1913,7 +2013,5 @@ public abstract class Provider extends Properties {
return provider.getName() + ": " + type + "." + algorithm
+ " -> " + className + aString + attrs + "\r\n";
}
}
}

View File

@ -76,7 +76,7 @@ public final class ProviderList {
// dummy provider object to use during initialization
// used to avoid explicit null checks in various places
private static final Provider EMPTY_PROVIDER =
new Provider("##Empty##", 1.0d, "initialization in progress") {
new Provider("##Empty##", "1.0", "initialization in progress") {
private static final long serialVersionUID = 1151354171352296389L;
// override getService() to return null slightly faster
public Service getService(String type, String algorithm) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -28,6 +28,7 @@ package sun.security.provider;
import java.security.*;
import static sun.security.provider.ByteArrayAccess.*;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* The MD4 class is used to compute an MD4 message digest over a given
@ -65,7 +66,8 @@ public final class MD4 extends DigestBase {
private static final Provider md4Provider;
static {
md4Provider = new Provider("MD4Provider", 9.0d, "MD4 MessageDigest") {
md4Provider = new Provider("MD4Provider", PROVIDER_VER,
"MD4 MessageDigest") {
private static final long serialVersionUID = -8850464997518327965L;
};
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
@ -29,6 +29,8 @@ import java.util.*;
import java.security.*;
import sun.security.action.PutAllAction;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* The SUN Security Provider.
@ -47,7 +49,7 @@ public final class Sun extends Provider {
public Sun() {
/* We are the SUN provider */
super("SUN", 9.0d, INFO);
super("SUN", PROVIDER_VER, INFO);
// if there is no security manager installed, put directly into
// the provider. Otherwise, create a temporary map and use a

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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,6 +31,8 @@ import java.security.*;
import sun.security.action.PutAllAction;
import sun.security.rsa.SunRsaSignEntries;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* Provider used for verification of signed JAR files *if* the Sun and
@ -61,7 +63,7 @@ public final class VerificationProvider extends Provider {
}
public VerificationProvider() {
super("SunJarVerification", 9.0d, "Jar Verification Provider");
super("SunJarVerification", PROVIDER_VER, "Jar Verification Provider");
// register all algorithms normally registered by the Sun and SunRsaSign
// providers, but only if they are missing
if (ACTIVE == false) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -30,6 +30,7 @@ import java.util.*;
import java.security.*;
import sun.security.action.PutAllAction;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* Provider class for the RSA signature provider. Supports RSA keyfactory,
@ -43,7 +44,7 @@ public final class SunRsaSign extends Provider {
private static final long serialVersionUID = 866040293550393045L;
public SunRsaSign() {
super("SunRsaSign", 9.0d, "Sun RSA signature provider");
super("SunRsaSign", PROVIDER_VER, "Sun RSA signature provider");
// if there is no security manager installed, put directly into
// the provider. Otherwise, create a temporary map and use a

View File

@ -44,6 +44,7 @@ import sun.security.jca.ProviderList;
import sun.security.util.ECUtil;
import static sun.security.ssl.SunJSSE.cryptoProvider;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* This class contains a few static methods for interaction with the JCA/JCE
@ -90,7 +91,7 @@ final class JsseJce {
private static final long serialVersionUID = -3284138292032213752L;
SunCertificates(final Provider p) {
super("SunCertificates", 9.0d, "SunJSSE internal");
super("SunCertificates", PROVIDER_VER, "SunJSSE internal");
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {

View File

@ -27,6 +27,7 @@
package sun.security.ssl;
import java.security.*;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* The JSSE provider.
@ -104,7 +105,7 @@ public abstract class SunJSSE extends java.security.Provider {
// standard constructor
protected SunJSSE() {
super("SunJSSE", 9.0d, info);
super("SunJSSE", PROVIDER_VER, info);
subclassCheck();
if (Boolean.TRUE.equals(fips)) {
throw new ProviderException
@ -132,7 +133,7 @@ public abstract class SunJSSE extends java.security.Provider {
private SunJSSE(java.security.Provider cryptoProvider,
String providerName) {
super("SunJSSE", 9.0d, fipsInfo + providerName + ")");
super("SunJSSE", PROVIDER_VER, fipsInfo + providerName + ")");
subclassCheck();
if (cryptoProvider == null) {
// Calling Security.getProvider() will cause other providers to be

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -33,6 +33,7 @@ import java.security.Permission;
import java.security.BasicPermission;
import java.security.SecurityPermission;
import java.security.AllPermission;
import sun.security.action.GetPropertyAction;
/**
* Permission constants and string constants used to create permissions
@ -145,4 +146,7 @@ public final class SecurityConstants {
// java.lang.SecurityManager
public static final SocketPermission LOCAL_LISTEN_PERMISSION =
new SocketPermission("localhost:0", SOCKET_LISTEN_ACTION);
public static final String PROVIDER_VER =
GetPropertyAction.privilegedGetProperty("java.specification.version");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
@ -29,6 +29,7 @@ import java.util.HashMap;
import java.util.List;
import java.security.*;
import java.security.cert.CertStoreParameters;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* Provider class for the JdkLDAP provider.
@ -69,7 +70,7 @@ public final class JdkLDAP extends Provider {
}
public JdkLDAP() {
super("JdkLDAP", 9.0d, "JdkLDAP Provider (implements LDAP CertStore)");
super("JdkLDAP", PROVIDER_VER, "JdkLDAP Provider (implements LDAP CertStore)");
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -33,6 +33,7 @@ import java.security.InvalidParameterException;
import java.security.ProviderException;
import sun.security.jgss.krb5.Krb5MechFactory;
import sun.security.jgss.spnego.SpNegoMechFactory;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* Defines the Sun JGSS provider.
@ -99,7 +100,7 @@ public final class SunProvider extends Provider {
public SunProvider() {
/* We are the Sun JGSS provider */
super("SunJGSS", 9.0d, INFO);
super("SunJGSS", PROVIDER_VER, INFO);
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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,6 +31,7 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import org.ietf.jgss.Oid;
import sun.security.action.PutAllAction;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* Defines the Sun NativeGSS provider for plugging in the
@ -120,7 +121,7 @@ public final class SunNativeProvider extends Provider {
public SunNativeProvider() {
/* We are the Sun NativeGSS provider */
super(NAME, 9.0d, INFO);
super(NAME, PROVIDER_VER, INFO);
if (MECH_MAP != null) {
AccessController.doPrivileged(new PutAllAction(this, MECH_MAP));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -29,6 +29,7 @@ import java.security.PrivilegedAction;
import java.security.NoSuchAlgorithmException;
import java.security.InvalidParameterException;
import java.security.ProviderException;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* The SASL provider.
@ -98,7 +99,7 @@ public final class Provider extends java.security.Provider {
}
public Provider() {
super("SunSASL", 9.0d, info);
super("SunSASL", PROVIDER_VER, info);
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -134,7 +134,7 @@ public final class TerminalFactory {
private static final long serialVersionUID = 2745808869881593918L;
final static Provider INSTANCE = new NoneProvider();
private NoneProvider() {
super("None", 1.0d, "none");
super("None", "1.0", "none");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -28,6 +28,7 @@ package sun.security.smartcardio;
import java.security.*;
import javax.smartcardio.*;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* Provider object for PC/SC.
@ -65,7 +66,7 @@ public final class SunPCSC extends Provider {
}
public SunPCSC() {
super("SunPCSC", 9.0d, "Sun PC/SC provider");
super("SunPCSC", PROVIDER_VER, "Sun PC/SC provider");
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -28,7 +28,7 @@
* ===========================================================================
*/
/*
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* $Id: XMLDSigRI.java 1400021 2012-10-19 10:16:04Z coheigea $
@ -59,6 +59,13 @@ public final class XMLDSigRI extends Provider {
"C14N 1.0, C14N 1.1, Exclusive C14N, Base64, Enveloped, XPath, " +
"XPath2, XSLT TransformServices)";
private static final String VER =
AccessController.doPrivileged(new PrivilegedAction<>() {
public String run() {
return System.getProperty("java.specification.version");
}
});
private static final class ProviderService extends Provider.Service {
ProviderService(Provider p, String type, String algo, String cn) {
@ -129,7 +136,7 @@ public final class XMLDSigRI extends Provider {
public XMLDSigRI() {
/* We are the XMLDSig provider */
super("XMLDSig", 9.0d, INFO);
super("XMLDSig", VER, INFO);
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 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,6 +31,7 @@ import java.util.regex.Pattern;
import sun.security.util.CurveDB;
import sun.security.util.NamedCurve;
import sun.security.util.ECParameters;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* Provider class for the Elliptic Curve provider.
@ -142,7 +143,8 @@ public final class SunEC extends Provider {
}
public SunEC() {
super("SunEC", 9.0d, "Sun Elliptic Curve provider (EC, ECDSA, ECDH)");
super("SunEC", PROVIDER_VER,
"Sun Elliptic Curve provider (EC, ECDSA, ECDH)");
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
putEntries(useFullImplementation);

View File

@ -33,6 +33,7 @@ import java.security.InvalidParameterException;
import java.security.ProviderException;
import java.util.HashMap;
import java.util.Arrays;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* A Cryptographic Service Provider for the Microsoft Crypto API.
@ -124,7 +125,7 @@ public final class SunMSCAPI extends Provider {
}
public SunMSCAPI() {
super("SunMSCAPI", 9.0d, INFO);
super("SunMSCAPI", PROVIDER_VER, INFO);
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -44,6 +44,7 @@ import javax.security.auth.callback.TextOutputCallback;
import sun.security.util.Debug;
import sun.security.util.ResourcesMgr;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
import sun.security.pkcs11.Secmod.*;
@ -89,7 +90,8 @@ public final class SunPKCS11 extends AuthProvider {
}
public SunPKCS11() {
super("SunPKCS11", 9.0d, "Unconfigured and unusable PKCS11 provider");
super("SunPKCS11", PROVIDER_VER,
"Unconfigured and unusable PKCS11 provider");
p11 = null;
config = null;
slotID = 0;
@ -132,7 +134,7 @@ public final class SunPKCS11 extends AuthProvider {
// Used by Secmod
SunPKCS11(Config c) {
super("SunPKCS11-" + c.getName(), 9.0d, c.getDescription());
super("SunPKCS11-" + c.getName(), PROVIDER_VER, c.getDescription());
this.config = c;
if (debug != null) {

View File

@ -30,6 +30,8 @@ import java.io.File;
import java.lang.reflect.Constructor;
import java.util.*;
import java.security.*;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* OracleUcrypto provider main class.
@ -196,7 +198,7 @@ public final class UcryptoProvider extends Provider {
}
public UcryptoProvider() {
super("OracleUcrypto", 9.0d, "Provider using Oracle Ucrypto API");
super("OracleUcrypto", PROVIDER_VER, "Provider using Oracle Ucrypto API");
AccessController.doPrivileged(new PrivilegedAction<>() {
public Void run() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
@ -30,6 +30,8 @@ import java.security.Provider;
import java.security.NoSuchAlgorithmException;
import java.security.InvalidParameterException;
import java.security.ProviderException;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
/**
* The JdkSASL provider class -
@ -73,7 +75,7 @@ public final class JdkSASL extends Provider {
}
public JdkSASL() {
super("JdkSASL", 9.0d, info);
super("JdkSASL", PROVIDER_VER, info);
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 4667976
* @bug 4667976 8130181
* @modules java.base/com.sun.net.ssl
* @compile JavaxSSLContextImpl.java ComSSLContextImpl.java
* JavaxTrustManagerFactoryImpl.java ComTrustManagerFactoryImpl.java
@ -85,7 +85,7 @@ class MyProvider extends Provider {
public MyProvider()
{
super("BRAD", 1.0, info);
super("BRAD", "1.0", info);
AccessController.doPrivileged(new java.security.PrivilegedAction() {
public Object run() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -23,7 +23,7 @@
/**
* @test
* @bug 4894125 7054918
* @bug 4894125 7054918 8130181
* @library ../testlibrary
* @summary test that failover for KeyFactory works
* @author Andreas Sterbenz
@ -96,14 +96,14 @@ public class Failover {
private static class ProviderPass extends Provider {
ProviderPass() {
super("Pass", 1.0d, "Pass");
super("Pass", "1.0", "Pass");
put("KeyFactory.FOO" , "Failover$KeyFactoryPass");
}
}
private static class ProviderFail extends Provider {
ProviderFail() {
super("Fail", 1.0d, "Fail");
super("Fail", "1.0", "Fail");
put("KeyFactory.FOO" , "Failover$KeyFactoryFail");
put("KeyFactory.DSA" , "Failover$KeyFactoryFail");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -23,7 +23,7 @@
/**
* @test
* @bug 4894125 7054918
* @bug 4894125 7054918 8130181
* @library ../testlibrary
* @summary test that failover for KeyPairGenerator works
* @author Andreas Sterbenz
@ -110,14 +110,14 @@ public class Failover {
private static class ProviderPass extends Provider {
ProviderPass() {
super("Pass", 1.0d, "Pass");
super("Pass", "1.0", "Pass");
put("KeyPairGenerator.FOO" , "Failover$KeyPairGeneratorPass");
}
}
private static class ProviderFail extends Provider {
ProviderFail() {
super("Fail", 1.0d, "Fail");
super("Fail", "1.0", "Fail");
put("KeyPairGenerator.FOO" , "Failover$KeyPairGeneratorFail");
put("KeyPairGenerator.DSA" , "Failover$KeyPairGeneratorFail");
put("KeyPairGenerator.RSA" , "Failover$KeyPairGeneratorFail");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -23,7 +23,7 @@
/*
* @test 1.5, 03/06/24
* @bug 4850376 8130850
* @bug 4850376 8130850 8130181
* @summary Provide generic storage KeyStore storage facilities
*/
@ -65,7 +65,7 @@ public class EntryMethods
public static class FooEntry implements KeyStore.Entry { }
public EntryMethods() throws Exception {
super("EntryMethods", 0.0, "EntryMethods");
super("EntryMethods", "0.0", "EntryMethods");
pre15fis = new FileInputStream
(System.getProperty("test.src") + "/EntryMethods.pre15.keystore");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -23,7 +23,7 @@
/**
* @test
* @bug 4938922 4961104 5071293 6236533
* @bug 4938922 4961104 5071293 6236533 8130181
* @summary verify that the KeyStore.Builder API works
* @author Andreas Sterbenz
*/
@ -219,7 +219,7 @@ public class KeyStoreBuilder {
private static class MyProvider extends Provider {
MyProvider() {
super("My", 1.0d, null);
super("My", "1.0", null);
put("KeyStore.My", "KeyStoreBuilder$MyKeyStoreSpi");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -27,7 +27,7 @@ public class GetInstanceProvider extends Provider {
public GetInstanceProvider() {
super("GetInstanceProvider",
1,
"1",
"GetInstanceProvider: Policy.GetInstancePolicySpi");
AccessController.doPrivileged(new PrivilegedAction() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 5097015
* @bug 5097015 8130181
* @summary make sure we correctly treat Provider string entries as case insensitive
* @author Andreas Sterbenz
*/
@ -33,7 +33,7 @@ import java.security.Provider.*;
public class CaseSensitiveServices extends Provider {
CaseSensitiveServices() {
super("Foo", 1.0d, null);
super("Foo", "1.0", null);
put("MessageDigest.Foo", "com.Foo");
put("mESSAGEdIGEST.fOO xYz", "aBc");
put("ALg.aliaS.MESSAGEdigest.Fu", "FoO");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 4856968 7054918
* @bug 4856968 7054918 8130181
* @library ../testlibrary
* @summary make sure add/insert/removeProvider() work correctly
* @author Andreas Sterbenz
@ -36,7 +36,7 @@ import java.security.*;
public class ChangeProviders extends Provider {
private ChangeProviders() {
super("Foo", 47.23d, "none");
super("Foo", "47.23", "none");
}
private static int plen() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -23,7 +23,7 @@
/**
* @test
* @bug 4918769
* @bug 4918769 8130181
* @summary make sure Provider.equals() behaves as expected with the id attributes
* @author Andreas Sterbenz
*/
@ -33,9 +33,9 @@ import java.security.*;
public class Equals {
public static void main(String[] args) throws Exception {
Provider p1 = new P1("foo", 1.0d, "foo");
Provider p1b = new P1("foo", 1.0d, "foo");
Provider p2 = new P2("foo", 1.0d, "foo");
Provider p1 = new P1("foo", "1.0", "foo");
Provider p1b = new P1("foo", "1.0", "foo");
Provider p2 = new P2("foo", "1.0", "foo");
System.out.println(p1.entrySet());
if (p1.equals(p2)) {
throw new Exception("Objects are equal");
@ -55,13 +55,13 @@ public class Equals {
}
private static class P1 extends Provider {
P1(String name, double version, String info) {
P1(String name, String version, String info) {
super(name, version, info);
}
}
private static class P2 extends Provider {
P2(String name, double version, String info) {
P2(String name, String version, String info) {
super(name, version, info);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 4856968 7054918
* @bug 4856968 7054918 8130181
* @library ../testlibrary
* @summary make sure getInstance() works correctly, including failover
* and delayed provider selection for Signatures
@ -137,7 +137,7 @@ public class GetInstance {
public static class FooProvider extends Provider {
FooProvider() {
super("foo", 1.0d, "none");
super("foo", "1.0", "none");
put("MessageDigest.foo", "GetInstance$FooDigest");
put("CertStore.foo", "GetInstance$FooStore");
put("Signature.foo", "GetInstance$FooSignatureSpi");
@ -151,7 +151,7 @@ public class GetInstance {
public static class BarProvider extends Provider {
BarProvider() {
super("bar", 1.0d, "none");
super("bar", "1.0", "none");
// all entries invalid for failover
put("MessageDigest.bar", "GetInstance$FooKey");
put("Signature.bar", "GetInstance$FooKey");
@ -164,7 +164,7 @@ public class GetInstance {
public static class BazProvider extends Provider {
BazProvider() {
super("baz", 1.0d, "none");
super("baz", "1.0", "none");
put("MessageDigest.bar", "GetInstance$FooDigest");
put("CertStore.bar", "GetInstance$FooStore");
put("Signature.bar", "GetInstance$FooSignatureSpi");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 6455351
* @bug 6455351 8130181
* @summary Make sure the Provider.info entries have the correct values
* after going through serialization/deserialization.
* @author Valerie Peng
@ -68,18 +68,17 @@ public class ProviderInfoCheck {
if (!p.getClass().getName().equalsIgnoreCase(value)) {
throw new Exception("Test Failed: incorrect className!");
}
double dvalue =
Double.parseDouble((String) p.get("Provider.id version"));
if ((SampleProvider.VERSION != dvalue) ||
p.getVersion() != dvalue) {
throw new Exception("Test Failed: incorrect version!");
value = (String) p.get("Provider.id version");
if (!SampleProvider.VERSION.equalsIgnoreCase(value) ||
p.getVersionStr() != value) {
throw new Exception("Test Failed: incorrect versionStr!");
}
System.out.println("Test Passed");
}
private static class SampleProvider extends Provider {
static String NAME = "Sample";
static double VERSION = 1.1d;
static String VERSION = "1.1";
static String INFO = "Good for nothing";
SampleProvider() {
super(NAME, VERSION, INFO);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 4190873 7054918
* @bug 4190873 7054918 8130181
* @library ../testlibrary
* @summary Make sure provider instance can be removed from list of registered
* providers, and "entrySet", "keySet", and "values" methods don't loop
@ -46,11 +46,11 @@ public class RemoveProvider {
public static void main0(String[] args) throws Exception {
// Add provider 1
Provider p1 = new MyProvider("name1",1,"");
Provider p1 = new MyProvider("name1","1","");
Security.addProvider(p1);
// Add provider 2
Provider p2 = new MyProvider("name2",1,"");
Provider p2 = new MyProvider("name2","1","");
Security.addProvider(p2);
// List all providers
@ -183,7 +183,7 @@ public class RemoveProvider {
}
class MyProvider extends Provider {
public MyProvider(String name, double version, String info) {
public MyProvider(String name, String version, String info) {
super(name, version, info);
put("Signature", name+".signature");
put("Digest", name+".digest");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -23,7 +23,7 @@
/**
* @test
* @bug 4911081
* @bug 4911081 8130181
* @summary verify that Provider.Service.supportsParameter() works
* @author Andreas Sterbenz
*/
@ -104,7 +104,7 @@ public class SupportsParameter {
private static class MyProvider extends Provider {
MyProvider() {
super("MyProvider", 1.0d, "MyProvider");
super("MyProvider", "1.0", "MyProvider");
put("Signature.DSA0", "foo.DSA0");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
@ -30,7 +30,7 @@ import java.security.Provider;
public final class TestSecurityProvider extends Provider {
public TestSecurityProvider() {
super("TEST", 1.0d, "Test Security provider");
super("TEST", "1.0", "Test Security provider");
System.out.println(String.format("TEST Security provider loaded"
+ " successfully : %s", this.toString()));
}
@ -38,7 +38,7 @@ public final class TestSecurityProvider extends Provider {
@Override
public String toString() {
return "TestSecurityProvider [getName()=" + getName()
+ ", getVersion()=" + getVersion() + ", getInfo()="
+ ", getVersion()=" + getVersionStr() + ", getInfo()="
+ getInfo() + ", toString()=" + super.toString() + "]";
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -23,7 +23,7 @@
/**
* @test
* @bug 6220064 7054918
* @bug 6220064 7054918 8130181
* @summary make sure everything works ok in the Turkish local (dotted/dotless i problem)
* @author Andreas Sterbenz
*/
@ -107,7 +107,7 @@ public class Turkish {
private static class TProvider extends Provider {
TProvider(String name) {
super(name, 1.0d, null);
super(name, "1.0", null);
put("Signature.MD5withRSA", "com.foo.Sig");
put("Alg.Alias.Signature.MD5RSA", "MD5withRSA");
put("sIGNATURE.shaWITHrsa", "com.foo.Sig");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
@ -54,7 +54,7 @@ import java.util.PropertyPermission;
/*
* @test
* @bug 6826789 8131486
* @bug 6826789 8131486 8130181
* @summary Make sure equivalent ProtectionDomains are granted the same
* permissions when the CodeSource URLs are different but resolve
* to the same ip address after name service resolution.
@ -194,7 +194,7 @@ public class DefineClass {
private static class TestProvider extends Provider {
TestProvider() {
super("Test8131486", 0.0, "For testing only");
super("Test8131486", "0.0", "For testing only");
putService(new Provider.Service(this, "KeyStore", "Test8131486",
"DefineClass$TestKeyStore", null, null));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 8001319
* @bug 8001319 8130181
* @summary check that SecurityPermission insertProvider permission is enforced
* correctly
* @run main/othervm/policy=AddProvider.policy.1 AddProvider 1
@ -53,7 +53,7 @@ public class AddProvider {
private static class TestProvider extends Provider {
TestProvider(String name) {
super(name, 0.0, "Not for use in production systems!");
super(name, "0.0", "Not for use in production systems!");
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 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
@ -27,7 +27,7 @@ import java.security.*;
public final class HashProvider extends Provider {
public HashProvider() {
super("HashProvider", 1.0d, "");
super("HashProvider", "1.0", "");
// register all algorithms from the following providers into this provider
// the security framework will try to load them via the classloader of this provider
addAlgorithms("SunRsaSign");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 4162583 7054918
* @bug 4162583 7054918 8130181
* @library ../testlibrary
* @summary Make sure Provider api implementations are synchronized properly
*/
@ -61,7 +61,7 @@ class AccessorThread extends Thread {
public void run() {
Provider[] provs = new Provider[10];
for (int i=0; i < provs.length; i++)
provs[i] = new MyProvider("name"+i, 1, "test");
provs[i] = new MyProvider("name"+i, "1", "test");
int rounds = 20;
while (rounds-- > 0) {
@ -86,7 +86,7 @@ class AccessorThread extends Thread {
}
class MyProvider extends Provider {
public MyProvider(String name, double version, String info) {
public MyProvider(String name, String version, String info) {
super(name, version, info);
put("Signature.sigalg", "sigimpl");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 4208414
* @bug 4208414 8130181
* @summary Providers should be removed "by-identity" - not "by-value"
*/
@ -34,7 +34,7 @@ public class RemoveProviderByIdentity {
public static void main(String[] args) throws Exception {
String PROVIDER_NAME = "myprovider";
Security.addProvider(new MyProvider(PROVIDER_NAME, 1, "test"));
Security.addProvider(new MyProvider(PROVIDER_NAME, "1", "test"));
if (Security.getProvider(PROVIDER_NAME) == null)
throw new Exception("provider not registered");
@ -45,7 +45,7 @@ public class RemoveProviderByIdentity {
}
class MyProvider extends Provider {
public MyProvider(String name, double version, String info) {
public MyProvider(String name, String version, String info) {
super(name, version, info);
put("Signature.sigalg", "sigimpl");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 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
@ -27,7 +27,7 @@
/*
* @test
* @bug 8014620
* @bug 8014620 8130181
* @summary Signature.getAlgorithm return null in special case
* @run main/othervm SignatureGetAlgorithm
* @author youdwei
@ -49,7 +49,7 @@ public class SignatureGetAlgorithm {
public static class TestProvider extends Provider {
TestProvider() {
super("testSignatureGetAlgorithm", 1.0, "test Signatures");
super("testSignatureGetAlgorithm", "1.0", "test Signatures");
put("Signature.MySignatureAlg",
"SignatureGetAlgorithm$MySignatureAlg");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -23,14 +23,14 @@
/*
*
* @bug 4408997
* @bug 4408997 8130181
* Used by GetInstance test.
*/
import java.security.Provider;
public class StubProvider extends Provider {
public StubProvider() {
super( "StubProvider", 1.1, "No Info");
super( "StubProvider", "1.1", "No Info");
put("CertPathBuilder.PKIX", "StubProviderImpl");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2007, 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
@ -23,7 +23,7 @@
/*
* test
* @bug 6377058
* @bug 6377058 8130181
* @summary SunJCE depends on sun.security.provider.SignatureImpl
* behaviour, BC can't load into 1st slot.
* @author Brad R. Wetmore
@ -34,7 +34,7 @@ import java.security.*;
public class MyProvider extends Provider {
public MyProvider() {
super("MyProvider", 1.0, "CertImpl");
super("MyProvider", "1.0", "CertImpl");
put("CertificateFactory.X.509", "MyCertificateFactory");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2007, 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
@ -23,7 +23,7 @@
/*
* test
* @bug 6370923
* @bug 6370923 8130181
* @summary SecretKeyFactory failover does not work
* @author Brad R. Wetmore
*/
@ -35,7 +35,7 @@ import java.security.*;
public class Provider1 extends Provider {
public Provider1() {
super("Provider1", 1.0, "SecretKeyFactory");
super("Provider1", "1.0", "SecretKeyFactory");
System.out.println("Creating Provider1");
put("SecretKeyFactory.DUMMY", "com.p1.P1SecretKeyFactory");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2007, 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
@ -23,7 +23,7 @@
/*
* test
* @bug 6370923
* @bug 6370923 8130181
* @summary SecretKeyFactory failover does not work
* @author Brad R. Wetmore
*/
@ -35,7 +35,7 @@ import java.security.*;
public class Provider2 extends Provider {
public Provider2() {
super("Provider2", 1.0, "SecretKeyFactory");
super("Provider2", "1.0", "SecretKeyFactory");
System.out.println("Creating Provider2");
put("SecretKeyFactory.DUMMY", "com.p2.P2SecretKeyFactory");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 4635454 6208022
* @bug 4635454 6208022 8130181
* @summary Check pluggability of SSLContext class.
*/
import java.security.*;
@ -34,7 +34,7 @@ public class CheckSSLContextExport extends Provider {
private static String info = "test provider for JSSE pluggability";
public CheckSSLContextExport(String protocols[]) {
super("TestJSSEPluggability", 1.0, info);
super("TestJSSEPluggability", "1.0", info);
for (int i=0; i<protocols.length; i++) {
put("SSLContext." + protocols[i], "MySSLContextImpl");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -27,7 +27,7 @@ public class GetInstanceProvider extends Provider {
public GetInstanceProvider() {
super("GetInstanceProvider",
1,
"1",
"GetInstanceProvider: Configuration.GetInstanceConfigSpi");
AccessController.doPrivileged(new PrivilegedAction() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 8056174
* @bug 8056174 8130181
* @summary test the functions of JarSigner API
* @modules java.base/sun.security.tools.keytool
* jdk.jartool
@ -145,7 +145,7 @@ public class Function {
public static class MyProvider extends Provider {
MyProvider() {
super("MY", 1.0d, null);
super("MY", "1.0", null);
put("MessageDigest.Five", Five.class.getName());
put("Signature.SHA1WithRSA", SHA1WithRSA.class.getName());
}

View File

@ -22,7 +22,7 @@
*/
/* @test
* @bug 8051408 8157308
* @bug 8051408 8157308 8130181
* @modules java.base/sun.security.provider
* @build java.base/sun.security.provider.S
* @run main SpecTest
@ -46,7 +46,7 @@ public class SpecTest {
// getInstance from a provider.
Provider p = new All("A", 0, "");
Provider p = new All("A", "0", "");
byte[] bytes = new byte[100];
// A non-DRBG
@ -123,9 +123,9 @@ public class SpecTest {
// getInstance from competitive providers.
Provider l = new Legacy("L", 0, "");
Provider w = new Weak("W", 0, "");
Provider s = new Strong("S", 0, "");
Provider l = new Legacy("L", "0", "");
Provider w = new Weak("W", "0", "");
Provider s = new Strong("S", "0", "");
Security.addProvider(l);
Security.addProvider(w);
@ -173,7 +173,7 @@ public class SpecTest {
}
public static class All extends Provider {
protected All(String name, double version, String info) {
protected All(String name, String version, String info) {
super(name, version, info);
put("SecureRandom.S1", S.S1.class.getName());
put("SecureRandom.S2", S.S2.class.getName());
@ -183,21 +183,21 @@ public class SpecTest {
// Providing S with no params support
public static class Legacy extends Provider {
protected Legacy(String name, double version, String info) {
protected Legacy(String name, String version, String info) {
super(name, version, info);
put("SecureRandom.S", S.S1.class.getName());
}
}
public static class Weak extends Provider {
protected Weak(String name, double version, String info) {
protected Weak(String name, String version, String info) {
super(name, version, info);
put("SecureRandom.S", S.S2.class.getName());
}
}
public static class Strong extends Provider {
protected Strong(String name, double version, String info) {
protected Strong(String name, String version, String info) {
super(name, version, info);
put("SecureRandom.S", S.S3.class.getName());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 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
@ -27,7 +27,7 @@ import java.security.*;
public class DummyProvider extends Provider {
public DummyProvider() {
super("Dummy", 0.1, "Dummy Provider with nothing");
super("Dummy", "0.1", "Dummy Provider with nothing");
}
@Override
@ -36,7 +36,7 @@ public class DummyProvider extends Provider {
}
private DummyProvider(String arg) {
super("Dummy", 0.2, "Dummy Provider with " + arg);
super("Dummy", "0.2", "Dummy Provider with " + arg);
//
// KeyStore
//

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 4162868
* @bug 4162868 8130181
* @modules java.base/sun.security.x509
* @run main/othervm ExtensibleAlgorithmId
* @summary Algorithm Name-to-OID mapping needs to be made extensible.
@ -51,7 +51,7 @@ public class ExtensibleAlgorithmId {
class TestProvider extends Provider {
public TestProvider() {
super("Dummy", 1.0, "XYZ algorithm");
super("Dummy", "1.0", "XYZ algorithm");
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {