forked from I2P_Developers/i2p.i2p
propagate from branch 'i2p.i2p.zzz.ecdsa' (head e83bcdc842f5995d310a4295147f9326a993e010)
to branch 'i2p.i2p' (head 4983f716f8740bc7ddfae5561a562a0d42a815ae)
This commit is contained in:
@@ -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.12
|
||||
*/
|
||||
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)
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user