@Override public void fill(byte[] bytes, int start, int len) { random.nextBytes(bytes, start, len); }
@Override public void fill(byte[] bytes) { random.nextBytes(bytes); }
@Override public void fill(byte[] bytes, int start, int len) { random.nextBytes(bytes, start, len); }
private int next(int numBits) { int bytes = (numBits + 7) / 8; byte next[] = new byte[bytes]; int ret = 0; random.nextBytes(next); for (int i = 0; i < bytes; i++) { ret = (next[i] & 0xFF) | (ret << 8); } return ret >>> (bytes * 8 - numBits); } }
private int next(int numBits) { int bytes = (numBits + 7) / 8; byte next[] = new byte[bytes]; int ret = 0; random.nextBytes(next); for (int i = 0; i < bytes; i++) { ret = (next[i] & 0xFF) | (ret << 8); } return ret >>> (bytes * 8 - numBits); } }
private int next(int numBits) { int bytes = (numBits + 7) / 8; byte next[] = new byte[bytes]; int ret = 0; random.nextBytes(next); for (int i = 0; i < bytes; i++) { ret = (next[i] & 0xFF) | (ret << 8); } return ret >>> (bytes * 8 - numBits); } }
@Override public void fill(byte[] bytes, int start, int len) { this.random.nextBytes(bytes, start, len); }
@Override public void fill(byte[] bytes, int start, int len) { random.nextBytes(bytes, start, len); }
@Override public void fill(byte[] bytes) { random.nextBytes(bytes); }
@Override public void fill(byte[] bytes, int start, int len) { this.random.nextBytes(bytes, start, len); }
@Override public void fill(byte[] bytes, int start, int len) { this.random.nextBytes(bytes, start, len); }
private void doNextBytes( byte[] bytes, int start, int len) { synchronized (this) { int done = 0; while (done < len) { if (windowCount < 1) { generator.nextBytes(window, 0, window.length); windowCount = window.length; } bytes[start + done++] = window[--windowCount]; } } } }
private void doNextBytes( byte[] bytes, int start, int len) { synchronized (this) { int done = 0; while (done < len) { if (windowCount < 1) { generator.nextBytes(window, 0, window.length); windowCount = window.length; } bytes[start + done++] = window[--windowCount]; } } } }
protected static byte[] createRandomBlock(boolean useGMTUnixTime, RandomGenerator randomGenerator) { byte[] result = new byte[32]; randomGenerator.nextBytes(result); if (useGMTUnixTime) { TlsUtils.writeGMTUnixTime(result, 0); } return result; }
protected static byte[] createRandomBlock(boolean useGMTUnixTime, RandomGenerator randomGenerator) { byte[] result = new byte[32]; randomGenerator.nextBytes(result); if (useGMTUnixTime) { TlsUtils.writeGMTUnixTime(result, 0); } return result; }
/** * Encode this {@link HeartbeatMessage} to an {@link OutputStream}. * * @param output * the {@link OutputStream} to encode to. * @throws IOException */ public void encode(TlsContext context, OutputStream output) throws IOException { TlsUtils.writeUint8(type, output); TlsUtils.checkUint16(payload.length); TlsUtils.writeUint16(payload.length, output); output.write(payload); byte[] padding = new byte[paddingLength]; context.getNonceRandomGenerator().nextBytes(padding); output.write(padding); }
/** * Encode this {@link HeartbeatMessage} to an {@link OutputStream}. * * @param output * the {@link OutputStream} to encode to. * @throws IOException */ public void encode(TlsContext context, OutputStream output) throws IOException { TlsUtils.writeUint8(type, output); TlsUtils.checkUint16(payload.length); TlsUtils.writeUint16(payload.length, output); output.write(payload); byte[] padding = new byte[paddingLength]; context.getNonceRandomGenerator().nextBytes(padding); output.write(padding); }
context.getNonceRandomGenerator().nextBytes(explicitIV);
context.getNonceRandomGenerator().nextBytes(randomData);
context.getNonceRandomGenerator().nextBytes(randomData);