AsymmetricCipherKeyPair pair = dsaKeyGen.generateKeyPair();
ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), keyRandom);
DSASigner dsa = new DSASigner();
dsa.init(true, param);
byte[] message = new BigInteger("968236873715988614170569073515315707566766479517").toByteArray();
BigInteger[] sig = dsa.generateSignature(message);
if (!r.equals(sig[0]))
{
return new SimpleTestResult(false, getName()
+ ": r component wrong." + System.getProperty("line.separator")
+ " expecting: " + r + System.getProperty("line.separator")
+ " got : " + sig[0]);
}
if (!s.equals(sig[1]))
{
return new SimpleTestResult(false, getName()
+ ": s component wrong." + System.getProperty("line.separator")
+ " expecting: " + s + System.getProperty("line.separator")
+ " got : " + sig[1]);
}
dsa.init(false, pair.getPublic());
if (dsa.verifySignature(message, sig[0], sig[1]))
{
return new SimpleTestResult(true, getName() + ": Okay");
}
else
{