forked from I2P_Developers/i2p.i2p
DSAEngine: Minor cleanup
This commit is contained in:
@ -389,7 +389,6 @@ public class DSAEngine {
|
|||||||
throw new IllegalArgumentException("Bad key type " + signingKey.getType());
|
throw new IllegalArgumentException("Bad key type " + signingKey.getType());
|
||||||
long start = _context.clock().now();
|
long start = _context.clock().now();
|
||||||
|
|
||||||
Signature sig = new Signature();
|
|
||||||
BigInteger k;
|
BigInteger k;
|
||||||
|
|
||||||
boolean ok = false;
|
boolean ok = false;
|
||||||
@ -452,14 +451,13 @@ public class DSAEngine {
|
|||||||
for (int i = 0; i < sbytes.length; i++)
|
for (int i = 0; i < sbytes.length; i++)
|
||||||
out[i + 20 + 20 - sbytes.length] = sbytes[i];
|
out[i + 20 + 20 - sbytes.length] = sbytes[i];
|
||||||
}
|
}
|
||||||
sig.setData(out);
|
|
||||||
|
|
||||||
long diff = _context.clock().now() - start;
|
long diff = _context.clock().now() - start;
|
||||||
if (diff > 1000) {
|
if (diff > 1000) {
|
||||||
if (_log.shouldLog(Log.WARN)) _log.warn("Took too long to sign (" + diff + "ms)");
|
if (_log.shouldLog(Log.WARN)) _log.warn("Took too long to sign (" + diff + "ms)");
|
||||||
}
|
}
|
||||||
|
|
||||||
return sig;
|
return new Signature(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -645,7 +643,7 @@ public class DSAEngine {
|
|||||||
case RSA:
|
case RSA:
|
||||||
return "NONEwithRSA";
|
return "NONEwithRSA";
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException();
|
throw new UnsupportedOperationException("Raw signatures unsupported for " + type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -657,7 +655,7 @@ public class DSAEngine {
|
|||||||
return "NONEwithECDSA";
|
return "NONEwithECDSA";
|
||||||
if (key instanceof RSAKey)
|
if (key instanceof RSAKey)
|
||||||
return "NONEwithRSA";
|
return "NONEwithRSA";
|
||||||
throw new IllegalArgumentException();
|
throw new UnsupportedOperationException("Raw signatures unsupported for " + key.getClass().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
//private static final int RUNS = 1000;
|
//private static final int RUNS = 1000;
|
||||||
|
Reference in New Issue
Block a user