{
return new SimpleTestResult(false, "RSA: failed OAEP Test");
}
RSAKeyPairGenerator pGen = new RSAKeyPairGenerator();
RSAKeyGenerationParameters genParam = new RSAKeyGenerationParameters(
BigInteger.valueOf(0x11), new SecureRandom(), 768, 25);
pGen.init(genParam);
AsymmetricCipherKeyPair pair = pGen.generateKeyPair();
eng = new RSAEngine();
if (((RSAKeyParameters)pair.getPublic()).getModulus().bitLength() < 762)
{
return new SimpleTestResult(false, "RSA: failed key generation (768) length test");
}
eng.init(true, pair.getPublic());
try
{
data = eng.processBlock(data, 0, data.length);
}
catch (Exception e)
{
return new SimpleTestResult(false, "RSA: failed - exception " + e.toString());
}
eng.init(false, pair.getPrivate());
try
{
data = eng.processBlock(data, 0, data.length);
}
catch (Exception e)
{
return new SimpleTestResult(false, "RSA: failed - exception " + e.toString());
}
if (!input.equals(new String(Hex.encode(data))))
{
return new SimpleTestResult(false, "RSA: failed key generation (768) Test");
}
genParam = new RSAKeyGenerationParameters(BigInteger.valueOf(0x11), new SecureRandom(), 1024, 25);
pGen.init(genParam);
pair = pGen.generateKeyPair();
eng.init(true, pair.getPublic());