diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2022-07-25 21:38:13 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2022-07-25 21:56:20 -0300 |
commit | 97c48aa55abca34478f470fa99c3a150c6629f16 (patch) | |
tree | 4cb27f57335c19820f8c55047b9df13a275bea5d /src/main/java/ganarchy/friendcode/sam/I2PSamControl.java | |
parent | 354df6d333ffb7b69e92117406c8ce8d61ea09e0 (diff) |
Fix SAM bridge security
Diffstat (limited to 'src/main/java/ganarchy/friendcode/sam/I2PSamControl.java')
-rw-r--r-- | src/main/java/ganarchy/friendcode/sam/I2PSamControl.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/ganarchy/friendcode/sam/I2PSamControl.java b/src/main/java/ganarchy/friendcode/sam/I2PSamControl.java index 693cba3..50748e6 100644 --- a/src/main/java/ganarchy/friendcode/sam/I2PSamControl.java +++ b/src/main/java/ganarchy/friendcode/sam/I2PSamControl.java @@ -12,7 +12,7 @@ public class I2PSamControl extends I2PSamStateMachine { private final boolean zeroHop; /** * The session's private key. - * + * <p> * The threat model assumes the local machine (including RAM) to be trusted. */ private String privateKey; @@ -25,7 +25,7 @@ public class I2PSamControl extends I2PSamStateMachine { /** * Creates a new SAM control socket. * - * @param zeroHop Whether to use zero-hop tunnels. + * @param zeroHop Whether to use zero-hop tunnels. * @param privateKey The (optional) identity private key, for persistent friend codes. */ public I2PSamControl(boolean zeroHop, String privateKey) { @@ -39,12 +39,12 @@ public class I2PSamControl extends I2PSamStateMachine { // try IPv6 first // there's no Inet6Address.getLoopbackAddress() which is unfortunate. final Socket samSocket = new Socket(); - samSocket.connect(new InetSocketAddress(Inet6Address.getByAddress("localhost", new byte[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, 0), 7656), 3000); + samSocket.connect(new InetSocketAddress(Inet6Address.getByAddress("localhost", new byte[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, 0), 7656), 3000); return this.connect(samSocket); } catch (IOException e) { try { final Socket samSocket = new Socket(); - samSocket.connect(new InetSocketAddress(Inet4Address.getByAddress("localhost", new byte[] {127,0,0,1}), 7656), 3000); + samSocket.connect(new InetSocketAddress(Inet4Address.getByAddress("localhost", new byte[] {127, 0, 0, 1}), 7656), 3000); return this.connect(samSocket); } catch (IOException ex) { return false; @@ -63,8 +63,8 @@ public class I2PSamControl extends I2PSamStateMachine { if (this.privateKey == null) { // generate our keys this.sendCommand(new I2PSamCommand( - "DEST", "GENERATE", - ImmutableMap.of("SIGNATURE_TYPE", "EdDSA_SHA512_Ed25519") + "DEST", "GENERATE", + ImmutableMap.of("SIGNATURE_TYPE", "EdDSA_SHA512_Ed25519") )); var dest = this.getCommand("DEST", "REPLY"); this.publicKey = dest.parameters().get("PUB"); @@ -125,6 +125,7 @@ public class I2PSamControl extends I2PSamStateMachine { /** * Creates a stream forwarder. + * * @return A stream forwarder. */ public I2PSamStreamForwarder forwardStream(String port) { @@ -133,6 +134,7 @@ public class I2PSamControl extends I2PSamStateMachine { /** * Creates a stream forwarder. + * * @return A stream connector. */ public I2PSamStreamConnector connectStream(String b32) { |