1 17 package com.sun.org.apache.xml.internal.security.keys.content.x509; 18 19 20 21 import java.math.BigInteger ; 22 import java.security.cert.X509Certificate ; 23 24 import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException; 25 import com.sun.org.apache.xml.internal.security.utils.Constants; 26 import com.sun.org.apache.xml.internal.security.utils.RFC2253Parser; 27 import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy; 28 import com.sun.org.apache.xml.internal.security.utils.XMLUtils; 29 import org.w3c.dom.Document ; 30 import org.w3c.dom.Element ; 31 32 33 37 public class XMLX509IssuerSerial extends SignatureElementProxy 38 implements XMLX509DataContent { 39 40 41 static java.util.logging.Logger log = 42 java.util.logging.Logger.getLogger( 43 XMLX509IssuerSerial.class.getName()); 44 45 52 public XMLX509IssuerSerial(Element element, String BaseURI) 53 throws XMLSecurityException { 54 super(element, BaseURI); 55 } 56 57 64 public XMLX509IssuerSerial(Document doc, String X509IssuerName, 65 BigInteger X509SerialNumber) { 66 67 super(doc); 68 69 XMLUtils.addReturnToElement(this._constructionElement); 70 this.addTextElement(X509IssuerName, Constants._TAG_X509ISSUERNAME); 71 XMLUtils.addReturnToElement(this._constructionElement); 72 this.addTextElement(X509SerialNumber.toString(), Constants._TAG_X509SERIALNUMBER); 73 } 74 75 82 public XMLX509IssuerSerial(Document doc, String X509IssuerName, 83 String X509SerialNumber) { 84 this(doc, X509IssuerName, new BigInteger (X509SerialNumber)); 85 } 86 87 94 public XMLX509IssuerSerial(Document doc, String X509IssuerName, 95 int X509SerialNumber) { 96 this(doc, X509IssuerName, 97 new BigInteger (Integer.toString(X509SerialNumber))); 98 } 99 100 106 public XMLX509IssuerSerial(Document doc, X509Certificate x509certificate) { 107 108 this(doc, 109 RFC2253Parser.normalize(x509certificate.getIssuerDN().getName()), 110 x509certificate.getSerialNumber()); 111 } 112 113 119 public BigInteger getSerialNumber() { 120 121 String text = 122 this.getTextFromChildElement(Constants._TAG_X509SERIALNUMBER, 123 Constants.SignatureSpecNS); 124 if (true) 125 if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "In dem X509SerialNumber wurde gefunden: " + text); 126 127 return new BigInteger (text); 128 } 129 130 136 public int getSerialNumberInteger() { 137 return this.getSerialNumber().intValue(); 138 } 139 140 146 public String getIssuerName() { 147 148 return RFC2253Parser 149 .normalize(this 150 .getTextFromChildElement(Constants._TAG_X509ISSUERNAME, 151 Constants.SignatureSpecNS)); 152 } 153 154 155 public boolean equals(Object obj) { 156 157 if (!obj.getClass().getName().equals(this.getClass().getName())) { 158 return false; 159 } 160 161 XMLX509IssuerSerial other = (XMLX509IssuerSerial) obj; 162 163 164 if (other.getSerialNumber().equals(this.getSerialNumber()) 165 && other.getIssuerName().equals(this.getIssuerName())) { 166 return true; 167 } 168 169 return false; 170 } 171 172 173 public String getBaseLocalName() { 174 return Constants._TAG_X509ISSUERSERIAL; 175 } 176 } 177 | Popular Tags |