785 /**
786 * Return the name of this attribute.
787 */
788 public String getName() {
789 return(NAME);
790 }
791
792 /**
793 * Returns a printable representation of the certificate. This does not
794 * contain all the information available to distinguish this from any
795 * other certificate. The certificate must be fully constructed
796 * before this function may be called.
797 */
798 public String toString() {
799 if (info == null || algId == null || signature == null)
800 return "";
801
802 StringBuilder sb = new StringBuilder();
803
804 sb.append("[\n");
805 sb.append(info.toString() + "\n");
806 sb.append(" Algorithm: [" + algId.toString() + "]\n");
807
808 HexDumpEncoder encoder = new HexDumpEncoder();
809 sb.append(" Signature:\n" + encoder.encodeBuffer(signature));
810 sb.append("\n]");
811
812 return sb.toString();
813 }
814
815 // the strongly typed gets, as per java.security.cert.X509Certificate
816
817 /**
818 * Gets the publickey from this certificate.
819 *
820 * @return the publickey.
821 */
822 public PublicKey getPublicKey() {
823 if (info == null)
824 return null;
825 try {
826 PublicKey key = (PublicKey)info.get(CertificateX509Key.NAME
827 + DOT + CertificateX509Key.KEY);
828 return key;
829 } catch (Exception e) {
|
785 /**
786 * Return the name of this attribute.
787 */
788 public String getName() {
789 return(NAME);
790 }
791
792 /**
793 * Returns a printable representation of the certificate. This does not
794 * contain all the information available to distinguish this from any
795 * other certificate. The certificate must be fully constructed
796 * before this function may be called.
797 */
798 public String toString() {
799 if (info == null || algId == null || signature == null)
800 return "";
801
802 StringBuilder sb = new StringBuilder();
803
804 sb.append("[\n");
805 sb.append(info).append('\n');
806 sb.append(" Algorithm: [").append(algId).append("]\n");
807
808 HexDumpEncoder encoder = new HexDumpEncoder();
809 sb.append(" Signature:\n").append(encoder.encodeBuffer(signature));
810 sb.append("\n]");
811
812 return sb.toString();
813 }
814
815 // the strongly typed gets, as per java.security.cert.X509Certificate
816
817 /**
818 * Gets the publickey from this certificate.
819 *
820 * @return the publickey.
821 */
822 public PublicKey getPublicKey() {
823 if (info == null)
824 return null;
825 try {
826 PublicKey key = (PublicKey)info.get(CertificateX509Key.NAME
827 + DOT + CertificateX509Key.KEY);
828 return key;
829 } catch (Exception e) {
|