forked from I2P_Developers/i2p.i2p
propagate from branch 'i2p.i2p' (head 110585552852c1f9c61a3a2efb4f17d62b0c1b2e)
to branch 'i2p.i2p.zzz.test2' (head 558ec52091868b7fa66af462f84044df1bede8cb)
This commit is contained in:
@@ -15,6 +15,7 @@ import java.security.InvalidKeyException;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.KeyPair;
|
||||
import java.security.KeyPairGenerator;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.ProviderException;
|
||||
import java.security.interfaces.ECPrivateKey;
|
||||
import java.security.interfaces.ECPublicKey;
|
||||
@@ -416,19 +417,30 @@ public final class KeyGenerator {
|
||||
else
|
||||
System.out.println(type + " private-to-public test FAILED");
|
||||
//System.out.println("privkey " + keys[1]);
|
||||
MessageDigest md = type.getDigestInstance();
|
||||
for (int i = 0; i < runs; i++) {
|
||||
RandomSource.getInstance().nextBytes(src);
|
||||
md.update(src);
|
||||
byte[] sha = md.digest();
|
||||
SimpleDataStructure hash = type.getHashInstance();
|
||||
hash.setData(sha);
|
||||
long start = System.nanoTime();
|
||||
Signature sig = DSAEngine.getInstance().sign(src, privkey);
|
||||
Signature sig2 = DSAEngine.getInstance().sign(hash, privkey);
|
||||
if (sig == null)
|
||||
throw new GeneralSecurityException("signature generation failed");
|
||||
if (sig2 == null)
|
||||
throw new GeneralSecurityException("signature generation (H) failed");
|
||||
long mid = System.nanoTime();
|
||||
boolean ok = DSAEngine.getInstance().verifySignature(sig, src, pubkey);
|
||||
boolean ok2 = DSAEngine.getInstance().verifySignature(sig2, hash, pubkey);
|
||||
long end = System.nanoTime();
|
||||
stime += mid - start;
|
||||
vtime += end - mid;
|
||||
if (!ok)
|
||||
throw new GeneralSecurityException(type + " V(S(data)) fail");
|
||||
if (!ok2)
|
||||
throw new GeneralSecurityException(type + " V(S(H(data))) fail");
|
||||
}
|
||||
stime /= 1000*1000;
|
||||
vtime /= 1000*1000;
|
||||
|
||||
@@ -71,9 +71,8 @@ public class StatisticsManager {
|
||||
public Properties publishStatistics(Hash h) {
|
||||
Properties stats = new Properties();
|
||||
stats.setProperty("router.version", RouterVersion.VERSION);
|
||||
// scheduled for removal, never used
|
||||
if (CoreVersion.VERSION.equals("0.9.23"))
|
||||
stats.setProperty("coreVersion", CoreVersion.VERSION);
|
||||
// never used
|
||||
//stats.setProperty("coreVersion", CoreVersion.VERSION);
|
||||
stats.setProperty(RouterInfo.PROP_NETWORK_ID, _networkID);
|
||||
stats.setProperty(RouterInfo.PROP_CAPABILITIES, _context.router().getCapabilities());
|
||||
|
||||
@@ -168,9 +167,7 @@ public class StatisticsManager {
|
||||
}
|
||||
|
||||
// So that we will still get build requests - not required since 0.7.9 2010-01-12
|
||||
// scheduled for removal
|
||||
if (CoreVersion.VERSION.equals("0.9.23"))
|
||||
stats.setProperty("stat_uptime", "90m");
|
||||
//stats.setProperty("stat_uptime", "90m");
|
||||
if (FloodfillNetworkDatabaseFacade.isFloodfill(_context.router().getRouterInfo())) {
|
||||
int ri = _context.router().getUptime() > 30*60*1000 ?
|
||||
_context.netDb().getKnownRouters() :
|
||||
|
||||
Reference in New Issue
Block a user