List of usage examples for org.bouncycastle.crypto.prng VMPCRandomGenerator nextBytes
public void nextBytes(byte[] bytes)
From source file:libeac.tests.CPACECoreTest.java
License:Open Source License
public void testCalcX() throws Exception { m_pace.calcKPassword(m_szPw);/*w w w. j av a 2 s. com*/ m_pace.decryptNonce(DatatypeConverter.parseHexBinary("4dd3ea7e1d014d9f6c66940d4125496b")); IECPoint X = m_pace.calcX(); byte[] byaRnd = m_pace.getRand(); VMPCRandomGenerator rndGen = new VMPCRandomGenerator(); rndGen.nextBytes(byaRnd); X9ECParameters params = TeleTrusTNamedCurves.getByName("brainpoolp256r1"); ECCurve.Fp curve = (ECCurve.Fp) params.getCurve(); ECPoint base = params.getG(); ECPoint.Fp Xbc = (ECPoint.Fp) base.multiply(new BigInteger(1, byaRnd)); assertTrue(Arrays.equals(Xbc.getEncoded(), X.getEncoded())); }