下面列出了java.security.Provider.Service#getClassName ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private static boolean isSpi(Service s) {
if (s.getType().equals("Cipher")) {
// must be a CipherSpi, which we can wrap with the CipherAdapter
return true;
}
String className = s.getClassName();
Boolean result = signatureInfo.get(className);
if (result == null) {
try {
Object instance = s.newInstance(null);
// Signature extends SignatureSpi
// so it is a "real" Spi if it is an
// instance of SignatureSpi but not Signature
boolean r = (instance instanceof SignatureSpi)
&& (instance instanceof Signature == false);
if ((debug != null) && (r == false)) {
debug.println("Not a SignatureSpi " + className);
debug.println("Delayed provider selection may not be "
+ "available for algorithm " + s.getAlgorithm());
}
result = Boolean.valueOf(r);
signatureInfo.put(className, result);
} catch (Exception e) {
// something is wrong, assume not an SPI
return false;
}
}
return result.booleanValue();
}
private static boolean isSpi(Service s) {
if (s.getType().equals("Cipher")) {
// must be a CipherSpi, which we can wrap with the CipherAdapter
return true;
}
String className = s.getClassName();
Boolean result = signatureInfo.get(className);
if (result == null) {
try {
Object instance = s.newInstance(null);
// Signature extends SignatureSpi
// so it is a "real" Spi if it is an
// instance of SignatureSpi but not Signature
boolean r = (instance instanceof SignatureSpi)
&& (instance instanceof Signature == false);
if ((debug != null) && (r == false)) {
debug.println("Not a SignatureSpi " + className);
debug.println("Delayed provider selection may not be "
+ "available for algorithm " + s.getAlgorithm());
}
result = Boolean.valueOf(r);
signatureInfo.put(className, result);
} catch (Exception e) {
// something is wrong, assume not an SPI
return false;
}
}
return result.booleanValue();
}
/**
* Check is subClass is a subclass of superClass. If not,
* throw a NoSuchAlgorithmException.
*/
public static void checkSuperClass(Service s, Class<?> subClass,
Class<?> superClass) throws NoSuchAlgorithmException {
if (superClass == null) {
return;
}
if (superClass.isAssignableFrom(subClass) == false) {
throw new NoSuchAlgorithmException
("class configured for " + s.getType() + ": "
+ s.getClassName() + " not a " + s.getType());
}
}
private static boolean isSpi(Service s) {
if (s.getType().equals("Cipher")) {
// must be a CipherSpi, which we can wrap with the CipherAdapter
return true;
}
String className = s.getClassName();
Boolean result = signatureInfo.get(className);
if (result == null) {
try {
Object instance = s.newInstance(null);
// Signature extends SignatureSpi
// so it is a "real" Spi if it is an
// instance of SignatureSpi but not Signature
boolean r = (instance instanceof SignatureSpi)
&& (instance instanceof Signature == false);
if ((debug != null) && (r == false)) {
debug.println("Not a SignatureSpi " + className);
debug.println("Delayed provider selection may not be "
+ "available for algorithm " + s.getAlgorithm());
}
result = Boolean.valueOf(r);
signatureInfo.put(className, result);
} catch (Exception e) {
// something is wrong, assume not an SPI
return false;
}
}
return result.booleanValue();
}
private static boolean isSpi(Service s) {
if (s.getType().equals("Cipher")) {
// must be a CipherSpi, which we can wrap with the CipherAdapter
return true;
}
String className = s.getClassName();
Boolean result = signatureInfo.get(className);
if (result == null) {
try {
Object instance = s.newInstance(null);
// Signature extends SignatureSpi
// so it is a "real" Spi if it is an
// instance of SignatureSpi but not Signature
boolean r = (instance instanceof SignatureSpi)
&& (instance instanceof Signature == false);
if ((debug != null) && (r == false)) {
debug.println("Not a SignatureSpi " + className);
debug.println("Delayed provider selection may not be "
+ "available for algorithm " + s.getAlgorithm());
}
result = Boolean.valueOf(r);
signatureInfo.put(className, result);
} catch (Exception e) {
// something is wrong, assume not an SPI
return false;
}
}
return result.booleanValue();
}
private static boolean isSpi(Service s) {
if (s.getType().equals("Cipher")) {
// must be a CipherSpi, which we can wrap with the CipherAdapter
return true;
}
String className = s.getClassName();
Boolean result = signatureInfo.get(className);
if (result == null) {
try {
Object instance = s.newInstance(null);
// Signature extends SignatureSpi
// so it is a "real" Spi if it is an
// instance of SignatureSpi but not Signature
boolean r = (instance instanceof SignatureSpi)
&& (instance instanceof Signature == false);
if ((debug != null) && (r == false)) {
debug.println("Not a SignatureSpi " + className);
debug.println("Delayed provider selection may not be "
+ "available for algorithm " + s.getAlgorithm());
}
result = Boolean.valueOf(r);
signatureInfo.put(className, result);
} catch (Exception e) {
// something is wrong, assume not an SPI
return false;
}
}
return result.booleanValue();
}
/**
* Check is subClass is a subclass of superClass. If not,
* throw a NoSuchAlgorithmException.
*/
public static void checkSuperClass(Service s, Class<?> subClass,
Class<?> superClass) throws NoSuchAlgorithmException {
if (superClass == null) {
return;
}
if (superClass.isAssignableFrom(subClass) == false) {
throw new NoSuchAlgorithmException
("class configured for " + s.getType() + ": "
+ s.getClassName() + " not a " + s.getType());
}
}
private static boolean isSpi(Service s) {
if (s.getType().equals("Cipher")) {
// must be a CipherSpi, which we can wrap with the CipherAdapter
return true;
}
String className = s.getClassName();
Boolean result = signatureInfo.get(className);
if (result == null) {
try {
Object instance = s.newInstance(null);
// Signature extends SignatureSpi
// so it is a "real" Spi if it is an
// instance of SignatureSpi but not Signature
boolean r = (instance instanceof SignatureSpi)
&& (instance instanceof Signature == false);
if ((debug != null) && (r == false)) {
debug.println("Not a SignatureSpi " + className);
debug.println("Delayed provider selection may not be "
+ "available for algorithm " + s.getAlgorithm());
}
result = Boolean.valueOf(r);
signatureInfo.put(className, result);
} catch (Exception e) {
// something is wrong, assume not an SPI
return false;
}
}
return result.booleanValue();
}
private static boolean isSpi(Service s) {
if (s.getType().equals("Cipher")) {
// must be a CipherSpi, which we can wrap with the CipherAdapter
return true;
}
String className = s.getClassName();
Boolean result = signatureInfo.get(className);
if (result == null) {
try {
Object instance = s.newInstance(null);
// Signature extends SignatureSpi
// so it is a "real" Spi if it is an
// instance of SignatureSpi but not Signature
boolean r = (instance instanceof SignatureSpi)
&& (instance instanceof Signature == false);
if ((debug != null) && (r == false)) {
debug.println("Not a SignatureSpi " + className);
debug.println("Delayed provider selection may not be "
+ "available for algorithm " + s.getAlgorithm());
}
result = Boolean.valueOf(r);
signatureInfo.put(className, result);
} catch (Exception e) {
// something is wrong, assume not an SPI
return false;
}
}
return result.booleanValue();
}
/**
* Check is subClass is a subclass of superClass. If not,
* throw a NoSuchAlgorithmException.
*/
public static void checkSuperClass(Service s, Class<?> subClass,
Class<?> superClass) throws NoSuchAlgorithmException {
if (superClass == null) {
return;
}
if (superClass.isAssignableFrom(subClass) == false) {
throw new NoSuchAlgorithmException
("class configured for " + s.getType() + ": "
+ s.getClassName() + " not a " + s.getType());
}
}
private static boolean isSpi(Service s) {
if (s.getType().equals("Cipher")) {
// must be a CipherSpi, which we can wrap with the CipherAdapter
return true;
}
String className = s.getClassName();
Boolean result = signatureInfo.get(className);
if (result == null) {
try {
Object instance = s.newInstance(null);
// Signature extends SignatureSpi
// so it is a "real" Spi if it is an
// instance of SignatureSpi but not Signature
boolean r = (instance instanceof SignatureSpi)
&& (instance instanceof Signature == false);
if ((debug != null) && (r == false)) {
debug.println("Not a SignatureSpi " + className);
debug.println("Delayed provider selection may not be "
+ "available for algorithm " + s.getAlgorithm());
}
result = Boolean.valueOf(r);
signatureInfo.put(className, result);
} catch (Exception e) {
// something is wrong, assume not an SPI
return false;
}
}
return result.booleanValue();
}
/**
* Check is subClass is a subclass of superClass. If not,
* throw a NoSuchAlgorithmException.
*/
public static void checkSuperClass(Service s, Class<?> subClass,
Class<?> superClass) throws NoSuchAlgorithmException {
if (superClass == null) {
return;
}
if (superClass.isAssignableFrom(subClass) == false) {
throw new NoSuchAlgorithmException
("class configured for " + s.getType() + ": "
+ s.getClassName() + " not a " + s.getType());
}
}
private static boolean isSpi(Service s) {
if (s.getType().equals("Cipher")) {
// must be a CipherSpi, which we can wrap with the CipherAdapter
return true;
}
String className = s.getClassName();
Boolean result = signatureInfo.get(className);
if (result == null) {
try {
Object instance = s.newInstance(null);
// Signature extends SignatureSpi
// so it is a "real" Spi if it is an
// instance of SignatureSpi but not Signature
boolean r = (instance instanceof SignatureSpi)
&& (instance instanceof Signature == false);
if ((debug != null) && (r == false)) {
debug.println("Not a SignatureSpi " + className);
debug.println("Delayed provider selection may not be "
+ "available for algorithm " + s.getAlgorithm());
}
result = Boolean.valueOf(r);
signatureInfo.put(className, result);
} catch (Exception e) {
// something is wrong, assume not an SPI
return false;
}
}
return result.booleanValue();
}
/**
* Check is subClass is a subclass of superClass. If not,
* throw a NoSuchAlgorithmException.
*/
public static void checkSuperClass(Service s, Class<?> subClass,
Class<?> superClass) throws NoSuchAlgorithmException {
if (superClass == null) {
return;
}
if (superClass.isAssignableFrom(subClass) == false) {
throw new NoSuchAlgorithmException
("class configured for " + s.getType() + ": "
+ s.getClassName() + " not a " + s.getType());
}
}
private static boolean isSpi(Service s) {
if (s.getType().equals("Cipher")) {
// must be a CipherSpi, which we can wrap with the CipherAdapter
return true;
}
String className = s.getClassName();
Boolean result = signatureInfo.get(className);
if (result == null) {
try {
Object instance = s.newInstance(null);
// Signature extends SignatureSpi
// so it is a "real" Spi if it is an
// instance of SignatureSpi but not Signature
boolean r = (instance instanceof SignatureSpi)
&& (instance instanceof Signature == false);
if ((debug != null) && (r == false)) {
debug.println("Not a SignatureSpi " + className);
debug.println("Delayed provider selection may not be "
+ "available for algorithm " + s.getAlgorithm());
}
result = Boolean.valueOf(r);
signatureInfo.put(className, result);
} catch (Exception e) {
// something is wrong, assume not an SPI
return false;
}
}
return result.booleanValue();
}
/**
* Check is subClass is a subclass of superClass. If not,
* throw a NoSuchAlgorithmException.
*/
public static void checkSuperClass(Service s, Class<?> subClass,
Class<?> superClass) throws NoSuchAlgorithmException {
if (superClass == null) {
return;
}
if (superClass.isAssignableFrom(subClass) == false) {
throw new NoSuchAlgorithmException
("class configured for " + s.getType() + ": "
+ s.getClassName() + " not a " + s.getType());
}
}
/**
* Check is subClass is a subclass of superClass. If not,
* throw a NoSuchAlgorithmException.
*/
public static void checkSuperClass(Service s, Class<?> subClass,
Class<?> superClass) throws NoSuchAlgorithmException {
if (superClass == null) {
return;
}
if (superClass.isAssignableFrom(subClass) == false) {
throw new NoSuchAlgorithmException
("class configured for " + s.getType() + ": "
+ s.getClassName() + " not a " + s.getType());
}
}
/**
* Check is subClass is a subclass of superClass. If not,
* throw a NoSuchAlgorithmException.
*/
public static void checkSuperClass(Service s, Class<?> subClass,
Class<?> superClass) throws NoSuchAlgorithmException {
if (superClass == null) {
return;
}
if (superClass.isAssignableFrom(subClass) == false) {
throw new NoSuchAlgorithmException
("class configured for " + s.getType() + ": "
+ s.getClassName() + " not a " + s.getType());
}
}
private static boolean isSpi(Service s) {
if (s.getType().equals("Cipher")) {
// must be a CipherSpi, which we can wrap with the CipherAdapter
return true;
}
String className = s.getClassName();
Boolean result = signatureInfo.get(className);
if (result == null) {
try {
Object instance = s.newInstance(null);
// Signature extends SignatureSpi
// so it is a "real" Spi if it is an
// instance of SignatureSpi but not Signature
boolean r = (instance instanceof SignatureSpi)
&& (instance instanceof Signature == false);
if ((debug != null) && (r == false)) {
debug.println("Not a SignatureSpi " + className);
debug.println("Delayed provider selection may not be "
+ "available for algorithm " + s.getAlgorithm());
}
result = Boolean.valueOf(r);
signatureInfo.put(className, result);
} catch (Exception e) {
// something is wrong, assume not an SPI
return false;
}
}
return result.booleanValue();
}
/**
* Check is subClass is a subclass of superClass. If not,
* throw a NoSuchAlgorithmException.
*/
public static void checkSuperClass(Service s, Class<?> subClass,
Class<?> superClass) throws NoSuchAlgorithmException {
if (superClass == null) {
return;
}
if (superClass.isAssignableFrom(subClass) == false) {
throw new NoSuchAlgorithmException
("class configured for " + s.getType() + ": "
+ s.getClassName() + " not a " + s.getType());
}
}