diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-10-14 15:21:24 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-10-14 15:21:24 +0200 |
commit | b6835afcbd43195b363c9e578ad151030ce7f9fe (patch) | |
tree | 7e5893b29a35dc22e73be92fbe2786300d0e0889 /jrt | |
parent | cb943c079ba1cd53f9e70e92e9c03343e85ec780 (diff) |
Minor fixes
Diffstat (limited to 'jrt')
-rw-r--r-- | jrt/src/com/yahoo/jrt/XorCryptoSocket.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/jrt/src/com/yahoo/jrt/XorCryptoSocket.java b/jrt/src/com/yahoo/jrt/XorCryptoSocket.java index 90be58bb700..fa784f62b12 100644 --- a/jrt/src/com/yahoo/jrt/XorCryptoSocket.java +++ b/jrt/src/com/yahoo/jrt/XorCryptoSocket.java @@ -1,20 +1,21 @@ // Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.jrt; - import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.SocketChannel; +import java.security.SecureRandom; import java.util.ArrayDeque; import java.util.Queue; import java.util.Random; - /** * A very simple CryptoSocket that performs connection handshaking and * data transformation. Used to test encryption integration separate * from TLS. - **/ + * + * @author havardpe + */ public class XorCryptoSocket implements CryptoSocket { private static final int CHUNK_SIZE = 4096; @@ -28,7 +29,7 @@ public class XorCryptoSocket implements CryptoSocket { private SocketChannel channel; private static byte genKey() { - return (byte) new Random().nextInt(256); + return (byte) new SecureRandom().nextInt(256); } private HandshakeResult readKey() throws IOException { |