I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit c79e3389 authored by zzz's avatar zzz
Browse files

SSU intro key checks

parent 68b15aad
No related branches found
No related tags found
No related merge requests found
...@@ -218,9 +218,12 @@ class IntroductionManager { ...@@ -218,9 +218,12 @@ class IntroductionManager {
_log.info("Picking introducer: " + cur); _log.info("Picking introducer: " + cur);
cur.setIntroducerTime(); cur.setIntroducerTime();
UDPAddress ura = new UDPAddress(ra); UDPAddress ura = new UDPAddress(ra);
byte[] ikey = ura.getIntroKey();
if (ikey == null)
continue;
ssuOptions.setProperty(UDPAddress.PROP_INTRO_HOST_PREFIX + found, Addresses.toString(ip)); ssuOptions.setProperty(UDPAddress.PROP_INTRO_HOST_PREFIX + found, Addresses.toString(ip));
ssuOptions.setProperty(UDPAddress.PROP_INTRO_PORT_PREFIX + found, String.valueOf(port)); ssuOptions.setProperty(UDPAddress.PROP_INTRO_PORT_PREFIX + found, String.valueOf(port));
ssuOptions.setProperty(UDPAddress.PROP_INTRO_KEY_PREFIX + found, Base64.encode(ura.getIntroKey())); ssuOptions.setProperty(UDPAddress.PROP_INTRO_KEY_PREFIX + found, Base64.encode(ikey));
ssuOptions.setProperty(UDPAddress.PROP_INTRO_TAG_PREFIX + found, String.valueOf(cur.getTheyRelayToUsAs())); ssuOptions.setProperty(UDPAddress.PROP_INTRO_TAG_PREFIX + found, String.valueOf(cur.getTheyRelayToUsAs()));
found++; found++;
} }
......
...@@ -17,7 +17,7 @@ class UDPAddress { ...@@ -17,7 +17,7 @@ class UDPAddress {
private final String _host; private final String _host;
private InetAddress _hostAddress; private InetAddress _hostAddress;
private final int _port; private final int _port;
private byte[] _introKey; private final byte[] _introKey;
private String _introHosts[]; private String _introHosts[];
private InetAddress _introAddresses[]; private InetAddress _introAddresses[];
private int _introPorts[]; private int _introPorts[];
...@@ -62,6 +62,7 @@ class UDPAddress { ...@@ -62,6 +62,7 @@ class UDPAddress {
if (addr == null) { if (addr == null) {
_host = null; _host = null;
_port = 0; _port = 0;
_introKey = null;
return; return;
} }
_host = addr.getOption(PROP_HOST); _host = addr.getOption(PROP_HOST);
...@@ -78,6 +79,10 @@ class UDPAddress { ...@@ -78,6 +79,10 @@ class UDPAddress {
byte[] ik = Base64.decode(key.trim()); byte[] ik = Base64.decode(key.trim());
if (ik != null && ik.length == SessionKey.KEYSIZE_BYTES) if (ik != null && ik.length == SessionKey.KEYSIZE_BYTES)
_introKey = ik; _introKey = ik;
else
_introKey = null;
} else {
_introKey = null;
} }
for (int i = MAX_INTRODUCERS - 1; i >= 0; i--) { for (int i = MAX_INTRODUCERS - 1; i >= 0; i--) {
...@@ -167,6 +172,9 @@ class UDPAddress { ...@@ -167,6 +172,9 @@ class UDPAddress {
*/ */
public int getPort() { return _port; } public int getPort() { return _port; }
/**
* @return shouldn't be null but will be if invalid
*/
byte[] getIntroKey() { return _introKey; } byte[] getIntroKey() { return _introKey; }
int getIntroducerCount() { return (_introAddresses == null ? 0 : _introAddresses.length); } int getIntroducerCount() { return (_introAddresses == null ? 0 : _introAddresses.length); }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment