final String id; // RSA private key value associated with the corresponding test vectors final RSAPrivateKeySpec privKeySpec;
// RSA public key value associated with the corresponding test vectors final RSAPublicKeySpec pubKeySpec;
// set of test vectors final List<SigVector> testVectors;
SigRecord(String mod, String pubExp, String privExp, List<SigVector> testVectors) { if (mod == null || mod.isEmpty()) { thrownew IllegalArgumentException("Modulus n must be specified");
} if (pubExp == null || pubExp.isEmpty()) { thrownew IllegalArgumentException("Public Exponent e must be specified");
} if (privExp == null || privExp.isEmpty()) { thrownew IllegalArgumentException("Private Exponent d must be specified");
} if (testVectors == null || (testVectors.size() == 0)) { thrownew IllegalArgumentException("One or more test vectors must be specified");
}
BigInteger n = new BigInteger(1, HexFormat.of().parseHex(mod));
BigInteger e = new BigInteger(1, HexFormat.of().parseHex(pubExp));
BigInteger d = new BigInteger(1, HexFormat.of().parseHex(privExp)); this.id = ("n=" + mod + ", e=" + pubExp); this.pubKeySpec = new RSAPublicKeySpec(n, e); this.privKeySpec = new RSAPrivateKeySpec(n, d); this.testVectors = testVectors;
}
List<SigRecord> data = new ArrayList<>(); try (BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(
TEST_SRC + File.separator + filename)))) {
String line;
String mod = null;
String pubExp = null;
String privExp = null;
List<SigVector> testVectors = new ArrayList<>(); while ((line = br.readLine()) != null) { if (line.startsWith("n =")) {
mod = line.split("=")[1].trim();
} elseif (line.startsWith("e =")) {
pubExp = line.split("=")[1].trim();
} elseif (line.startsWith("d =")) {
privExp = line.split("=")[1].trim();
// now should start parsing for test vectors
String mdAlg = null;
String msg = null;
String sig = null; boolean sigVectorDone = false; while ((line = br.readLine()) != null) { // we only care for lines starting with // SHAALG, Msg, S if (line.startsWith("SHAAlg =")) {
mdAlg = line.split(" = ")[1].trim();
} elseif (line.startsWith("Msg =")) {
msg = line.split(" = ")[1].trim();
} elseif (line.startsWith("S =")) {
sig = line.split(" = ")[1].trim();
} elseif (line.startsWith("[mod")) {
sigVectorDone = true;
}
if ((mdAlg != null) && (msg != null) && (sig != null)) { // finish off current SigVector
testVectors.add(new SigVector(mdAlg, msg, sig));
mdAlg = msg = sig = null;
} if (sigVectorDone) { break;
}
} // finish off current SigRecord and clear data for next SigRecord
data.add(new SigRecord(mod, pubExp, privExp, testVectors));
mod = pubExp = privExp = null;
testVectors = new ArrayList<>();
}
}
if (data.isEmpty()) { thrownew RuntimeException("Nothing read from file "
+ filename);
}
} return data;
}
@Override public String toString() { return (id + ", " + testVectors.size() + " test vectors");
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.