* Key cert GUI support:

- Add setting in i2ptunnel server edit page
  - Comment out cert setting on i2ptunnel server edit page
  - Show key type on susidns details page
  - Show key type on LS debug page
This commit is contained in:
zzz
2014-01-03 15:31:08 +00:00
parent e8e239616f
commit 41e071efe5
6 changed files with 82 additions and 2 deletions

View File

@@ -29,6 +29,7 @@ import java.util.Locale;
import java.util.Properties;
import net.i2p.I2PAppContext;
import net.i2p.crypto.SigType;
import net.i2p.data.Base32;
import net.i2p.data.Base64;
import net.i2p.data.Certificate;
@@ -228,11 +229,38 @@ public class AddressBean
return _("Hidden");
case Certificate.CERTIFICATE_TYPE_SIGNED:
return _("Signed");
case Certificate.CERTIFICATE_TYPE_KEY:
return _("Key");
default:
return _("Type {0}", type);
}
}
/**
* Do this the easy way
* @since 0.9.11
*/
public String getSigType() {
// (4 / 3) * (pubkey length + signing key length)
String cert = destination.substring(512);
if (cert.equals("AAAA"))
return _("DSA 1024 bit");
byte[] enc = Base64.decode(cert);
if (enc == null)
// shouldn't happen
return "invalid";
int type = enc[0] & 0xff;
if (type != Certificate.CERTIFICATE_TYPE_KEY)
return _("DSA 1024 bit");
int st = ((enc[3] & 0xff) << 8) | (enc[4] & 0xff);
if (st == 0)
return _("DSA 1024 bit");
SigType stype = SigType.getByCode(st);
if (stype == null)
return _("Type {0}", st);
return stype.toString();
}
/** @since 0.8.7 */
private String getProp(String p) {
if (props == null)

View File

@@ -107,7 +107,7 @@
<td><%=intl._("ElGamal 2048 bit")%></td>
</tr><tr class="list${book.trClass}">
<td><%=intl._("Signing Key")%></td>
<td><%=intl._("DSA 1024 bit")%></td>
<td><%=addr.getSigType()%></td>
</tr><tr class="list${book.trClass}">
<td><%=intl._("Certificate")%></td>
<td><%=addr.getCert()%></td>