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 {
_log.info("Picking introducer: " + cur);
cur.setIntroducerTime();
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_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()));
found++;
}
......
......@@ -17,7 +17,7 @@ class UDPAddress {
private final String _host;
private InetAddress _hostAddress;
private final int _port;
private byte[] _introKey;
private final byte[] _introKey;
private String _introHosts[];
private InetAddress _introAddresses[];
private int _introPorts[];
......@@ -62,6 +62,7 @@ class UDPAddress {
if (addr == null) {
_host = null;
_port = 0;
_introKey = null;
return;
}
_host = addr.getOption(PROP_HOST);
......@@ -78,6 +79,10 @@ class UDPAddress {
byte[] ik = Base64.decode(key.trim());
if (ik != null && ik.length == SessionKey.KEYSIZE_BYTES)
_introKey = ik;
else
_introKey = null;
} else {
_introKey = null;
}
for (int i = MAX_INTRODUCERS - 1; i >= 0; i--) {
......@@ -167,6 +172,9 @@ class UDPAddress {
*/
public int getPort() { return _port; }
/**
* @return shouldn't be null but will be if invalid
*/
byte[] getIntroKey() { return _introKey; }
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