* Console: Add /proof page which can copied to prove you run a router

This commit is contained in:
zzz
2013-09-23 16:39:40 +00:00
parent 4fb3e86e4d
commit 9ebfccd8f6
4 changed files with 60 additions and 4 deletions

View File

@ -0,0 +1,37 @@
package net.i2p.router.web;
import java.util.Date;
import net.i2p.data.DataHelper;
import net.i2p.data.RouterAddress;
import net.i2p.data.RouterInfo;
import net.i2p.data.Signature;
/**
* Sign a statement about this router.
* @since 0.9.8
*/
public class ProofHelper extends HelperBase {
public String getProof() {
StringBuilder buf = new StringBuilder(512);
RouterInfo us = _context.router().getRouterInfo();
buf.append("Hash: ").append(us.getIdentity().calculateHash().toBase64()).append('\n');
//buf.append("Ident: ").append(us.getIdentity().toBase64()).append('\n');
for (RouterAddress addr : us.getAddresses()) {
buf.append(addr.getTransportStyle()).append(": ").append(addr.getHost()).append('\n');
}
buf.append("Caps: ").append(us.getCapabilities()).append('\n');
buf.append("Date: ").append(new Date()); // no trailing newline
String msg = buf.toString();
byte[] data = DataHelper.getUTF8(msg);
Signature sig = _context.dsa().sign(data, _context.keyManager().getSigningPrivateKey());
buf.setLength(0);
buf.append("--- BEGIN I2P SIGNED MESSAGE ---\n");
buf.append(msg);
buf.append("\n--- END I2P SIGNED MESSAGE ---\n");
buf.append(sig.toBase64());
buf.append("\n--- END I2P SIGNATURE ---");
return buf.toString();
}
}

View File

@ -0,0 +1,16 @@
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<%@include file="css.jsi" %>
<%=intl.title("Proof")%>
<script src="/js/ajax.js" type="text/javascript"></script>
<%@include file="summaryajax.jsi" %>
</head><body onload="initAjax()">
<%@include file="summary.jsi" %><h1>Proof of Ownership</h1>
<div class="main" id="main">
<jsp:useBean class="net.i2p.router.web.ProofHelper" id="proofHelper" scope="request" />
<jsp:setProperty name="proofHelper" property="contextId" value="<%=(String)session.getAttribute(\"i2p.contextId\")%>" />
<textarea cols="70" rows="15" wrap="off" readonly="readonly" spellcheck="false"><jsp:getProperty name="proofHelper" property="proof" /></textarea>
</div></body></html>

View File

@ -1,9 +1,12 @@
2013-09-23 zzz
* Console: Add /proof page which can copied to prove you run a router
2013-09-20 kytv 2013-09-20 kytv
- Chinese, French, German, Russian, and Swedish translation updates from * Chinese, French, German, Russian, and Swedish translation updates from
Transifex Transifex
2013-09-17 zzz 2013-09-17 zzz
- Revert expl. default back to 2 hops, wait for next release * Revert expl. default back to 2 hops, wait for next release
2013-09-07 zzz 2013-09-07 zzz
* Crypto: Don't use "short exponent" on faster platforms. * Crypto: Don't use "short exponent" on faster platforms.

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 = 28; public final static long BUILD = 29;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = "-rc"; public final static String EXTRA = "-rc";