i2ptunnel:

- Fix hostname signature not finding private key file
 - Hide hostname signature if not successful
 - Null check for hostname signature failure
 - Make add-to-addressbook link a button
 - Add QR code generation
This commit is contained in:
zzz
2016-02-26 15:25:01 +00:00
parent 5f7d636738
commit b3f37db33f
4 changed files with 54 additions and 15 deletions

View File

@ -8,6 +8,7 @@ package net.i2p.i2ptunnel.web;
* *
*/ */
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -79,7 +80,10 @@ public class EditBean extends IndexBean {
return ""; return "";
String keyFile = tun.getPrivKeyFile(); String keyFile = tun.getPrivKeyFile();
if (keyFile != null && keyFile.trim().length() > 0) { if (keyFile != null && keyFile.trim().length() > 0) {
PrivateKeyFile pkf = new PrivateKeyFile(keyFile); File f = new File(keyFile);
if (!f.isAbsolute())
f = new File(_context.getConfigDir(), keyFile);
PrivateKeyFile pkf = new PrivateKeyFile(f);
try { try {
Destination d = pkf.getDestination(); Destination d = pkf.getDestination();
if (d == null) if (d == null)
@ -87,8 +91,9 @@ public class EditBean extends IndexBean {
SigningPrivateKey privKey = pkf.getSigningPrivKey(); SigningPrivateKey privKey = pkf.getSigningPrivKey();
if (privKey == null) if (privKey == null)
return ""; return "";
//System.err.println("Signing " + spoof + " with " + Base64.encode(privKey.getData()));
Signature sig = _context.dsa().sign(spoof.getBytes("UTF-8"), privKey); Signature sig = _context.dsa().sign(spoof.getBytes("UTF-8"), privKey);
if (sig == null)
return "";
return Base64.encode(sig.getData()); return Base64.encode(sig.getData());
} catch (I2PException e) { } catch (I2PException e) {
} catch (IOException e) {} } catch (IOException e) {}

View File

@ -226,26 +226,49 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
<%=intl._t("Local destination")%>(<span class="accessKey">L</span>): <%=intl._t("Local destination")%>(<span class="accessKey">L</span>):
</label> </label>
<textarea rows="1" style="height: 3em;" cols="60" readonly="readonly" id="localDestination" title="Read Only: Local Destination (if known)" wrap="off" spellcheck="false"><%=editBean.getDestinationBase64(curTunnel)%></textarea> <textarea rows="1" style="height: 3em;" cols="60" readonly="readonly" id="localDestination" title="Read Only: Local Destination (if known)" wrap="off" spellcheck="false"><%=editBean.getDestinationBase64(curTunnel)%></textarea>
<% String b64 = editBean.getDestinationBase64(curTunnel);
if (!"".equals(b64)) {
String name = editBean.getSpoofedHost(curTunnel);
if (name == null || name.equals(""))
name = editBean.getTunnelName(curTunnel);
if (!"".equals(name)) { %>
<a href="/susidns/addressbook.jsp?book=private&amp;hostname=<%=name%>&amp;destination=<%=b64%>#add"><%=intl._t("Add to local addressbook")%></a>
<% }
} %>
</div> </div>
<% if (("httpserver".equals(tunnelType)) || ("httpbidirserver".equals(tunnelType))) { <% if (("httpserver".equals(tunnelType)) || ("httpbidirserver".equals(tunnelType))) {
String sig = editBean.getNameSignature(curTunnel);
if (sig.length() > 0) {
%><div id="sigField" class="rowItem"> %><div id="sigField" class="rowItem">
<label for="signature"> <label for="signature">
<%=intl._t("Hostname Signature")%> <%=intl._t("Hostname Signature")%>
</label> </label>
<input type="text" size="30" readonly="readonly" title="Use to prove that the website name is for this destination" value="<%=editBean.getNameSignature(curTunnel)%>" wrap="off" class="freetext" /> <input type="text" size="30" readonly="readonly" title="Use to prove that the website name is for this destination" value="<%=sig%>" wrap="off" class="freetext" />
</div> </div>
<% } %> <%
} // sig
} // type
String b64 = editBean.getDestinationBase64(curTunnel);
if (!"".equals(b64)) {
%>
<div id="destinationField" class="rowItem">
<%
b64 = b64.replace("=", "%3d");
String name = editBean.getSpoofedHost(curTunnel);
if (name == null || name.equals(""))
name = editBean.getTunnelName(curTunnel);
if (name != null && !name.equals("") && !name.contains(" ") && name.endsWith(".i2p")) {
%>
<label>
<a class="control" title="<%=intl._t("Generate QR code")%>" href="/imagegen/qr?s=320&amp;t=<%=name%>&amp;c=http%3a%2f%2f<%=name%>%2f%3fi2paddresshelper%3d<%=b64%>" target="_top"><%=intl._t("Generate QR Code")%></a>
</label>
<a class="control" href="/susidns/addressbook.jsp?book=private&amp;hostname=<%=name%>&amp;destination=<%=b64%>#add"><%=intl._t("Add to local addressbook")%></a>
<%
} else {
%>
<label> </label>
<span class="comment"><%=intl._t("Set name with .i2p suffix to enable QR code generation")%></span>
<%
} // name
%>
</div>
<%
} // b64
%>
<div class="footer"> <div class="footer">
</div> </div>
</div> </div>

View File

@ -1,3 +1,14 @@
2016-02-26 zzz
* Console:
- Add X-Content-Type-Options header everywhere (ticket #1763)
- Don't display error after clicking restart on /graph page (ticket #1582)
* i2ptunnel:
- Fix default shouldBundleReplyInfo for non-HTTP servers
- Fix display of hostname signature
- Add QR code generation
* Router: Log full path to wrapper.log when dumping threads
* Transports: Increase connection limits for class N and higher
2016-02-22 zzz 2016-02-22 zzz
* Console: Improve news CSS (ticket #1710) * Console: Improve news CSS (ticket #1710)
* Crypto: Blacklist certificates by SHA1 hash, not by serial/CN/OU * Crypto: Blacklist certificates by SHA1 hash, not by serial/CN/OU
@ -327,7 +338,7 @@ Prop from i2p.i2p.zzz.test2:
* SSU: * SSU:
- Support extended options - Support extended options
- Add support for requesting a relay tag via - Add support for requesting a relay tag via
Session Request extended options (ticket #1465) Session Request extended options (tickets #1465, #1656)
* Tunnels: * Tunnels:
- Locking fixes - Locking fixes
- Don't set stats in our own profile - Don't set stats in our own profile

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 8; public final static long BUILD = 9;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";