just check availability once

This commit is contained in:
zzz
2014-08-30 20:46:16 +00:00
parent 1238001add
commit 03cec7fd5a

View File

@ -95,6 +95,7 @@ public enum SigType {
private final SigAlgo base; private final SigAlgo base;
private final String digestName, algoName, since; private final String digestName, algoName, since;
private final AlgorithmParameterSpec params; private final AlgorithmParameterSpec params;
private final boolean isAvail;
SigType(int cod, int pubLen, int privLen, int hLen, int sLen, SigAlgo baseAlgo, SigType(int cod, int pubLen, int privLen, int hLen, int sLen, SigAlgo baseAlgo,
String mdName, String aName, AlgorithmParameterSpec pSpec, String supportedSince) { String mdName, String aName, AlgorithmParameterSpec pSpec, String supportedSince) {
@ -108,6 +109,7 @@ public enum SigType {
algoName = aName; algoName = aName;
params = pSpec; params = pSpec;
since = supportedSince; since = supportedSince;
isAvail = x_isAvailable();
} }
/** the unique identifier for this type */ /** the unique identifier for this type */
@ -180,6 +182,10 @@ public enum SigType {
* @return true if supported in this JVM * @return true if supported in this JVM
*/ */
public boolean isAvailable() { public boolean isAvailable() {
return isAvail;
}
private boolean x_isAvailable() {
if (DSA_SHA1 == this) if (DSA_SHA1 == this)
return true; return true;
try { try {