forked from I2P_Developers/i2p.i2p
i2ptunnel: Set default sig type to ECDSA P256 for client tunnel
types Standard, IRC, and Socks IRC, if non-shared.
This commit is contained in:
@ -71,6 +71,7 @@ public class TunnelController implements Logging {
|
||||
private static final String OPT_BUNDLE_REPLY = PFX_OPTION + "shouldBundleReplyInfo";
|
||||
private static final String OPT_TAGS_SEND = PFX_OPTION + "crypto.tagsToSend";
|
||||
private static final String OPT_LOW_TAGS = PFX_OPTION + "crypto.lowTagThreshold";
|
||||
private static final String OPT_SIG_TYPE = PFX_OPTION + I2PClient.PROP_SIGTYPE;
|
||||
|
||||
/** all of these @since 0.9.14 */
|
||||
public static final String TYPE_CONNECT = "connectclient";
|
||||
@ -145,13 +146,13 @@ public class TunnelController implements Logging {
|
||||
try {
|
||||
fos = new SecureFileOutputStream(keyFile);
|
||||
SigType stype = I2PClient.DEFAULT_SIGTYPE;
|
||||
String st = _config.getProperty(PFX_OPTION + I2PClient.PROP_SIGTYPE);
|
||||
String st = _config.getProperty(OPT_SIG_TYPE);
|
||||
if (st != null) {
|
||||
SigType type = SigType.parseSigType(st);
|
||||
if (type != null)
|
||||
stype = type;
|
||||
else
|
||||
log("Unsupported sig type " + st);
|
||||
log("Unsupported sig type " + st + ", reverting to " + stype);
|
||||
}
|
||||
Destination dest = client.createDestination(fos, stype);
|
||||
String destStr = dest.toBase64();
|
||||
@ -584,6 +585,13 @@ public class TunnelController implements Logging {
|
||||
if (!_config.containsKey(OPT_LOW_TAGS))
|
||||
_config.setProperty(OPT_LOW_TAGS, "14");
|
||||
}
|
||||
// same default logic as in EditBean.getSigType()
|
||||
if ((type.equals(TYPE_IRC_CLIENT) || type.equals(TYPE_STD_CLIENT) || type.equals(TYPE_SOCKS_IRC))
|
||||
&& !Boolean.valueOf(getSharedClient())) {
|
||||
if (!_config.containsKey(OPT_SIG_TYPE) &&
|
||||
SigType.ECDSA_SHA256_P256.isAvailable())
|
||||
_config.setProperty(OPT_SIG_TYPE, "ECDSA_SHA256_P256");
|
||||
}
|
||||
}
|
||||
|
||||
// tell i2ptunnel, who will tell the TunnelTask, who will tell the SocketManager
|
||||
|
@ -181,14 +181,35 @@ public class EditBean extends IndexBean {
|
||||
return getBooleanProperty(tunnel, "i2cp.encryptLeaseSet");
|
||||
}
|
||||
|
||||
/** @since 0.9.12 */
|
||||
public int getSigType(int tunnel) {
|
||||
String stype = getProperty(tunnel, I2PClient.PROP_SIGTYPE, "0");
|
||||
if (stype.equals("0"))
|
||||
return 0;
|
||||
SigType type = SigType.parseSigType(stype);
|
||||
if (type == null)
|
||||
return 0;
|
||||
/**
|
||||
* @param newTunnelType used if tunnel < 0
|
||||
* @since 0.9.12
|
||||
*/
|
||||
public int getSigType(int tunnel, String newTunnelType) {
|
||||
SigType type;
|
||||
String ttype;
|
||||
boolean isShared;
|
||||
if (tunnel >= 0) {
|
||||
String stype = getProperty(tunnel, I2PClient.PROP_SIGTYPE, null);
|
||||
type = stype != null ? SigType.parseSigType(stype) : null;
|
||||
ttype = getTunnelType(tunnel);
|
||||
isShared = isSharedClient(tunnel);
|
||||
} else {
|
||||
type = null;
|
||||
ttype = newTunnelType;
|
||||
isShared = false;
|
||||
}
|
||||
if (type == null) {
|
||||
// same default logic as in TunnelController.setConfig()
|
||||
if ((TunnelController.TYPE_IRC_CLIENT.equals(ttype) ||
|
||||
TunnelController.TYPE_SOCKS_IRC.equals(ttype) ||
|
||||
TunnelController.TYPE_STD_CLIENT.equals(ttype)) &&
|
||||
!isShared &&
|
||||
SigType.ECDSA_SHA256_P256.isAvailable())
|
||||
type = SigType.ECDSA_SHA256_P256;
|
||||
else
|
||||
type = SigType.DSA_SHA1;
|
||||
}
|
||||
return type.getCode();
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,8 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
||||
<div id="tunnelEditPanel" class="panel">
|
||||
<div class="header">
|
||||
<%
|
||||
String tunnelTypeName = "";
|
||||
String tunnelType = "";
|
||||
String tunnelTypeName;
|
||||
String tunnelType;
|
||||
if (curTunnel >= 0) {
|
||||
tunnelTypeName = editBean.getTunnelType(curTunnel);
|
||||
tunnelType = editBean.getInternalType(curTunnel);
|
||||
@ -491,7 +491,9 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
||||
</div>
|
||||
<% } // if httpclient %>
|
||||
|
||||
<% if (true /* editBean.isAdvanced() */ ) { %>
|
||||
<% if (true /* editBean.isAdvanced() */ ) {
|
||||
int currentSigType = editBean.getSigType(curTunnel, tunnelType);
|
||||
%>
|
||||
<div id="tunnelOptionsField" class="rowItem">
|
||||
<label>
|
||||
<%=intl._("Signature type")%>
|
||||
@ -501,30 +503,30 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
||||
<div id="hostField" class="rowItem">
|
||||
<div id="portField" class="rowItem">
|
||||
<label>DSA-SHA1</label>
|
||||
<input value="0" type="radio" id="startOnLoad" name="sigType" title="Default"<%=(editBean.getSigType(curTunnel)==0 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
<input value="0" type="radio" id="startOnLoad" name="sigType" title="Default"<%=(currentSigType==0 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
</div>
|
||||
<% if (editBean.isSigTypeAvailable(1)) { %>
|
||||
<div id="portField" class="rowItem">
|
||||
<label>ECDSA-P256</label>
|
||||
<input value="1" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(editBean.getSigType(curTunnel)==1 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
<input value="1" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(currentSigType==1 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
</div>
|
||||
<% }
|
||||
if (editBean.isSigTypeAvailable(2)) { %>
|
||||
<div id="portField" class="rowItem">
|
||||
<label>ECDSA-P384</label>
|
||||
<input value="2" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(editBean.getSigType(curTunnel)==2 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
<input value="2" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(currentSigType==2 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
</div>
|
||||
<% }
|
||||
if (editBean.isSigTypeAvailable(3)) { %>
|
||||
<div id="portField" class="rowItem">
|
||||
<label>ECDSA-P521</label>
|
||||
<input value="3" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(editBean.getSigType(curTunnel)==3 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
<input value="3" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(currentSigType==3 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
</div>
|
||||
<% }
|
||||
if (editBean.isSigTypeAvailable(7)) { %>
|
||||
<div id="portField" class="rowItem">
|
||||
<label>Ed25519-SHA-512</label>
|
||||
<input value="7" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(editBean.getSigType(curTunnel)==7 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
<input value="7" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(currentSigType==7 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
</div>
|
||||
<% } // isAvailable %>
|
||||
</div>
|
||||
|
@ -44,8 +44,8 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
||||
<div id="tunnelEditPanel" class="panel">
|
||||
<div class="header">
|
||||
<%
|
||||
String tunnelTypeName = "";
|
||||
String tunnelType = "";
|
||||
String tunnelTypeName;
|
||||
String tunnelType;
|
||||
if (curTunnel >= 0) {
|
||||
tunnelTypeName = editBean.getTunnelType(curTunnel);
|
||||
tunnelType = editBean.getInternalType(curTunnel);
|
||||
@ -570,7 +570,9 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
||||
</div>
|
||||
<% **********************/ %>
|
||||
|
||||
<% if (true /* editBean.isAdvanced() */ ) { %>
|
||||
<% if (true /* editBean.isAdvanced() */ ) {
|
||||
int currentSigType = editBean.getSigType(curTunnel, tunnelType);
|
||||
%>
|
||||
<div id="tunnelOptionsField" class="rowItem">
|
||||
<label>
|
||||
<%=intl._("Signature type")%>
|
||||
@ -580,30 +582,30 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
||||
<div id="hostField" class="rowItem">
|
||||
<div id="portField" class="rowItem">
|
||||
<label>DSA-SHA1</label>
|
||||
<input value="0" type="radio" id="startOnLoad" name="sigType" title="Default"<%=(editBean.getSigType(curTunnel)==0 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
<input value="0" type="radio" id="startOnLoad" name="sigType" title="Default"<%=(currentSigType==0 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
</div>
|
||||
<% if (editBean.isSigTypeAvailable(1)) { %>
|
||||
<div id="portField" class="rowItem">
|
||||
<label>ECDSA-P256</label>
|
||||
<input value="1" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(editBean.getSigType(curTunnel)==1 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
<input value="1" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(currentSigType==1 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
</div>
|
||||
<% }
|
||||
if (editBean.isSigTypeAvailable(2)) { %>
|
||||
<div id="portField" class="rowItem">
|
||||
<label>ECDSA-P384</label>
|
||||
<input value="2" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(editBean.getSigType(curTunnel)==2 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
<input value="2" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(currentSigType==2 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
</div>
|
||||
<% }
|
||||
if (editBean.isSigTypeAvailable(3)) { %>
|
||||
<div id="portField" class="rowItem">
|
||||
<label>ECDSA-P521</label>
|
||||
<input value="3" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(editBean.getSigType(curTunnel)==3 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
<input value="3" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(currentSigType==3 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
</div>
|
||||
<% }
|
||||
if (editBean.isSigTypeAvailable(7)) { %>
|
||||
<div id="portField" class="rowItem">
|
||||
<label>Ed25519-SHA-512</label>
|
||||
<input value="7" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(editBean.getSigType(curTunnel)==7 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
<input value="7" type="radio" id="startOnLoad" name="sigType" title="Advanced users only"<%=(currentSigType==7 ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
</div>
|
||||
<% } // isAvailable %>
|
||||
</div>
|
||||
|
@ -1,3 +1,7 @@
|
||||
2014-10-13 zzz
|
||||
* i2ptunnel: Set default sig type to ECDSA-P256 for client types
|
||||
Standard, IRC, and Socks IRC, if non-shared.
|
||||
|
||||
2014-10-10 zzz
|
||||
* Banlist: Remove unused banlist tracking in the profile
|
||||
causing deadlock (ticket #1394)
|
||||
|
@ -44,6 +44,7 @@ tunnel.1.option.outbound.nickname=Irc2P
|
||||
tunnel.1.option.i2cp.closeIdleTime=1200000
|
||||
tunnel.1.option.i2cp.closeOnIdle=true
|
||||
tunnel.1.option.i2cp.delayOpen=true
|
||||
tunnel.1.option.i2cp.destination.sigType=ECDSA_SHA256_P256
|
||||
tunnel.1.option.i2cp.newDestOnResume=false
|
||||
tunnel.1.option.i2cp.reduceIdleTime=600000
|
||||
tunnel.1.option.i2cp.reduceOnIdle=true
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 8;
|
||||
public final static long BUILD = 9;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
Reference in New Issue
Block a user