private void doTest1() throws Exception { RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod1, pub1); RSAKeyParameters privParameters = new RSAKeyParameters(true, mod1, pri1); RSAEngine rsa = new RSAEngine(); byte[] data; // // ISO 9796-1 - public encrypt, private decrypt // ISO9796d1Encoding eng = new ISO9796d1Encoding(rsa); eng.init(true, privParameters); eng.setPadBits(4); data = eng.processBlock(msg1, 0, msg1.length); eng.init(false, pubParameters); if (!areEqual(sig1, data)) { fail("failed ISO9796-1 generation Test 1"); } data = eng.processBlock(data, 0, data.length); if (!areEqual(msg1, data)) { fail("failed ISO9796-1 retrieve Test 1"); } }
private void doTest2() throws Exception { RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod1, pub1); RSAKeyParameters privParameters = new RSAKeyParameters(true, mod1, pri1); RSAEngine rsa = new RSAEngine(); byte[] data; // // ISO 9796-1 - public encrypt, private decrypt // ISO9796d1Encoding eng = new ISO9796d1Encoding(rsa); eng.init(true, privParameters); data = eng.processBlock(msg2, 0, msg2.length); eng.init(false, pubParameters); if (!isSameAs(data, 1, sig2)) { fail("failed ISO9796-1 generation Test 2"); } data = eng.processBlock(data, 0, data.length); if (!areEqual(msg2, data)) { fail("failed ISO9796-1 retrieve Test 2"); } }
public void doTest3() throws Exception { RSAKeyParameters pubParameters = new RSAKeyParameters(false, mod2, pub2); RSAKeyParameters privParameters = new RSAKeyParameters(true, mod2, pri2); RSAEngine rsa = new RSAEngine(); byte[] data; // // ISO 9796-1 - public encrypt, private decrypt // ISO9796d1Encoding eng = new ISO9796d1Encoding(rsa); eng.init(true, privParameters); eng.setPadBits(4); data = eng.processBlock(msg3, 0, msg3.length); eng.init(false, pubParameters); if (!isSameAs(sig3, 1, data)) { fail("failed ISO9796-1 generation Test 3"); } data = eng.processBlock(data, 0, data.length); if (!isSameAs(msg3, 0, data)) { fail("failed ISO9796-1 retrieve Test 3"); } }
public ISO9796d1Padding() { super(new ISO9796d1Encoding(new RSABlindedEngine())); }
public ISO9796d1Padding() { super(new ISO9796d1Encoding(new NativeRSAEngine())); }