Changeset 6cf7bc7


Ignore:
Timestamp:
Oct 2, 2010 5:20:39 PM (10 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
48ccf85e
Parents:
3d9b606
Message:
  • i2ptunnel:
    • Add hostname DSA signature field, to be used for addkey forms. Experimental, may be commented out later.
Location:
apps/i2ptunnel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java

    r3d9b606 r6cf7bc7  
    1414import java.util.StringTokenizer;
    1515
     16import net.i2p.data.Base64;
     17import net.i2p.data.Destination;
     18import net.i2p.data.PrivateKeyFile;
     19import net.i2p.data.Signature;
     20import net.i2p.data.SigningPrivateKey;
    1621import net.i2p.i2ptunnel.TunnelController;
    1722import net.i2p.i2ptunnel.TunnelControllerGroup;
     
    6772            tunnel = _group.getControllers().size();
    6873        return "i2ptunnel" + tunnel + "-privKeys.dat";
     74    }
     75   
     76    public String getNameSignature(int tunnel) {
     77        String spoof = getSpoofedHost(tunnel);
     78        if (spoof.length() <= 0)
     79            return "";
     80        TunnelController tun = getController(tunnel);
     81        if (tun == null)
     82            return "";
     83        String keyFile = tun.getPrivKeyFile();
     84        if (keyFile != null && keyFile.trim().length() > 0) {
     85            PrivateKeyFile pkf = new PrivateKeyFile(keyFile);
     86            try {
     87                Destination d = pkf.getDestination();
     88                if (d == null)
     89                    return "";
     90                SigningPrivateKey privKey = pkf.getSigningPrivKey();
     91                if (privKey == null)
     92                    return "";
     93                //System.err.println("Signing " + spoof + " with " + Base64.encode(privKey.getData()));
     94                Signature sig = _context.dsa().sign(spoof.getBytes("UTF-8"), privKey);
     95                return Base64.encode(sig.getData());
     96            } catch (Exception e) {}
     97        }
     98        return "";
    6999    }
    70100   
  • apps/i2ptunnel/jsp/editServer.jsp

    r3d9b606 r6cf7bc7  
    197197         <% } %>
    198198            </div>
    199            
     199
     200            <% if (("httpserver".equals(tunnelType)) || ("httpbidirserver".equals(tunnelType))) {
     201          %><div id="sigField" class="rowItem">
     202                <label for="signature">
     203                    <%=intl._("Hostname Signature")%>
     204                </label>
     205                <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" />               
     206            </div>
     207            <% } %>
     208
    200209            <div class="footer">
    201210            </div>
Note: See TracChangeset for help on using the changeset viewer.