Java 类org.bouncycastle.crypto.prng.FixedSecureRandom 实例源码

项目:TLS-Attacker    文件:HeartbeatMessagePreparatorTest.java   
/**
 * Test of prepareProtocolMessageContents method, of class
 * HeartbeatMessagePreparator.
 */
@Test
public void testPrepare() {
    context.getConfig().setHeartbeatPayloadLength(11);
    context.getConfig().setHeartbeatPaddingLength(11);
    context.setRandom(new FixedSecureRandom(ArrayConverter
            .hexStringToByteArray("F6C92DA33AF01D4FB770AA60B420BB3851D9D47ACB93")));
    preparator.prepare();
    assertTrue(HeartbeatMessageType.HEARTBEAT_REQUEST.getValue() == message.getHeartbeatMessageType().getValue());
    LOGGER.info("padding: " + ArrayConverter.bytesToHexString(message.getPadding().getValue()));
    LOGGER.info("payload: " + ArrayConverter.bytesToHexString(message.getPayload().getValue()));
    assertArrayEquals(ArrayConverter.hexStringToByteArray("60B420BB3851D9D47ACB93"), message.getPadding()
            .getValue());
    assertArrayEquals(ArrayConverter.hexStringToByteArray("F6C92DA33AF01D4FB770AA"), message.getPayload()
            .getValue());
    assertTrue(11 == message.getPayloadLength().getValue());
}