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.util.List;
import java.util.Set;
@ -79,7 +80,10 @@ public class EditBean extends IndexBean {
return "";
String keyFile = tun.getPrivKeyFile();
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 {
Destination d = pkf.getDestination();
if (d == null)
@ -87,8 +91,9 @@ public class EditBean extends IndexBean {
SigningPrivateKey privKey = pkf.getSigningPrivKey();
if (privKey == null)
return "";
//System.err.println("Signing " + spoof + " with " + Base64.encode(privKey.getData()));
Signature sig = _context.dsa().sign(spoof.getBytes("UTF-8"), privKey);
if (sig == null)
return "";
return Base64.encode(sig.getData());
} catch (I2PException e) {
} catch (IOException e) {}