1 19 20 package com.sslexplorer.security.pki; 21 22 23 28 public class SECSHPublicKeyFormat extends Base64EncodedFileFormat 29 implements SshPublicKeyFormat { 30 private static String BEGIN = "---- BEGIN SSH2 PUBLIC KEY ----"; 31 private static String END = "---- END SSH2 PUBLIC KEY ----"; 32 33 39 public SECSHPublicKeyFormat(String subject, String comment) { 40 super(BEGIN, END); 41 setHeaderValue("Subject", subject); 42 setComment(comment); 43 } 44 45 48 public SECSHPublicKeyFormat() { 49 super(BEGIN, END); 50 } 51 52 57 public void setComment(String comment) { 58 setHeaderValue("Comment", 59 (comment.trim().startsWith("\"") ? "" : "\"") + comment.trim() + 60 (comment.trim().endsWith("\"") ? "" : "\"")); 61 } 62 63 68 public String getComment() { 69 return getHeaderValue("Comment"); 70 } 71 72 77 public String getFormatType() { 78 return "SECSH-PublicKey-" + super.getFormatType(); 79 } 80 81 88 public boolean supportsAlgorithm(String algorithm) { 89 return SshKeyPairFactory.supportsKey(algorithm); 90 } 91 } 92 | Popular Tags |