public virtual void testRSACrypt1024_BiggerBlock() { System.Console.Out.WriteLine("RSACrypt1024Bigger"); int keySize = 1024; CryptobyClient client = new CryptobyClient(); CryptobyCore core = new CryptobyCore(client); java.util.Random rand = new java.util.Random(); for (int i = 1; i < 50; i++) { byte[] expResult = new byte[i * 100]; rand.nextBytes(expResult); KeyGenRSA generator = new KeyGenRSA(core); generator.initGenerator(keySize); byte[] publicKey = generator.getPublicKeyByte(); byte[] privateKey = generator.getPrivateKeyByte(); CryptRSA rsa = new CryptRSA(); byte[] encres = rsa.encrypt(expResult, publicKey); byte[] encres2 = rsa.encrypt(expResult, publicKey);; byte[] result = rsa.decrypt(encres, privateKey); byte[] result2 = rsa.decrypt(encres2, privateKey); Assert.AreEqual(result, result2); Assert.AreEqual(expResult, result); } }
public virtual void testRSACrypt1024_BiggerBlock() { System.Console.Out.WriteLine("RSACrypt1024Bigger"); int keySize = 1024; CryptobyClient client = new CryptobyClient(); CryptobyCore core = new CryptobyCore(client); java.util.Random rand = new java.util.Random(); for(int i = 1;i<50;i++){ byte[] expResult = new byte[i * 100]; rand.nextBytes(expResult); KeyGenRSA generator = new KeyGenRSA(core); generator.initGenerator(keySize); byte[] publicKey = generator.getPublicKeyByte(); byte[] privateKey = generator.getPrivateKeyByte(); CryptRSA rsa = new CryptRSA(); byte[] encres = rsa.encrypt (expResult, publicKey); byte[] encres2 = rsa.encrypt (expResult, publicKey);; byte[] result = rsa.decrypt(encres, privateKey); byte[] result2 = rsa.decrypt(encres2, privateKey); Assert.AreEqual(result, result2); Assert.AreEqual(expResult, result); } }