forked from I2P_Developers/i2p.i2p
i2ptunnel: Disallow encrypted LS for offline keys
This commit is contained in:
@@ -1080,6 +1080,21 @@ public class TunnelController implements Logging {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns false if not running.
|
||||
* @return true if offline keys or not running
|
||||
* @since 0.9.40
|
||||
*/
|
||||
public boolean getIsOfflineKeys() {
|
||||
if (_tunnel != null) {
|
||||
List<I2PSession> sessions = _tunnel.getSessions();
|
||||
if (!sessions.isEmpty())
|
||||
return sessions.get(0).isOffline();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO synch
|
||||
public boolean getIsRunning() { return _state == TunnelState.RUNNING; }
|
||||
public boolean getIsStarting() { return _state == TunnelState.START_ON_LOAD || _state == TunnelState.STARTING; }
|
||||
|
||||
|
@@ -447,6 +447,26 @@ public class GeneralHelper {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Works even if tunnel is not running.
|
||||
* @return true if offline keys
|
||||
* @since 0.9.40
|
||||
*/
|
||||
public boolean isOfflineKeys(int tunnel) {
|
||||
TunnelController tun = getController(tunnel);
|
||||
if (tun != null) {
|
||||
if (tun.getIsRunning())
|
||||
return tun.getIsOfflineKeys();
|
||||
// do this the hard way
|
||||
File keyFile = tun.getPrivateKeyFile();
|
||||
if (keyFile != null) {
|
||||
PrivateKeyFile pkf = new PrivateKeyFile(keyFile);
|
||||
return pkf.isOffline();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldStartAutomatically(int tunnel) {
|
||||
TunnelController tun = getController(tunnel);
|
||||
return tun != null ? tun.getStartOnLoad() : false;
|
||||
|
@@ -608,6 +608,15 @@ public class IndexBean {
|
||||
return d.toBase32();
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Works even if tunnel is not running.
|
||||
* @return true if offline keys
|
||||
* @since 0.9.40
|
||||
*/
|
||||
public boolean getIsOfflineKeys(int tunnel) {
|
||||
return _helper.isOfflineKeys(tunnel);
|
||||
}
|
||||
|
||||
/**
|
||||
* For index.jsp
|
||||
|
Reference in New Issue
Block a user