comparison src/com/five_ten_sg/connectbot/bean/PubkeyBean.java @ 340:82d127ae1550 ganymed

fix pubkey display; better layout for generate pub keys
author Carl Byington <carl@five-ten-sg.com>
date Thu, 31 Jul 2014 15:53:40 -0700
parents 0ce5cc452d02
children
comparison
equal deleted inserted replaced
339:cd1d87edcbf6 340:82d127ae1550
32 * @author Kenny Root 32 * @author Kenny Root
33 * 33 *
34 */ 34 */
35 public class PubkeyBean extends AbstractBean { 35 public class PubkeyBean extends AbstractBean {
36 public static final String BEAN_NAME = "pubkey"; 36 public static final String BEAN_NAME = "pubkey";
37
38 private static final String KEY_TYPE_RSA = "RSA";
39
40 private static final String KEY_TYPE_DSA = "DSA";
41
42 private static final String KEY_TYPE_EC = "EC";
43 37
44 /* Database fields */ 38 /* Database fields */
45 private long id; 39 private long id;
46 private String nickname; 40 private String nickname;
47 private String type; 41 private String type;
165 public String getDescription() { 159 public String getDescription() {
166 if (description == null) { 160 if (description == null) {
167 final StringBuilder sb = new StringBuilder(); 161 final StringBuilder sb = new StringBuilder();
168 162
169 try { 163 try {
170 final PublicKey pubKey = PubkeyUtils.decodePublic(privateKey, type); 164 final PublicKey pubKey = PubkeyUtils.decodePublic(publicKey, type);
171 165
172 if (PubkeyDatabase.KEY_TYPE_RSA.equals(type)) { 166 if (PubkeyDatabase.KEY_TYPE_RSA.equals(type)) {
173 int bits = ((RSAPublicKey) pubKey).getModulus().bitLength(); 167 int bits = ((RSAPublicKey) pubKey).getModulus().bitLength();
174 sb.append("RSA "); 168 sb.append("RSA ");
175 sb.append(bits); 169 sb.append(bits);