forked from I2P_Developers/i2p.i2p
store ls secret as b64
This commit is contained in:
@ -14,6 +14,7 @@ import net.i2p.I2PAppContext;
|
|||||||
import net.i2p.I2PException;
|
import net.i2p.I2PException;
|
||||||
import net.i2p.client.I2PClient;
|
import net.i2p.client.I2PClient;
|
||||||
import net.i2p.crypto.SigType;
|
import net.i2p.crypto.SigType;
|
||||||
|
import net.i2p.data.Base64;
|
||||||
import net.i2p.data.DataHelper;
|
import net.i2p.data.DataHelper;
|
||||||
import net.i2p.data.Destination;
|
import net.i2p.data.Destination;
|
||||||
import net.i2p.data.Hash;
|
import net.i2p.data.Hash;
|
||||||
@ -596,7 +597,12 @@ public class GeneralHelper {
|
|||||||
* @since 0.9.40
|
* @since 0.9.40
|
||||||
*/
|
*/
|
||||||
public String getBlindedPassword(int tunnel) {
|
public String getBlindedPassword(int tunnel) {
|
||||||
return getProperty(tunnel, "i2cp.leaseSetSecret", "");
|
String rv = getProperty(tunnel, "i2cp.leaseSetSecret", null);
|
||||||
|
if (rv != null)
|
||||||
|
rv = DataHelper.getUTF8(Base64.decode(rv));
|
||||||
|
if (rv == null)
|
||||||
|
rv = "";
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -277,7 +277,7 @@ public class TunnelConfig {
|
|||||||
/** @since 0.9.40 */
|
/** @since 0.9.40 */
|
||||||
public void setBlindedPassword(String s) {
|
public void setBlindedPassword(String s) {
|
||||||
if (s != null && s.length() > 0)
|
if (s != null && s.length() > 0)
|
||||||
_otherOptions.put("i2cp.leaseSetSecret", s);
|
_otherOptions.put("i2cp.leaseSetSecret", Base64.encode(DataHelper.getUTF8(s.trim())));
|
||||||
else
|
else
|
||||||
_otherOptions.remove("i2cp.leaseSetSecret");
|
_otherOptions.remove("i2cp.leaseSetSecret");
|
||||||
}
|
}
|
||||||
|
@ -132,8 +132,10 @@ class RequestLeaseSetMessageHandler extends HandlerImpl {
|
|||||||
} else if (_ls2Type == DatabaseEntry.KEY_TYPE_ENCRYPTED_LS2) {
|
} else if (_ls2Type == DatabaseEntry.KEY_TYPE_ENCRYPTED_LS2) {
|
||||||
EncryptedLeaseSet encls2 = new EncryptedLeaseSet();
|
EncryptedLeaseSet encls2 = new EncryptedLeaseSet();
|
||||||
String secret = session.getOptions().getProperty(PROP_SECRET);
|
String secret = session.getOptions().getProperty(PROP_SECRET);
|
||||||
if (secret != null)
|
if (secret != null) {
|
||||||
|
secret = DataHelper.getUTF8(Base64.decode(secret));
|
||||||
encls2.setSecret(secret);
|
encls2.setSecret(secret);
|
||||||
|
}
|
||||||
leaseSet = encls2;
|
leaseSet = encls2;
|
||||||
} else if (_ls2Type == DatabaseEntry.KEY_TYPE_META_LS2) {
|
} else if (_ls2Type == DatabaseEntry.KEY_TYPE_META_LS2) {
|
||||||
leaseSet = new MetaLeaseSet();
|
leaseSet = new MetaLeaseSet();
|
||||||
|
@ -655,6 +655,7 @@ class ClientMessageEventListener implements I2CPMessageReader.I2CPMessageEventLi
|
|||||||
String secret = cfg.getOptions().getProperty("i2cp.leaseSetSecret");
|
String secret = cfg.getOptions().getProperty("i2cp.leaseSetSecret");
|
||||||
if (secret != null) {
|
if (secret != null) {
|
||||||
EncryptedLeaseSet encls = (EncryptedLeaseSet) ls;
|
EncryptedLeaseSet encls = (EncryptedLeaseSet) ls;
|
||||||
|
secret = DataHelper.getUTF8(Base64.decode(secret));
|
||||||
encls.setSecret(secret);
|
encls.setSecret(secret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user