1 17 package com.sun.org.apache.xml.internal.security.keys.content.x509; 18 19 20 21 import java.security.cert.X509Certificate ; 22 23 import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException; 24 import com.sun.org.apache.xml.internal.security.utils.Constants; 25 import com.sun.org.apache.xml.internal.security.utils.RFC2253Parser; 26 import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy; 27 import org.w3c.dom.Document ; 28 import org.w3c.dom.Element ; 29 30 34 public class XMLX509SubjectName extends SignatureElementProxy 35 implements XMLX509DataContent { 36 37 38 static java.util.logging.Logger log = 39 java.util.logging.Logger.getLogger(XMLX509SubjectName.class.getName()); 40 41 48 public XMLX509SubjectName(Element element, String BaseURI) 49 throws XMLSecurityException { 50 super(element, BaseURI); 51 } 52 53 59 public XMLX509SubjectName(Document doc, String X509SubjectNameString) { 60 61 super(doc); 62 63 this.addText(X509SubjectNameString); 64 } 65 66 72 public XMLX509SubjectName(Document doc, X509Certificate x509certificate) { 73 this(doc, 74 RFC2253Parser.normalize(x509certificate.getSubjectDN().getName())); 75 } 76 77 83 public String getSubjectName() { 84 return RFC2253Parser.normalize(this.getTextFromTextChild()); 85 } 86 87 88 public boolean equals(Object obj) { 89 90 if (!obj.getClass().getName().equals(this.getClass().getName())) { 91 return false; 92 } 93 94 XMLX509SubjectName other = (XMLX509SubjectName) obj; 95 String otherSubject = other.getSubjectName(); 96 String thisSubject = this.getSubjectName(); 97 98 if (otherSubject.equals(thisSubject)) { 99 return true; 100 } 101 102 return false; 103 104 } 105 106 107 public String getBaseLocalName() { 108 return Constants._TAG_X509SUBJECTNAME; 109 } 110 } 111 | Popular Tags |