You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2011/02/10 12:37:05 UTC
svn commit: r1069340 [2/2] - in
/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security:
./ keys/ keys/content/ keys/content/keyvalues/ keys/content/x509/
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/SPKIData.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/SPKIData.java?rev=1069340&r1=1069339&r2=1069340&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/SPKIData.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/SPKIData.java Thu Feb 10 11:37:05 2011
@@ -22,26 +22,25 @@ import org.apache.xml.security.utils.Sig
import org.w3c.dom.Element;
/**
- *
* @author $Author$
* $todo$ implement
*/
public class SPKIData extends SignatureElementProxy implements KeyInfoContent {
- /**
- * Constructor SPKIData
- *
- * @param element
- * @param BaseURI
- * @throws XMLSecurityException
- */
- public SPKIData(Element element, String BaseURI)
- throws XMLSecurityException {
- super(element, BaseURI);
- }
+ /**
+ * Constructor SPKIData
+ *
+ * @param element
+ * @param BaseURI
+ * @throws XMLSecurityException
+ */
+ public SPKIData(Element element, String BaseURI)
+ throws XMLSecurityException {
+ super(element, BaseURI);
+ }
- /** @inheritDoc */
- public String getBaseLocalName() {
- return Constants._TAG_SPKIDATA;
- }
+ /** @inheritDoc */
+ public String getBaseLocalName() {
+ return Constants._TAG_SPKIDATA;
+ }
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/X509Data.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/X509Data.java?rev=1069340&r1=1069339&r2=1069340&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/X509Data.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/X509Data.java Thu Feb 10 11:37:05 2011
@@ -16,8 +16,6 @@
*/
package org.apache.xml.security.keys.content;
-
-
import java.math.BigInteger;
import java.security.cert.X509Certificate;
@@ -34,447 +32,432 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-
-/**
- *
- * @author $Author$
- */
public class X509Data extends SignatureElementProxy implements KeyInfoContent {
- /** {@link org.apache.commons.logging} logging facility */
- static org.apache.commons.logging.Log log =
+ /** {@link org.apache.commons.logging} logging facility */
+ private static org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory.getLog(X509Data.class.getName());
- /**
- * Constructor X509Data
- *
- * @param doc
- */
- public X509Data(Document doc) {
-
- super(doc);
-
- XMLUtils.addReturnToElement(this.constructionElement);
- }
-
- /**
- * Constructor X509Data
- *
- * @param element
- * @param BaseURI
- * @throws XMLSecurityException
- */
- public X509Data(Element element, String BaseURI)
- throws XMLSecurityException {
-
- super(element, BaseURI);
- Node sibling=this.constructionElement.getFirstChild();
- while (sibling!=null) {
- if (sibling.getNodeType()!=Node.ELEMENT_NODE) {
- sibling=sibling.getNextSibling();
- continue;
- }
- return;
- }
- /* No Elements found */
- Object exArgs[] = { "Elements", Constants._TAG_X509DATA };
- throw new XMLSecurityException("xml.WrongContent", exArgs);
- }
-
- /**
- * Method addIssuerSerial
- *
- * @param X509IssuerName
- * @param X509SerialNumber
- */
- public void addIssuerSerial(String X509IssuerName,
- BigInteger X509SerialNumber) {
- this.add(new XMLX509IssuerSerial(this.doc, X509IssuerName,
- X509SerialNumber));
- }
-
- /**
- * Method addIssuerSerial
- *
- * @param X509IssuerName
- * @param X509SerialNumber
- */
- public void addIssuerSerial(String X509IssuerName, String X509SerialNumber) {
- this.add(new XMLX509IssuerSerial(this.doc, X509IssuerName,
- X509SerialNumber));
- }
-
- /**
- * Method addIssuerSerial
- *
- * @param X509IssuerName
- * @param X509SerialNumber
- */
- public void addIssuerSerial(String X509IssuerName, int X509SerialNumber) {
- this.add(new XMLX509IssuerSerial(this.doc, X509IssuerName,
- X509SerialNumber));
- }
-
- /**
- * Method add
- *
- * @param xmlX509IssuerSerial
- */
- public void add(XMLX509IssuerSerial xmlX509IssuerSerial) {
-
- this.constructionElement
- .appendChild(xmlX509IssuerSerial.getElement());
- XMLUtils.addReturnToElement(this.constructionElement);
- }
-
- /**
- * Method addSKI
- *
- * @param skiBytes
- */
- public void addSKI(byte[] skiBytes) {
- this.add(new XMLX509SKI(this.doc, skiBytes));
- }
-
- /**
- * Method addSKI
- *
- * @param x509certificate
- * @throws XMLSecurityException
- */
- public void addSKI(X509Certificate x509certificate)
- throws XMLSecurityException {
- this.add(new XMLX509SKI(this.doc, x509certificate));
- }
-
- /**
- * Method add
- *
- * @param xmlX509SKI
- */
- public void add(XMLX509SKI xmlX509SKI) {
- this.constructionElement.appendChild(xmlX509SKI.getElement());
- XMLUtils.addReturnToElement(this.constructionElement);
- }
-
- /**
- * Method addSubjectName
- *
- * @param subjectName
- */
- public void addSubjectName(String subjectName) {
- this.add(new XMLX509SubjectName(this.doc, subjectName));
- }
-
- /**
- * Method addSubjectName
- *
- * @param x509certificate
- */
- public void addSubjectName(X509Certificate x509certificate) {
- this.add(new XMLX509SubjectName(this.doc, x509certificate));
- }
-
- /**
- * Method add
- *
- * @param xmlX509SubjectName
- */
- public void add(XMLX509SubjectName xmlX509SubjectName) {
- this.constructionElement.appendChild(xmlX509SubjectName.getElement());
- XMLUtils.addReturnToElement(this.constructionElement);
- }
-
- /**
- * Method addCertificate
- *
- * @param x509certificate
- * @throws XMLSecurityException
- */
- public void addCertificate(X509Certificate x509certificate)
- throws XMLSecurityException {
- this.add(new XMLX509Certificate(this.doc, x509certificate));
- }
-
- /**
- * Method addCertificate
- *
- * @param x509certificateBytes
- */
- public void addCertificate(byte[] x509certificateBytes) {
- this.add(new XMLX509Certificate(this.doc, x509certificateBytes));
- }
-
- /**
- * Method add
- *
- * @param xmlX509Certificate
- */
- public void add(XMLX509Certificate xmlX509Certificate) {
- this.constructionElement.appendChild(xmlX509Certificate.getElement());
- XMLUtils.addReturnToElement(this.constructionElement);
- }
-
- /**
- * Method addCRL
- *
- * @param crlBytes
- */
- public void addCRL(byte[] crlBytes) {
- this.add(new XMLX509CRL(this.doc, crlBytes));
- }
-
- /**
- * Method add
- *
- * @param xmlX509CRL
- */
- public void add(XMLX509CRL xmlX509CRL) {
- this.constructionElement.appendChild(xmlX509CRL.getElement());
- XMLUtils.addReturnToElement(this.constructionElement);
- }
-
- /**
- * Method addUnknownElement
- *
- * @param element
- */
- public void addUnknownElement(Element element) {
- this.constructionElement.appendChild(element);
- XMLUtils.addReturnToElement(this.constructionElement);
- }
-
- /**
- * Method lengthIssuerSerial
- *
- * @return the number of IssuerSerial elements in this X509Data
- */
- public int lengthIssuerSerial() {
- return this.length(Constants.SignatureSpecNS,
- Constants._TAG_X509ISSUERSERIAL);
- }
-
- /**
- * Method lengthSKI
- *
- * @return the number of SKI elements in this X509Data
- */
- public int lengthSKI() {
- return this.length(Constants.SignatureSpecNS, Constants._TAG_X509SKI);
- }
-
- /**
- * Method lengthSubjectName
- *
- * @return the number of SubjectName elements in this X509Data
- */
- public int lengthSubjectName() {
- return this.length(Constants.SignatureSpecNS,
- Constants._TAG_X509SUBJECTNAME);
- }
-
- /**
- * Method lengthCertificate
- *
- * @return the number of Certificate elements in this X509Data
- */
- public int lengthCertificate() {
- return this.length(Constants.SignatureSpecNS,
- Constants._TAG_X509CERTIFICATE);
- }
-
- /**
- * Method lengthCRL
- *
- * @return the number of CRL elements in this X509Data
- */
- public int lengthCRL() {
- return this.length(Constants.SignatureSpecNS, Constants._TAG_X509CRL);
- }
-
- /**
- * Method lengthUnknownElement
- *
- * @return the number of UnknownElement elements in this X509Data
- */
- public int lengthUnknownElement() {
-
- int result = 0;
- Node n=this.constructionElement.getFirstChild();
- while (n!=null){
-
- if ((n.getNodeType() == Node.ELEMENT_NODE)
- &&!n.getNamespaceURI().equals(Constants.SignatureSpecNS)) {
- result += 1;
- }
- n=n.getNextSibling();
- }
-
- return result;
- }
-
- /**
- * Method itemIssuerSerial
- *
- * @param i
- * @return the X509IssuerSerial, null if not present
- * @throws XMLSecurityException
- */
- public XMLX509IssuerSerial itemIssuerSerial(int i)
- throws XMLSecurityException {
-
- Element e =
- XMLUtils.selectDsNode(this.constructionElement.getFirstChild(),
- Constants._TAG_X509ISSUERSERIAL,i);
-
- if (e != null) {
- return new XMLX509IssuerSerial(e, this.baseURI);
- }
- return null;
- }
-
- /**
- * Method itemSKI
- *
- * @param i
- * @return the X509SKI, null if not present
- * @throws XMLSecurityException
- */
- public XMLX509SKI itemSKI(int i) throws XMLSecurityException {
-
- Element e = XMLUtils.selectDsNode(this.constructionElement.getFirstChild(),
- Constants._TAG_X509SKI,i);
-
- if (e != null) {
- return new XMLX509SKI(e, this.baseURI);
- }
- return null;
- }
-
- /**
- * Method itemSubjectName
- *
- * @param i
- * @return the X509SubjectName, null if not present
- * @throws XMLSecurityException
- */
- public XMLX509SubjectName itemSubjectName(int i)
- throws XMLSecurityException {
-
- Element e = XMLUtils.selectDsNode(this.constructionElement.getFirstChild(),
- Constants._TAG_X509SUBJECTNAME,i);
-
- if (e != null) {
- return new XMLX509SubjectName(e, this.baseURI);
- }
- return null;
- }
-
- /**
- * Method itemCertificate
- *
- * @param i
- * @return the X509Certifacte, null if not present
- * @throws XMLSecurityException
- */
- public XMLX509Certificate itemCertificate(int i)
- throws XMLSecurityException {
-
- Element e = XMLUtils.selectDsNode(this.constructionElement.getFirstChild(),
- Constants._TAG_X509CERTIFICATE,i);
-
- if (e != null) {
- return new XMLX509Certificate(e, this.baseURI);
- }
- return null;
- }
-
- /**
- * Method itemCRL
- *
- * @param i
- * @return the X509CRL, null if not present
- * @throws XMLSecurityException
- */
- public XMLX509CRL itemCRL(int i) throws XMLSecurityException {
-
- Element e = XMLUtils.selectDsNode(this.constructionElement.getFirstChild(),
- Constants._TAG_X509CRL,i);
-
- if (e != null) {
- return new XMLX509CRL(e, this.baseURI);
- }
- return null;
- }
-
- /**
- * Method itemUnknownElement
- *
- * @param i
- * @return the Unknown Element at i
- * TODO implement
- **/
- public Element itemUnknownElement(int i) {
- log.debug("itemUnknownElement not implemented:"+i);
- return null;
- }
-
- /**
- * Method containsIssuerSerial
- *
- * @return true if this X509Data contains a IssuerSerial
- */
- public boolean containsIssuerSerial() {
- return this.lengthIssuerSerial() > 0;
- }
-
- /**
- * Method containsSKI
- *
- * @return true if this X509Data contains a SKI
- */
- public boolean containsSKI() {
- return this.lengthSKI() > 0;
- }
-
- /**
- * Method containsSubjectName
- *
- * @return true if this X509Data contains a SubjectName
- */
- public boolean containsSubjectName() {
- return this.lengthSubjectName() > 0;
- }
-
- /**
- * Method containsCertificate
- *
- * @return true if this X509Data contains a Certificate
- */
- public boolean containsCertificate() {
- return this.lengthCertificate() > 0;
- }
-
- /**
- * Method containsCRL
- *
- * @return true if this X509Data contains a CRL
- */
- public boolean containsCRL() {
- return this.lengthCRL() > 0;
- }
-
- /**
- * Method containsUnknownElement
- *
- * @return true if this X509Data contains an UnknownElement
- */
- public boolean containsUnknownElement() {
- return this.lengthUnknownElement() > 0;
- }
-
- /** @inheritDoc */
- public String getBaseLocalName() {
- return Constants._TAG_X509DATA;
- }
+ /**
+ * Constructor X509Data
+ *
+ * @param doc
+ */
+ public X509Data(Document doc) {
+ super(doc);
+
+ XMLUtils.addReturnToElement(this.constructionElement);
+ }
+
+ /**
+ * Constructor X509Data
+ *
+ * @param element
+ * @param BaseURI
+ * @throws XMLSecurityException
+ */
+ public X509Data(Element element, String BaseURI) throws XMLSecurityException {
+ super(element, BaseURI);
+
+ Node sibling = this.constructionElement.getFirstChild();
+ while (sibling != null) {
+ if (sibling.getNodeType() != Node.ELEMENT_NODE) {
+ sibling = sibling.getNextSibling();
+ continue;
+ }
+ return;
+ }
+ /* No Elements found */
+ Object exArgs[] = { "Elements", Constants._TAG_X509DATA };
+ throw new XMLSecurityException("xml.WrongContent", exArgs);
+ }
+
+ /**
+ * Method addIssuerSerial
+ *
+ * @param X509IssuerName
+ * @param X509SerialNumber
+ */
+ public void addIssuerSerial(String X509IssuerName, BigInteger X509SerialNumber) {
+ this.add(new XMLX509IssuerSerial(this.doc, X509IssuerName, X509SerialNumber));
+ }
+
+ /**
+ * Method addIssuerSerial
+ *
+ * @param X509IssuerName
+ * @param X509SerialNumber
+ */
+ public void addIssuerSerial(String X509IssuerName, String X509SerialNumber) {
+ this.add(new XMLX509IssuerSerial(this.doc, X509IssuerName, X509SerialNumber));
+ }
+
+ /**
+ * Method addIssuerSerial
+ *
+ * @param X509IssuerName
+ * @param X509SerialNumber
+ */
+ public void addIssuerSerial(String X509IssuerName, int X509SerialNumber) {
+ this.add(new XMLX509IssuerSerial(this.doc, X509IssuerName, X509SerialNumber));
+ }
+
+ /**
+ * Method add
+ *
+ * @param xmlX509IssuerSerial
+ */
+ public void add(XMLX509IssuerSerial xmlX509IssuerSerial) {
+
+ this.constructionElement.appendChild(xmlX509IssuerSerial.getElement());
+ XMLUtils.addReturnToElement(this.constructionElement);
+ }
+
+ /**
+ * Method addSKI
+ *
+ * @param skiBytes
+ */
+ public void addSKI(byte[] skiBytes) {
+ this.add(new XMLX509SKI(this.doc, skiBytes));
+ }
+
+ /**
+ * Method addSKI
+ *
+ * @param x509certificate
+ * @throws XMLSecurityException
+ */
+ public void addSKI(X509Certificate x509certificate)
+ throws XMLSecurityException {
+ this.add(new XMLX509SKI(this.doc, x509certificate));
+ }
+
+ /**
+ * Method add
+ *
+ * @param xmlX509SKI
+ */
+ public void add(XMLX509SKI xmlX509SKI) {
+ this.constructionElement.appendChild(xmlX509SKI.getElement());
+ XMLUtils.addReturnToElement(this.constructionElement);
+ }
+
+ /**
+ * Method addSubjectName
+ *
+ * @param subjectName
+ */
+ public void addSubjectName(String subjectName) {
+ this.add(new XMLX509SubjectName(this.doc, subjectName));
+ }
+
+ /**
+ * Method addSubjectName
+ *
+ * @param x509certificate
+ */
+ public void addSubjectName(X509Certificate x509certificate) {
+ this.add(new XMLX509SubjectName(this.doc, x509certificate));
+ }
+
+ /**
+ * Method add
+ *
+ * @param xmlX509SubjectName
+ */
+ public void add(XMLX509SubjectName xmlX509SubjectName) {
+ this.constructionElement.appendChild(xmlX509SubjectName.getElement());
+ XMLUtils.addReturnToElement(this.constructionElement);
+ }
+
+ /**
+ * Method addCertificate
+ *
+ * @param x509certificate
+ * @throws XMLSecurityException
+ */
+ public void addCertificate(X509Certificate x509certificate)
+ throws XMLSecurityException {
+ this.add(new XMLX509Certificate(this.doc, x509certificate));
+ }
+
+ /**
+ * Method addCertificate
+ *
+ * @param x509certificateBytes
+ */
+ public void addCertificate(byte[] x509certificateBytes) {
+ this.add(new XMLX509Certificate(this.doc, x509certificateBytes));
+ }
+
+ /**
+ * Method add
+ *
+ * @param xmlX509Certificate
+ */
+ public void add(XMLX509Certificate xmlX509Certificate) {
+ this.constructionElement.appendChild(xmlX509Certificate.getElement());
+ XMLUtils.addReturnToElement(this.constructionElement);
+ }
+
+ /**
+ * Method addCRL
+ *
+ * @param crlBytes
+ */
+ public void addCRL(byte[] crlBytes) {
+ this.add(new XMLX509CRL(this.doc, crlBytes));
+ }
+
+ /**
+ * Method add
+ *
+ * @param xmlX509CRL
+ */
+ public void add(XMLX509CRL xmlX509CRL) {
+ this.constructionElement.appendChild(xmlX509CRL.getElement());
+ XMLUtils.addReturnToElement(this.constructionElement);
+ }
+
+ /**
+ * Method addUnknownElement
+ *
+ * @param element
+ */
+ public void addUnknownElement(Element element) {
+ this.constructionElement.appendChild(element);
+ XMLUtils.addReturnToElement(this.constructionElement);
+ }
+
+ /**
+ * Method lengthIssuerSerial
+ *
+ * @return the number of IssuerSerial elements in this X509Data
+ */
+ public int lengthIssuerSerial() {
+ return this.length(Constants.SignatureSpecNS, Constants._TAG_X509ISSUERSERIAL);
+ }
+
+ /**
+ * Method lengthSKI
+ *
+ * @return the number of SKI elements in this X509Data
+ */
+ public int lengthSKI() {
+ return this.length(Constants.SignatureSpecNS, Constants._TAG_X509SKI);
+ }
+
+ /**
+ * Method lengthSubjectName
+ *
+ * @return the number of SubjectName elements in this X509Data
+ */
+ public int lengthSubjectName() {
+ return this.length(Constants.SignatureSpecNS, Constants._TAG_X509SUBJECTNAME);
+ }
+
+ /**
+ * Method lengthCertificate
+ *
+ * @return the number of Certificate elements in this X509Data
+ */
+ public int lengthCertificate() {
+ return this.length(Constants.SignatureSpecNS, Constants._TAG_X509CERTIFICATE);
+ }
+
+ /**
+ * Method lengthCRL
+ *
+ * @return the number of CRL elements in this X509Data
+ */
+ public int lengthCRL() {
+ return this.length(Constants.SignatureSpecNS, Constants._TAG_X509CRL);
+ }
+
+ /**
+ * Method lengthUnknownElement
+ *
+ * @return the number of UnknownElement elements in this X509Data
+ */
+ public int lengthUnknownElement() {
+ int result = 0;
+ Node n = this.constructionElement.getFirstChild();
+ while (n != null){
+ if ((n.getNodeType() == Node.ELEMENT_NODE)
+ && !n.getNamespaceURI().equals(Constants.SignatureSpecNS)) {
+ result++;
+ }
+ n = n.getNextSibling();
+ }
+
+ return result;
+ }
+
+ /**
+ * Method itemIssuerSerial
+ *
+ * @param i
+ * @return the X509IssuerSerial, null if not present
+ * @throws XMLSecurityException
+ */
+ public XMLX509IssuerSerial itemIssuerSerial(int i) throws XMLSecurityException {
+ Element e =
+ XMLUtils.selectDsNode(
+ this.constructionElement.getFirstChild(), Constants._TAG_X509ISSUERSERIAL, i);
+
+ if (e != null) {
+ return new XMLX509IssuerSerial(e, this.baseURI);
+ }
+ return null;
+ }
+
+ /**
+ * Method itemSKI
+ *
+ * @param i
+ * @return the X509SKI, null if not present
+ * @throws XMLSecurityException
+ */
+ public XMLX509SKI itemSKI(int i) throws XMLSecurityException {
+
+ Element e =
+ XMLUtils.selectDsNode(
+ this.constructionElement.getFirstChild(), Constants._TAG_X509SKI, i);
+
+ if (e != null) {
+ return new XMLX509SKI(e, this.baseURI);
+ }
+ return null;
+ }
+
+ /**
+ * Method itemSubjectName
+ *
+ * @param i
+ * @return the X509SubjectName, null if not present
+ * @throws XMLSecurityException
+ */
+ public XMLX509SubjectName itemSubjectName(int i) throws XMLSecurityException {
+
+ Element e =
+ XMLUtils.selectDsNode(
+ this.constructionElement.getFirstChild(), Constants._TAG_X509SUBJECTNAME, i);
+
+ if (e != null) {
+ return new XMLX509SubjectName(e, this.baseURI);
+ }
+ return null;
+ }
+
+ /**
+ * Method itemCertificate
+ *
+ * @param i
+ * @return the X509Certifacte, null if not present
+ * @throws XMLSecurityException
+ */
+ public XMLX509Certificate itemCertificate(int i) throws XMLSecurityException {
+
+ Element e =
+ XMLUtils.selectDsNode(
+ this.constructionElement.getFirstChild(), Constants._TAG_X509CERTIFICATE, i);
+
+ if (e != null) {
+ return new XMLX509Certificate(e, this.baseURI);
+ }
+ return null;
+ }
+
+ /**
+ * Method itemCRL
+ *
+ * @param i
+ * @return the X509CRL, null if not present
+ * @throws XMLSecurityException
+ */
+ public XMLX509CRL itemCRL(int i) throws XMLSecurityException {
+
+ Element e =
+ XMLUtils.selectDsNode(
+ this.constructionElement.getFirstChild(), Constants._TAG_X509CRL, i);
+
+ if (e != null) {
+ return new XMLX509CRL(e, this.baseURI);
+ }
+ return null;
+ }
+
+ /**
+ * Method itemUnknownElement
+ *
+ * @param i
+ * @return the Unknown Element at i
+ * TODO implement
+ **/
+ public Element itemUnknownElement(int i) {
+ if (log.isDebugEnabled()) {
+ log.debug("itemUnknownElement not implemented:" + i);
+ }
+ return null;
+ }
+
+ /**
+ * Method containsIssuerSerial
+ *
+ * @return true if this X509Data contains a IssuerSerial
+ */
+ public boolean containsIssuerSerial() {
+ return this.lengthIssuerSerial() > 0;
+ }
+
+ /**
+ * Method containsSKI
+ *
+ * @return true if this X509Data contains a SKI
+ */
+ public boolean containsSKI() {
+ return this.lengthSKI() > 0;
+ }
+
+ /**
+ * Method containsSubjectName
+ *
+ * @return true if this X509Data contains a SubjectName
+ */
+ public boolean containsSubjectName() {
+ return this.lengthSubjectName() > 0;
+ }
+
+ /**
+ * Method containsCertificate
+ *
+ * @return true if this X509Data contains a Certificate
+ */
+ public boolean containsCertificate() {
+ return this.lengthCertificate() > 0;
+ }
+
+ /**
+ * Method containsCRL
+ *
+ * @return true if this X509Data contains a CRL
+ */
+ public boolean containsCRL() {
+ return this.lengthCRL() > 0;
+ }
+
+ /**
+ * Method containsUnknownElement
+ *
+ * @return true if this X509Data contains an UnknownElement
+ */
+ public boolean containsUnknownElement() {
+ return this.lengthUnknownElement() > 0;
+ }
+
+ /** @inheritDoc */
+ public String getBaseLocalName() {
+ return Constants._TAG_X509DATA;
+ }
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/keyvalues/DSAKeyValue.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/keyvalues/DSAKeyValue.java?rev=1069340&r1=1069339&r2=1069340&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/keyvalues/DSAKeyValue.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/keyvalues/DSAKeyValue.java Thu Feb 10 11:37:05 2011
@@ -33,104 +33,94 @@ import org.apache.xml.security.utils.XML
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-/**
- *
- * @author $Author$
- */
-public class DSAKeyValue extends SignatureElementProxy
- implements KeyValueContent {
-
- /**
- * Constructor DSAKeyValue
- *
- * @param element
- * @param BaseURI
- * @throws XMLSecurityException
- */
- public DSAKeyValue(Element element, String BaseURI)
- throws XMLSecurityException {
- super(element, BaseURI);
- }
-
- /**
- * Constructor DSAKeyValue
- *
- * @param doc
- * @param P
- * @param Q
- * @param G
- * @param Y
- */
- public DSAKeyValue(Document doc, BigInteger P, BigInteger Q, BigInteger G,
- BigInteger Y) {
-
- super(doc);
-
- XMLUtils.addReturnToElement(this.constructionElement);
- this.addBigIntegerElement(P, Constants._TAG_P);
- this.addBigIntegerElement(Q, Constants._TAG_Q);
- this.addBigIntegerElement(G, Constants._TAG_G);
- this.addBigIntegerElement(Y, Constants._TAG_Y);
- }
-
- /**
- * Constructor DSAKeyValue
- *
- * @param doc
- * @param key
- * @throws IllegalArgumentException
- */
- public DSAKeyValue(Document doc, Key key) throws IllegalArgumentException {
-
- super(doc);
-
- XMLUtils.addReturnToElement(this.constructionElement);
-
- if (key instanceof java.security.interfaces.DSAPublicKey) {
- this.addBigIntegerElement(((DSAPublicKey) key).getParams().getP(),
- Constants._TAG_P);
- this.addBigIntegerElement(((DSAPublicKey) key).getParams().getQ(),
- Constants._TAG_Q);
- this.addBigIntegerElement(((DSAPublicKey) key).getParams().getG(),
- Constants._TAG_G);
- this.addBigIntegerElement(((DSAPublicKey) key).getY(),
- Constants._TAG_Y);
- } else {
- Object exArgs[] = { Constants._TAG_DSAKEYVALUE,
- key.getClass().getName() };
-
- throw new IllegalArgumentException(I18n
- .translate("KeyValue.IllegalArgument", exArgs));
- }
- }
-
- /** @inheritDoc */
- public PublicKey getPublicKey() throws XMLSecurityException {
-
- try {
- DSAPublicKeySpec pkspec =
- new DSAPublicKeySpec(this
- .getBigIntegerFromChildElement(Constants._TAG_Y, Constants
- .SignatureSpecNS), this
- .getBigIntegerFromChildElement(Constants._TAG_P, Constants
- .SignatureSpecNS), this
- .getBigIntegerFromChildElement(Constants._TAG_Q, Constants
- .SignatureSpecNS), this
- .getBigIntegerFromChildElement(Constants
- ._TAG_G, Constants.SignatureSpecNS));
- KeyFactory dsaFactory = KeyFactory.getInstance("DSA");
- PublicKey pk = dsaFactory.generatePublic(pkspec);
-
- return pk;
- } catch (NoSuchAlgorithmException ex) {
- throw new XMLSecurityException("empty", ex);
- } catch (InvalidKeySpecException ex) {
- throw new XMLSecurityException("empty", ex);
- }
- }
-
- /** @inheritDoc */
- public String getBaseLocalName() {
- return Constants._TAG_DSAKEYVALUE;
- }
+public class DSAKeyValue extends SignatureElementProxy implements KeyValueContent {
+
+ /**
+ * Constructor DSAKeyValue
+ *
+ * @param element
+ * @param BaseURI
+ * @throws XMLSecurityException
+ */
+ public DSAKeyValue(Element element, String BaseURI) throws XMLSecurityException {
+ super(element, BaseURI);
+ }
+
+ /**
+ * Constructor DSAKeyValue
+ *
+ * @param doc
+ * @param P
+ * @param Q
+ * @param G
+ * @param Y
+ */
+ public DSAKeyValue(Document doc, BigInteger P, BigInteger Q, BigInteger G, BigInteger Y) {
+ super(doc);
+
+ XMLUtils.addReturnToElement(this.constructionElement);
+ this.addBigIntegerElement(P, Constants._TAG_P);
+ this.addBigIntegerElement(Q, Constants._TAG_Q);
+ this.addBigIntegerElement(G, Constants._TAG_G);
+ this.addBigIntegerElement(Y, Constants._TAG_Y);
+ }
+
+ /**
+ * Constructor DSAKeyValue
+ *
+ * @param doc
+ * @param key
+ * @throws IllegalArgumentException
+ */
+ public DSAKeyValue(Document doc, Key key) throws IllegalArgumentException {
+ super(doc);
+
+ XMLUtils.addReturnToElement(this.constructionElement);
+
+ if (key instanceof java.security.interfaces.DSAPublicKey) {
+ this.addBigIntegerElement(((DSAPublicKey) key).getParams().getP(), Constants._TAG_P);
+ this.addBigIntegerElement(((DSAPublicKey) key).getParams().getQ(), Constants._TAG_Q);
+ this.addBigIntegerElement(((DSAPublicKey) key).getParams().getG(), Constants._TAG_G);
+ this.addBigIntegerElement(((DSAPublicKey) key).getY(), Constants._TAG_Y);
+ } else {
+ Object exArgs[] = { Constants._TAG_DSAKEYVALUE, key.getClass().getName() };
+
+ throw new IllegalArgumentException(I18n.translate("KeyValue.IllegalArgument", exArgs));
+ }
+ }
+
+ /** @inheritDoc */
+ public PublicKey getPublicKey() throws XMLSecurityException {
+
+ try {
+ DSAPublicKeySpec pkspec =
+ new DSAPublicKeySpec(
+ this.getBigIntegerFromChildElement(
+ Constants._TAG_Y, Constants.SignatureSpecNS
+ ),
+ this.getBigIntegerFromChildElement(
+ Constants._TAG_P, Constants.SignatureSpecNS
+ ),
+ this.getBigIntegerFromChildElement(
+ Constants._TAG_Q, Constants.SignatureSpecNS
+ ),
+ this.getBigIntegerFromChildElement(
+ Constants._TAG_G, Constants.SignatureSpecNS
+ )
+ );
+ KeyFactory dsaFactory = KeyFactory.getInstance("DSA");
+ PublicKey pk = dsaFactory.generatePublic(pkspec);
+
+ return pk;
+ } catch (NoSuchAlgorithmException ex) {
+ throw new XMLSecurityException("empty", ex);
+ } catch (InvalidKeySpecException ex) {
+ throw new XMLSecurityException("empty", ex);
+ }
+ }
+
+ /** @inheritDoc */
+ public String getBaseLocalName() {
+ return Constants._TAG_DSAKEYVALUE;
+ }
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/keyvalues/KeyValueContent.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/keyvalues/KeyValueContent.java?rev=1069340&r1=1069339&r2=1069340&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/keyvalues/KeyValueContent.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/keyvalues/KeyValueContent.java Thu Feb 10 11:37:05 2011
@@ -17,28 +17,18 @@
*/
package org.apache.xml.security.keys.content.keyvalues;
-
-
import java.security.PublicKey;
import org.apache.xml.security.exceptions.XMLSecurityException;
-/**
- *
- *
- *
- *
- * @author $Author$
- *
- */
public interface KeyValueContent {
- /**
- * Method getPublicKey
- *
- * @return the public key
- * @throws XMLSecurityException
- */
- public PublicKey getPublicKey()
- throws XMLSecurityException;
+ /**
+ * Method getPublicKey
+ *
+ * @return the public key
+ * @throws XMLSecurityException
+ */
+ public PublicKey getPublicKey() throws XMLSecurityException;
+
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/keyvalues/RSAKeyValue.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/keyvalues/RSAKeyValue.java?rev=1069340&r1=1069339&r2=1069340&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/keyvalues/RSAKeyValue.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/keyvalues/RSAKeyValue.java Thu Feb 10 11:37:05 2011
@@ -33,93 +33,86 @@ import org.apache.xml.security.utils.XML
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-/**
- *
- * @author $Author$
- */
-public class RSAKeyValue extends SignatureElementProxy
- implements KeyValueContent {
-
- /**
- * Constructor RSAKeyValue
- *
- * @param element
- * @param BaseURI
- * @throws XMLSecurityException
- */
- public RSAKeyValue(Element element, String BaseURI)
- throws XMLSecurityException {
- super(element, BaseURI);
- }
-
- /**
- * Constructor RSAKeyValue
- *
- * @param doc
- * @param modulus
- * @param exponent
- */
- public RSAKeyValue(Document doc, BigInteger modulus, BigInteger exponent) {
-
- super(doc);
-
- XMLUtils.addReturnToElement(this.constructionElement);
- this.addBigIntegerElement(modulus, Constants._TAG_MODULUS);
- this.addBigIntegerElement(exponent, Constants._TAG_EXPONENT);
- }
-
- /**
- * Constructor RSAKeyValue
- *
- * @param doc
- * @param key
- * @throws IllegalArgumentException
- */
- public RSAKeyValue(Document doc, Key key) throws IllegalArgumentException {
-
- super(doc);
-
- XMLUtils.addReturnToElement(this.constructionElement);
-
- if (key instanceof java.security.interfaces.RSAPublicKey ) {
- this.addBigIntegerElement(((RSAPublicKey) key).getModulus(),
- Constants._TAG_MODULUS);
- this.addBigIntegerElement(((RSAPublicKey) key).getPublicExponent(),
- Constants._TAG_EXPONENT);
- } else {
- Object exArgs[] = { Constants._TAG_RSAKEYVALUE,
- key.getClass().getName() };
-
- throw new IllegalArgumentException(I18n
- .translate("KeyValue.IllegalArgument", exArgs));
- }
- }
-
- /** @inheritDoc */
- public PublicKey getPublicKey() throws XMLSecurityException {
-
- try {
- KeyFactory rsaFactory = KeyFactory.getInstance("RSA");
-
- // KeyFactory rsaFactory = KeyFactory.getInstance(JCE_RSA);
- RSAPublicKeySpec rsaKeyspec =
- new RSAPublicKeySpec(this
- .getBigIntegerFromChildElement(Constants._TAG_MODULUS, Constants
- .SignatureSpecNS), this
- .getBigIntegerFromChildElement(Constants
- ._TAG_EXPONENT, Constants.SignatureSpecNS));
- PublicKey pk = rsaFactory.generatePublic(rsaKeyspec);
-
- return pk;
- } catch (NoSuchAlgorithmException ex) {
- throw new XMLSecurityException("empty", ex);
- } catch (InvalidKeySpecException ex) {
- throw new XMLSecurityException("empty", ex);
- }
- }
-
- /** @inheritDoc */
- public String getBaseLocalName() {
- return Constants._TAG_RSAKEYVALUE;
- }
+public class RSAKeyValue extends SignatureElementProxy implements KeyValueContent {
+
+ /**
+ * Constructor RSAKeyValue
+ *
+ * @param element
+ * @param BaseURI
+ * @throws XMLSecurityException
+ */
+ public RSAKeyValue(Element element, String BaseURI) throws XMLSecurityException {
+ super(element, BaseURI);
+ }
+
+ /**
+ * Constructor RSAKeyValue
+ *
+ * @param doc
+ * @param modulus
+ * @param exponent
+ */
+ public RSAKeyValue(Document doc, BigInteger modulus, BigInteger exponent) {
+ super(doc);
+
+ XMLUtils.addReturnToElement(this.constructionElement);
+ this.addBigIntegerElement(modulus, Constants._TAG_MODULUS);
+ this.addBigIntegerElement(exponent, Constants._TAG_EXPONENT);
+ }
+
+ /**
+ * Constructor RSAKeyValue
+ *
+ * @param doc
+ * @param key
+ * @throws IllegalArgumentException
+ */
+ public RSAKeyValue(Document doc, Key key) throws IllegalArgumentException {
+ super(doc);
+
+ XMLUtils.addReturnToElement(this.constructionElement);
+
+ if (key instanceof java.security.interfaces.RSAPublicKey ) {
+ this.addBigIntegerElement(
+ ((RSAPublicKey) key).getModulus(), Constants._TAG_MODULUS
+ );
+ this.addBigIntegerElement(
+ ((RSAPublicKey) key).getPublicExponent(), Constants._TAG_EXPONENT
+ );
+ } else {
+ Object exArgs[] = { Constants._TAG_RSAKEYVALUE, key.getClass().getName() };
+
+ throw new IllegalArgumentException(I18n.translate("KeyValue.IllegalArgument", exArgs));
+ }
+ }
+
+ /** @inheritDoc */
+ public PublicKey getPublicKey() throws XMLSecurityException {
+ try {
+ KeyFactory rsaFactory = KeyFactory.getInstance("RSA");
+
+ RSAPublicKeySpec rsaKeyspec =
+ new RSAPublicKeySpec(
+ this.getBigIntegerFromChildElement(
+ Constants._TAG_MODULUS, Constants.SignatureSpecNS
+ ),
+ this.getBigIntegerFromChildElement(
+ Constants._TAG_EXPONENT, Constants.SignatureSpecNS
+ )
+ );
+ PublicKey pk = rsaFactory.generatePublic(rsaKeyspec);
+
+ return pk;
+ } catch (NoSuchAlgorithmException ex) {
+ throw new XMLSecurityException("empty", ex);
+ } catch (InvalidKeySpecException ex) {
+ throw new XMLSecurityException("empty", ex);
+ }
+ }
+
+ /** @inheritDoc */
+ public String getBaseLocalName() {
+ return Constants._TAG_RSAKEYVALUE;
+ }
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509CRL.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509CRL.java?rev=1069340&r1=1069339&r2=1069340&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509CRL.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509CRL.java Thu Feb 10 11:37:05 2011
@@ -22,51 +22,43 @@ import org.apache.xml.security.utils.Sig
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-/**
- *
- * @author $Author$
- *
- */
-public class XMLX509CRL extends SignatureElementProxy
- implements XMLX509DataContent {
-
- /**
- * Constructor XMLX509CRL
- *
- * @param element
- * @param BaseURI
- * @throws XMLSecurityException
- */
- public XMLX509CRL(Element element, String BaseURI)
- throws XMLSecurityException {
- super(element, BaseURI);
- }
-
- /**
- * Constructor X509CRL
- *
- * @param doc
- * @param crlBytes
- */
- public XMLX509CRL(Document doc, byte[] crlBytes) {
-
- super(doc);
-
- this.addBase64Text(crlBytes);
- }
-
- /**
- * Method getCRLBytes
- *
- * @return the CRL bytes
- * @throws XMLSecurityException
- */
- public byte[] getCRLBytes() throws XMLSecurityException {
- return this.getBytesFromTextChild();
- }
-
- /** @inheritDoc */
- public String getBaseLocalName() {
- return Constants._TAG_X509CRL;
- }
+public class XMLX509CRL extends SignatureElementProxy implements XMLX509DataContent {
+
+ /**
+ * Constructor XMLX509CRL
+ *
+ * @param element
+ * @param BaseURI
+ * @throws XMLSecurityException
+ */
+ public XMLX509CRL(Element element, String BaseURI) throws XMLSecurityException {
+ super(element, BaseURI);
+ }
+
+ /**
+ * Constructor X509CRL
+ *
+ * @param doc
+ * @param crlBytes
+ */
+ public XMLX509CRL(Document doc, byte[] crlBytes) {
+ super(doc);
+
+ this.addBase64Text(crlBytes);
+ }
+
+ /**
+ * Method getCRLBytes
+ *
+ * @return the CRL bytes
+ * @throws XMLSecurityException
+ */
+ public byte[] getCRLBytes() throws XMLSecurityException {
+ return this.getBytesFromTextChild();
+ }
+
+ /** @inheritDoc */
+ public String getBaseLocalName() {
+ return Constants._TAG_X509CRL;
+ }
}