Replace printKeyGenResults with more generic printBenchmarkResults
parent
fbc28b398d
commit
b24b4779d3
|
@ -527,7 +527,6 @@ public class CryptoBenchmark {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* This method has been replaced by printBenchmarkResults */
|
|
||||||
|
|
||||||
/* Run RSA benchmarks for specified provider and key size */
|
/* Run RSA benchmarks for specified provider and key size */
|
||||||
private static void runRSABenchmark(String providerName, int keySize) throws Exception {
|
private static void runRSABenchmark(String providerName, int keySize) throws Exception {
|
||||||
|
@ -608,7 +607,6 @@ public class CryptoBenchmark {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ECC keygen benchmark */
|
|
||||||
/* ECC keygen benchmark */
|
/* ECC keygen benchmark */
|
||||||
private static void runECCBenchmark(String providerName, String curveName) throws Exception {
|
private static void runECCBenchmark(String providerName, String curveName) throws Exception {
|
||||||
/* Initialize key generator */
|
/* Initialize key generator */
|
||||||
|
@ -1320,12 +1318,11 @@ public class CryptoBenchmark {
|
||||||
int keySize = getHmacKeySize(algorithm) * 8;
|
int keySize = getHmacKeySize(algorithm) * 8;
|
||||||
keyGen.init(keySize);
|
keyGen.init(keySize);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Use default key size
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
KeyGenerator tempKeyGen = KeyGenerator.getInstance(algorithm, providerName);
|
KeyGenerator tempKeyGen = KeyGenerator.getInstance(algorithm, providerName);
|
||||||
tempKeyGen.generateKey(); // Test if key generation works with default settings
|
tempKeyGen.generateKey();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new IllegalArgumentException("Unsupported algorithm or unable to determine key size: " + algorithm);
|
throw new IllegalArgumentException("Unsupported algorithm or unable to determine key size: " + algorithm);
|
||||||
}
|
}
|
||||||
|
@ -1384,7 +1381,6 @@ public class CryptoBenchmark {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run ECDH benchmarks for specified provider and curve */
|
|
||||||
/* Run ECDH benchmarks for specified provider and curve */
|
/* Run ECDH benchmarks for specified provider and curve */
|
||||||
private static void runECDHBenchmark(String providerName, String curveName) throws Exception {
|
private static void runECDHBenchmark(String providerName, String curveName) throws Exception {
|
||||||
/* Variables for benchmark operations */
|
/* Variables for benchmark operations */
|
||||||
|
@ -1437,7 +1433,7 @@ public class CryptoBenchmark {
|
||||||
});
|
});
|
||||||
|
|
||||||
String agreementOp = String.format("ECDH %s agree", curveName);
|
String agreementOp = String.format("ECDH %s agree", curveName);
|
||||||
printBenchmarkResults(agreementResult.operations, agreementResult.elapsedTime, agreementOp, providerName, "ECDH");
|
printBenchmarkResults(agreementResult.operations, agreementResult.elapsedTime, agreementOp, finalProviderName, "ECDH");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
Loading…
Reference in New Issue