java.util.Random.nextBytes C# (CSharp) Method

nextBytes() public method

public nextBytes ( byte arg0 ) : void
arg0 byte
return void
        public virtual void nextBytes(byte[] arg0)
        {
            global::MonoJavaBridge.JavaBridge.CallVoidMethod(this, global::java.util.Random.staticClass, "nextBytes", "([B)V", ref global::java.util.Random._m5, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
        }

Usage Example

Example #1
0
        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);
            }
        }
All Usage Examples Of java.util.Random::nextBytes