forked from I2P_Developers/i2p.i2p
SSU intro key checks
This commit is contained in:
@ -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 {
|
|||||||
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 {
|
|||||||
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 {
|
|||||||
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 {
|
|||||||
*/
|
*/
|
||||||
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); }
|
||||||
|
Reference in New Issue
Block a user