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/11 11:38:29 UTC
svn commit: r1069735 - in
/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys:
content/keyvalues/ content/x509/ keyresolver/
Author: coheigea
Date: Fri Feb 11 10:38:28 2011
New Revision: 1069735
URL: http://svn.apache.org/viewvc?rev=1069735&view=rev
Log:
[SANTUARIO-259] - More code cleanup.
Modified:
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/keyvalues/DSAKeyValue.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/keyvalues/KeyValueContent.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509Certificate.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509DataContent.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509IssuerSerial.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509SKI.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509SubjectName.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/InvalidKeyResolverException.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/KeyResolverException.java
santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java
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=1069735&r1=1069734&r2=1069735&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 Fri Feb 11 10:38:28 2011
@@ -91,7 +91,6 @@ public class DSAKeyValue extends Signatu
/** @inheritDoc */
public PublicKey getPublicKey() throws XMLSecurityException {
-
try {
DSAPublicKeySpec pkspec =
new DSAPublicKeySpec(
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=1069735&r1=1069734&r2=1069735&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 Fri Feb 11 10:38:28 2011
@@ -1,4 +1,3 @@
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
@@ -30,5 +29,5 @@ public interface KeyValueContent {
* @throws XMLSecurityException
*/
public PublicKey getPublicKey() throws XMLSecurityException;
-
+
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509Certificate.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509Certificate.java?rev=1069735&r1=1069734&r2=1069735&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509Certificate.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509Certificate.java Fri Feb 11 10:38:28 2011
@@ -29,123 +29,112 @@ import org.apache.xml.security.utils.Sig
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-/**
- *
- * @author $Author$
- */
-public class XMLX509Certificate extends SignatureElementProxy
- implements XMLX509DataContent {
-
- /** Field JCA_CERT_ID */
- public static final String JCA_CERT_ID = "X.509";
-
- /**
- * Constructor X509Certificate
- *
- * @param element
- * @param BaseURI
- * @throws XMLSecurityException
- */
- public XMLX509Certificate(Element element, String BaseURI)
- throws XMLSecurityException {
- super(element, BaseURI);
- }
-
- /**
- * Constructor X509Certificate
- *
- * @param doc
- * @param certificateBytes
- */
- public XMLX509Certificate(Document doc, byte[] certificateBytes) {
-
- super(doc);
-
- this.addBase64Text(certificateBytes);
- }
-
- /**
- * Constructor XMLX509Certificate
- *
- * @param doc
- * @param x509certificate
- * @throws XMLSecurityException
- */
- public XMLX509Certificate(Document doc, X509Certificate x509certificate)
- throws XMLSecurityException {
-
- super(doc);
-
- try {
- this.addBase64Text(x509certificate.getEncoded());
- } catch (java.security.cert.CertificateEncodingException ex) {
- throw new XMLSecurityException("empty", ex);
- }
- }
-
- /**
- * Method getCertificateBytes
- *
- * @return the certificate bytes
- * @throws XMLSecurityException
- */
- public byte[] getCertificateBytes() throws XMLSecurityException {
- return this.getBytesFromTextChild();
- }
-
- /**
- * Method getX509Certificate
- *
- * @return the x509 certificate
- * @throws XMLSecurityException
- */
- public X509Certificate getX509Certificate() throws XMLSecurityException {
-
- try {
- byte certbytes[] = this.getCertificateBytes();
- CertificateFactory certFact =
- CertificateFactory.getInstance(XMLX509Certificate.JCA_CERT_ID);
- X509Certificate cert =
- (X509Certificate) certFact
- .generateCertificate(new ByteArrayInputStream(certbytes));
-
- if (cert != null) {
- return cert;
- }
-
- return null;
- } catch (CertificateException ex) {
- throw new XMLSecurityException("empty", ex);
- }
- }
-
- /**
- * Method getPublicKey
- *
- * @return teh publickey
- * @throws XMLSecurityException
- */
- public PublicKey getPublicKey() throws XMLSecurityException {
-
- X509Certificate cert = this.getX509Certificate();
-
- if (cert != null) {
- return cert.getPublicKey();
- }
+public class XMLX509Certificate extends SignatureElementProxy implements XMLX509DataContent {
- return null;
- }
+ /** Field JCA_CERT_ID */
+ public static final String JCA_CERT_ID = "X.509";
+
+ /**
+ * Constructor X509Certificate
+ *
+ * @param element
+ * @param BaseURI
+ * @throws XMLSecurityException
+ */
+ public XMLX509Certificate(Element element, String BaseURI) throws XMLSecurityException {
+ super(element, BaseURI);
+ }
+
+ /**
+ * Constructor X509Certificate
+ *
+ * @param doc
+ * @param certificateBytes
+ */
+ public XMLX509Certificate(Document doc, byte[] certificateBytes) {
+ super(doc);
+
+ this.addBase64Text(certificateBytes);
+ }
+
+ /**
+ * Constructor XMLX509Certificate
+ *
+ * @param doc
+ * @param x509certificate
+ * @throws XMLSecurityException
+ */
+ public XMLX509Certificate(Document doc, X509Certificate x509certificate)
+ throws XMLSecurityException {
+ super(doc);
+
+ try {
+ this.addBase64Text(x509certificate.getEncoded());
+ } catch (java.security.cert.CertificateEncodingException ex) {
+ throw new XMLSecurityException("empty", ex);
+ }
+ }
+
+ /**
+ * Method getCertificateBytes
+ *
+ * @return the certificate bytes
+ * @throws XMLSecurityException
+ */
+ public byte[] getCertificateBytes() throws XMLSecurityException {
+ return this.getBytesFromTextChild();
+ }
+
+ /**
+ * Method getX509Certificate
+ *
+ * @return the x509 certificate
+ * @throws XMLSecurityException
+ */
+ public X509Certificate getX509Certificate() throws XMLSecurityException {
+ try {
+ byte certbytes[] = this.getCertificateBytes();
+ CertificateFactory certFact =
+ CertificateFactory.getInstance(XMLX509Certificate.JCA_CERT_ID);
+ X509Certificate cert =
+ (X509Certificate) certFact.generateCertificate(
+ new ByteArrayInputStream(certbytes)
+ );
+
+ if (cert != null) {
+ return cert;
+ }
+
+ return null;
+ } catch (CertificateException ex) {
+ throw new XMLSecurityException("empty", ex);
+ }
+ }
+
+ /**
+ * Method getPublicKey
+ *
+ * @return the publickey
+ * @throws XMLSecurityException
+ */
+ public PublicKey getPublicKey() throws XMLSecurityException {
+ X509Certificate cert = this.getX509Certificate();
+
+ if (cert != null) {
+ return cert.getPublicKey();
+ }
+
+ return null;
+ }
/** @inheritDoc */
public boolean equals(Object obj) {
-
if (!(obj instanceof XMLX509Certificate)) {
return false;
}
XMLX509Certificate other = (XMLX509Certificate) obj;
try {
- return Arrays.equals
- (other.getCertificateBytes(), this.getCertificateBytes());
+ return Arrays.equals(other.getCertificateBytes(), this.getCertificateBytes());
} catch (XMLSecurityException ex) {
return false;
}
@@ -162,8 +151,8 @@ public class XMLX509Certificate extends
return result;
}
- /** @inheritDoc */
- public String getBaseLocalName() {
- return Constants._TAG_X509CERTIFICATE;
- }
+ /** @inheritDoc */
+ public String getBaseLocalName() {
+ return Constants._TAG_X509CERTIFICATE;
+ }
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509DataContent.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509DataContent.java?rev=1069735&r1=1069734&r2=1069735&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509DataContent.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509DataContent.java Fri Feb 11 10:38:28 2011
@@ -17,10 +17,6 @@
*/
package org.apache.xml.security.keys.content.x509;
-
-
-
-
/**
* Just used for tagging contents that are allowed inside a ds:X509Data Element.
*
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509IssuerSerial.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509IssuerSerial.java?rev=1069735&r1=1069734&r2=1069735&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509IssuerSerial.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509IssuerSerial.java Fri Feb 11 10:38:28 2011
@@ -27,17 +27,11 @@ import org.apache.xml.security.utils.XML
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-/**
- *
- * @author $Author$
- */
-public class XMLX509IssuerSerial extends SignatureElementProxy
- implements XMLX509DataContent {
+public class XMLX509IssuerSerial extends SignatureElementProxy implements XMLX509DataContent {
/** {@link org.apache.commons.logging} logging facility */
- static org.apache.commons.logging.Log log =
- org.apache.commons.logging.LogFactory.getLog(
- XMLX509IssuerSerial.class.getName());
+ private static org.apache.commons.logging.Log log =
+ org.apache.commons.logging.LogFactory.getLog(XMLX509IssuerSerial.class.getName());
/**
* Constructor XMLX509IssuerSerial
@@ -46,8 +40,7 @@ public class XMLX509IssuerSerial extends
* @param baseURI
* @throws XMLSecurityException
*/
- public XMLX509IssuerSerial(Element element, String baseURI)
- throws XMLSecurityException {
+ public XMLX509IssuerSerial(Element element, String baseURI) throws XMLSecurityException {
super(element, baseURI);
}
@@ -58,9 +51,7 @@ public class XMLX509IssuerSerial extends
* @param x509IssuerName
* @param x509SerialNumber
*/
- public XMLX509IssuerSerial(Document doc, String x509IssuerName,
- BigInteger x509SerialNumber) {
-
+ public XMLX509IssuerSerial(Document doc, String x509IssuerName, BigInteger x509SerialNumber) {
super(doc);
XMLUtils.addReturnToElement(this.constructionElement);
addTextElement(x509IssuerName, Constants._TAG_X509ISSUERNAME);
@@ -74,8 +65,7 @@ public class XMLX509IssuerSerial extends
* @param x509IssuerName
* @param x509SerialNumber
*/
- public XMLX509IssuerSerial(Document doc, String x509IssuerName,
- String x509SerialNumber) {
+ public XMLX509IssuerSerial(Document doc, String x509IssuerName, String x509SerialNumber) {
this(doc, x509IssuerName, new BigInteger(x509SerialNumber));
}
@@ -86,10 +76,8 @@ public class XMLX509IssuerSerial extends
* @param x509IssuerName
* @param x509SerialNumber
*/
- public XMLX509IssuerSerial(Document doc, String x509IssuerName,
- int x509SerialNumber) {
- this(doc, x509IssuerName,
- new BigInteger(Integer.toString(x509SerialNumber)));
+ public XMLX509IssuerSerial(Document doc, String x509IssuerName, int x509SerialNumber) {
+ this(doc, x509IssuerName, new BigInteger(Integer.toString(x509SerialNumber)));
}
/**
@@ -99,10 +87,11 @@ public class XMLX509IssuerSerial extends
* @param x509certificate
*/
public XMLX509IssuerSerial(Document doc, X509Certificate x509certificate) {
-
- this(doc,
- RFC2253Parser.normalize(x509certificate.getIssuerDN().getName()),
- x509certificate.getSerialNumber());
+ this(
+ doc,
+ RFC2253Parser.normalize(x509certificate.getIssuerDN().getName()),
+ x509certificate.getSerialNumber()
+ );
}
/**
@@ -111,11 +100,11 @@ public class XMLX509IssuerSerial extends
* @return the serial number
*/
public BigInteger getSerialNumber() {
-
- String text = this.getTextFromChildElement
- (Constants._TAG_X509SERIALNUMBER, Constants.SignatureSpecNS);
- if (log.isDebugEnabled())
+ String text =
+ this.getTextFromChildElement(Constants._TAG_X509SERIALNUMBER, Constants.SignatureSpecNS);
+ if (log.isDebugEnabled()) {
log.debug("X509SerialNumber text: " + text);
+ }
return new BigInteger(text);
}
@@ -135,16 +124,13 @@ public class XMLX509IssuerSerial extends
* @return the issuer name
*/
public String getIssuerName() {
-
- return RFC2253Parser
- .normalize(this
- .getTextFromChildElement(Constants._TAG_X509ISSUERNAME,
- Constants.SignatureSpecNS));
+ return RFC2253Parser.normalize(
+ this.getTextFromChildElement(Constants._TAG_X509ISSUERNAME, Constants.SignatureSpecNS)
+ );
}
/** @inheritDoc */
public boolean equals(Object obj) {
-
if (!(obj instanceof XMLX509IssuerSerial)) {
return false;
}
@@ -152,7 +138,7 @@ public class XMLX509IssuerSerial extends
XMLX509IssuerSerial other = (XMLX509IssuerSerial) obj;
return this.getSerialNumber().equals(other.getSerialNumber())
- && this.getIssuerName().equals(other.getIssuerName());
+ && this.getIssuerName().equals(other.getIssuerName());
}
public int hashCode() {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509SKI.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509SKI.java?rev=1069735&r1=1069734&r2=1069735&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509SKI.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509SKI.java Fri Feb 11 10:38:28 2011
@@ -29,14 +29,13 @@ import org.w3c.dom.Element;
/**
* Handles SubjectKeyIdentifier (SKI) for X.509v3.
*
- * @author $Author$
- * @see <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/security/cert/X509Extension.html">Interface X509Extension</A>
+ * @see <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/security/cert/X509Extension.html">
+ * Interface X509Extension</A>
*/
-public class XMLX509SKI extends SignatureElementProxy
- implements XMLX509DataContent {
+public class XMLX509SKI extends SignatureElementProxy implements XMLX509DataContent {
/** {@link org.apache.commons.logging} logging facility */
- static org.apache.commons.logging.Log log =
+ private static org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory.getLog(XMLX509SKI.class.getName());
/**
@@ -45,7 +44,7 @@ public class XMLX509SKI extends Signatur
* distinct keys used by the same subject to be differentiated
* (e.g., as key updating occurs).
* <BR />
- * A key identifer shall be unique with respect to all key identifiers
+ * A key identifier shall be unique with respect to all key identifiers
* for the subject with which it is used. This extension is always non-critical.
*/
public static final String SKI_OID = "2.5.29.14";
@@ -69,7 +68,7 @@ public class XMLX509SKI extends Signatur
* @throws XMLSecurityException
*/
public XMLX509SKI(Document doc, X509Certificate x509certificate)
- throws XMLSecurityException {
+ throws XMLSecurityException {
super(doc);
this.addBase64Text(XMLX509SKI.getSKIBytesFromCert(x509certificate));
}
@@ -81,8 +80,7 @@ public class XMLX509SKI extends Signatur
* @param BaseURI
* @throws XMLSecurityException
*/
- public XMLX509SKI(Element element, String BaseURI)
- throws XMLSecurityException {
+ public XMLX509SKI(Element element, String BaseURI) throws XMLSecurityException {
super(element, BaseURI);
}
@@ -110,8 +108,7 @@ public class XMLX509SKI extends Signatur
if (cert.getVersion() < 3) {
Object exArgs[] = { new Integer(cert.getVersion()) };
- throw new XMLSecurityException("certificate.noSki.lowVersion",
- exArgs);
+ throw new XMLSecurityException("certificate.noSki.lowVersion", exArgs);
}
/*
@@ -124,12 +121,12 @@ public class XMLX509SKI extends Signatur
if (extensionValue == null) {
throw new XMLSecurityException("certificate.noSki.null");
}
-
+
/**
* Strip away first four bytes from the extensionValue
* The first two bytes are the tag and length of the extensionValue
* OCTET STRING, and the next two bytes are the tag and length of
- * the skid OCTET STRING.
+ * the ski OCTET STRING.
*/
byte skidValue[] = new byte[extensionValue.length - 4];
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509SubjectName.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509SubjectName.java?rev=1069735&r1=1069734&r2=1069735&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509SubjectName.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/content/x509/XMLX509SubjectName.java Fri Feb 11 10:38:28 2011
@@ -26,57 +26,53 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
- *
* @author $Author$
*/
-public class XMLX509SubjectName extends SignatureElementProxy
- implements XMLX509DataContent {
+public class XMLX509SubjectName extends SignatureElementProxy implements XMLX509DataContent {
- /**
- * Constructor X509SubjectName
- *
- * @param element
- * @param BaseURI
- * @throws XMLSecurityException
- */
- public XMLX509SubjectName(Element element, String BaseURI)
- throws XMLSecurityException {
- super(element, BaseURI);
- }
-
- /**
- * Constructor X509SubjectName
- *
- * @param doc
- * @param X509SubjectNameString
- */
- public XMLX509SubjectName(Document doc, String X509SubjectNameString) {
-
- super(doc);
-
- this.addText(X509SubjectNameString);
- }
-
- /**
- * Constructor XMLX509SubjectName
- *
- * @param doc
- * @param x509certificate
- */
- public XMLX509SubjectName(Document doc, X509Certificate x509certificate) {
- this(doc,
- RFC2253Parser.normalize(x509certificate.getSubjectDN().getName()));
- }
-
- /**
- * Method getSubjectName
- *
- *
- * @return the subject name
- */
- public String getSubjectName() {
- return RFC2253Parser.normalize(this.getTextFromTextChild());
- }
+ /**
+ * Constructor X509SubjectName
+ *
+ * @param element
+ * @param BaseURI
+ * @throws XMLSecurityException
+ */
+ public XMLX509SubjectName(Element element, String BaseURI)
+ throws XMLSecurityException {
+ super(element, BaseURI);
+ }
+
+ /**
+ * Constructor X509SubjectName
+ *
+ * @param doc
+ * @param X509SubjectNameString
+ */
+ public XMLX509SubjectName(Document doc, String X509SubjectNameString) {
+ super(doc);
+
+ this.addText(X509SubjectNameString);
+ }
+
+ /**
+ * Constructor XMLX509SubjectName
+ *
+ * @param doc
+ * @param x509certificate
+ */
+ public XMLX509SubjectName(Document doc, X509Certificate x509certificate) {
+ this(doc, RFC2253Parser.normalize(x509certificate.getSubjectDN().getName()));
+ }
+
+ /**
+ * Method getSubjectName
+ *
+ *
+ * @return the subject name
+ */
+ public String getSubjectName() {
+ return RFC2253Parser.normalize(this.getTextFromTextChild());
+ }
/** @inheritDoc */
public boolean equals(Object obj) {
@@ -89,16 +85,16 @@ public class XMLX509SubjectName extends
String thisSubject = this.getSubjectName();
return thisSubject.equals(otherSubject);
- }
+ }
public int hashCode() {
int result = 17;
result = 31 * result + this.getSubjectName().hashCode();
return result;
}
-
- /** @inheritDoc */
- public String getBaseLocalName() {
- return Constants._TAG_X509SUBJECTNAME;
- }
+
+ /** @inheritDoc */
+ public String getBaseLocalName() {
+ return Constants._TAG_X509SUBJECTNAME;
+ }
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/InvalidKeyResolverException.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/InvalidKeyResolverException.java?rev=1069735&r1=1069734&r2=1069735&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/InvalidKeyResolverException.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/InvalidKeyResolverException.java Fri Feb 11 10:38:28 2011
@@ -1,4 +1,3 @@
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
@@ -17,70 +16,60 @@
*/
package org.apache.xml.security.keys.keyresolver;
-
-
import org.apache.xml.security.exceptions.XMLSecurityException;
-
-/**
- *
- *
- * @author $Author$
- */
public class InvalidKeyResolverException extends XMLSecurityException {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor InvalidKeyResolverException
- *
- */
- public InvalidKeyResolverException() {
- super();
- }
-
- /**
- * Constructor InvalidKeyResolverException
- *
- * @param _msgID
- */
- public InvalidKeyResolverException(String _msgID) {
- super(_msgID);
- }
-
- /**
- * Constructor InvalidKeyResolverException
- *
- * @param _msgID
- * @param exArgs
- */
- public InvalidKeyResolverException(String _msgID, Object exArgs[]) {
- super(_msgID, exArgs);
- }
-
- /**
- * Constructor InvalidKeyResolverException
- *
- * @param _msgID
- * @param _originalException
- */
- public InvalidKeyResolverException(String _msgID,
- Exception _originalException) {
- super(_msgID, _originalException);
- }
-
- /**
- * Constructor InvalidKeyResolverException
- *
- * @param _msgID
- * @param exArgs
- * @param _originalException
- */
- public InvalidKeyResolverException(String _msgID, Object exArgs[],
- Exception _originalException) {
- super(_msgID, exArgs, _originalException);
- }
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor InvalidKeyResolverException
+ *
+ */
+ public InvalidKeyResolverException() {
+ super();
+ }
+
+ /**
+ * Constructor InvalidKeyResolverException
+ *
+ * @param msgID
+ */
+ public InvalidKeyResolverException(String msgID) {
+ super(msgID);
+ }
+
+ /**
+ * Constructor InvalidKeyResolverException
+ *
+ * @param msgID
+ * @param exArgs
+ */
+ public InvalidKeyResolverException(String msgID, Object exArgs[]) {
+ super(msgID, exArgs);
+ }
+
+ /**
+ * Constructor InvalidKeyResolverException
+ *
+ * @param msgID
+ * @param originalException
+ */
+ public InvalidKeyResolverException(String msgID, Exception originalException) {
+ super(msgID, originalException);
+ }
+
+ /**
+ * Constructor InvalidKeyResolverException
+ *
+ * @param msgID
+ * @param exArgs
+ * @param originalException
+ */
+ public InvalidKeyResolverException(String msgID, Object exArgs[], Exception originalException) {
+ super(msgID, exArgs, originalException);
+ }
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/KeyResolverException.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/KeyResolverException.java?rev=1069735&r1=1069734&r2=1069735&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/KeyResolverException.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/KeyResolverException.java Fri Feb 11 10:38:28 2011
@@ -1,4 +1,3 @@
-
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
@@ -17,72 +16,60 @@
*/
package org.apache.xml.security.keys.keyresolver;
-
-
import org.apache.xml.security.exceptions.XMLSecurityException;
-
-/**
- *
- *
- *
- *
- * @author $Author$
- *
- */
public class KeyResolverException extends XMLSecurityException {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor KeyResolverException
- *
- */
- public KeyResolverException() {
- super();
- }
-
- /**
- * Constructor KeyResolverException
- *
- * @param _msgID
- */
- public KeyResolverException(String _msgID) {
- super(_msgID);
- }
-
- /**
- * Constructor KeyResolverException
- *
- * @param _msgID
- * @param exArgs
- */
- public KeyResolverException(String _msgID, Object exArgs[]) {
- super(_msgID, exArgs);
- }
-
- /**
- * Constructor KeyResolverException
- *
- * @param _msgID
- * @param _originalException
- */
- public KeyResolverException(String _msgID, Exception _originalException) {
- super(_msgID, _originalException);
- }
-
- /**
- * Constructor KeyResolverException
- *
- * @param _msgID
- * @param exArgs
- * @param _originalException
- */
- public KeyResolverException(String _msgID, Object exArgs[],
- Exception _originalException) {
- super(_msgID, exArgs, _originalException);
- }
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor KeyResolverException
+ *
+ */
+ public KeyResolverException() {
+ super();
+ }
+
+ /**
+ * Constructor KeyResolverException
+ *
+ * @param msgID
+ */
+ public KeyResolverException(String msgID) {
+ super(msgID);
+ }
+
+ /**
+ * Constructor KeyResolverException
+ *
+ * @param msgID
+ * @param exArgs
+ */
+ public KeyResolverException(String msgID, Object exArgs[]) {
+ super(msgID, exArgs);
+ }
+
+ /**
+ * Constructor KeyResolverException
+ *
+ * @param msgID
+ * @param originalException
+ */
+ public KeyResolverException(String msgID, Exception originalException) {
+ super(msgID, originalException);
+ }
+
+ /**
+ * Constructor KeyResolverException
+ *
+ * @param msgID
+ * @param exArgs
+ * @param originalException
+ */
+ public KeyResolverException(String msgID, Object exArgs[], Exception originalException) {
+ super(msgID, exArgs, originalException);
+ }
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java?rev=1069735&r1=1069734&r2=1069735&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/keys/keyresolver/KeyResolverSpi.java Fri Feb 11 10:38:28 2011
@@ -27,7 +27,7 @@ import org.apache.xml.security.keys.stor
import org.w3c.dom.Element;
/**
- * This class is abstract class for a child KeyInfo Elemnet.
+ * This class is an abstract class for a child KeyInfo Elemnet.
*
* If you want the your KeyResolver, at firstly you must extand this class, and register
* as following in config.xml
@@ -35,69 +35,72 @@ import org.w3c.dom.Element;
* <KeyResolver URI="http://www.w3.org/2000/09/xmldsig#KeyValue"
* JAVACLASS="MyPackage.MyKeyValueImpl"//gt;
* </PRE>
- *
- * @author $Author$
- * @version $Revision$
*/
public abstract class KeyResolverSpi {
- /**
- * This method returns whether the KeyResolverSpi is able to perform the requested action.
- *
- * @param element
- * @param BaseURI
- * @param storage
- * @return
- */
- public boolean engineCanResolve(Element element, String BaseURI,
- StorageResolver storage) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Method engineResolvePublicKey
- *
- * @param element
- * @param BaseURI
- * @param storage
- * @return resolved public key from the registered from the element.
- *
- * @throws KeyResolverException
- */
- public PublicKey engineResolvePublicKey(
- Element element, String BaseURI, StorageResolver storage)
- throws KeyResolverException {
- throw new UnsupportedOperationException();
+
+ /** Field _properties */
+ protected java.util.Map<String, String> _properties = null;
+
+ protected boolean globalResolver = false;
+
+ /**
+ * This method returns whether the KeyResolverSpi is able to perform the requested action.
+ *
+ * @param element
+ * @param BaseURI
+ * @param storage
+ * @return
+ */
+ public boolean engineCanResolve(Element element, String BaseURI, StorageResolver storage) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Method engineResolvePublicKey
+ *
+ * @param element
+ * @param BaseURI
+ * @param storage
+ * @return resolved public key from the registered from the element.
+ *
+ * @throws KeyResolverException
+ */
+ public PublicKey engineResolvePublicKey(
+ Element element, String BaseURI, StorageResolver storage
+ ) throws KeyResolverException {
+ throw new UnsupportedOperationException();
};
-
- /**
- * Method engineLookupAndResolvePublicKey
- *
- * @param element
- * @param BaseURI
- * @param storage
- * @return resolved public key from the registered from the element.
- *
- * @throws KeyResolverException
- */
+
+ /**
+ * Method engineLookupAndResolvePublicKey
+ *
+ * @param element
+ * @param BaseURI
+ * @param storage
+ * @return resolved public key from the registered from the element.
+ *
+ * @throws KeyResolverException
+ */
public PublicKey engineLookupAndResolvePublicKey(
- Element element, String BaseURI, StorageResolver storage)
- throws KeyResolverException {
+ Element element, String BaseURI, StorageResolver storage
+ ) throws KeyResolverException {
KeyResolverSpi tmp = cloneIfNeeded();
- if (!tmp.engineCanResolve(element, BaseURI, storage))
- return null;
- return tmp.engineResolvePublicKey(element, BaseURI, storage);
+ if (!tmp.engineCanResolve(element, BaseURI, storage)) {
+ return null;
+ }
+ return tmp.engineResolvePublicKey(element, BaseURI, storage);
}
private KeyResolverSpi cloneIfNeeded() throws KeyResolverException {
- KeyResolverSpi tmp=this;
+ KeyResolverSpi tmp = this;
if (globalResolver) {
- try {
- tmp = (KeyResolverSpi) getClass().newInstance();
- } catch (InstantiationException e) {
- throw new KeyResolverException("",e);
- } catch (IllegalAccessException e) {
- throw new KeyResolverException("",e);
- }
+ try {
+ tmp = (KeyResolverSpi) getClass().newInstance();
+ } catch (InstantiationException e) {
+ throw new KeyResolverException("",e);
+ } catch (IllegalAccessException e) {
+ throw new KeyResolverException("",e);
+ }
}
return tmp;
}
@@ -113,29 +116,30 @@ public abstract class KeyResolverSpi {
* @throws KeyResolverException
*/
public X509Certificate engineResolveX509Certificate(
- Element element, String BaseURI, StorageResolver storage)
- throws KeyResolverException{
- throw new UnsupportedOperationException();
+ Element element, String BaseURI, StorageResolver storage
+ ) throws KeyResolverException{
+ throw new UnsupportedOperationException();
};
-
- /**
- * Method engineLookupResolveX509Certificate
- *
- * @param element
- * @param BaseURI
- * @param storage
- * @return resolved X509Certificate key from the registered from the elements
- *
- * @throws KeyResolverException
- */
+
+ /**
+ * Method engineLookupResolveX509Certificate
+ *
+ * @param element
+ * @param BaseURI
+ * @param storage
+ * @return resolved X509Certificate key from the registered from the elements
+ *
+ * @throws KeyResolverException
+ */
public X509Certificate engineLookupResolveX509Certificate(
- Element element, String BaseURI, StorageResolver storage)
- throws KeyResolverException {
+ Element element, String BaseURI, StorageResolver storage
+ ) throws KeyResolverException {
KeyResolverSpi tmp = cloneIfNeeded();
- if (!tmp.engineCanResolve(element, BaseURI, storage))
- return null;
+ if (!tmp.engineCanResolve(element, BaseURI, storage)) {
+ return null;
+ }
return tmp.engineResolveX509Certificate(element, BaseURI, storage);
-
+
}
/**
* Method engineResolveSecretKey
@@ -148,95 +152,95 @@ public abstract class KeyResolverSpi {
* @throws KeyResolverException
*/
public SecretKey engineResolveSecretKey(
- Element element, String BaseURI, StorageResolver storage)
- throws KeyResolverException{
- throw new UnsupportedOperationException();
+ Element element, String BaseURI, StorageResolver storage
+ ) throws KeyResolverException{
+ throw new UnsupportedOperationException();
};
+
+ /**
+ * Method engineLookupAndResolveSecretKey
+ *
+ * @param element
+ * @param BaseURI
+ * @param storage
+ * @return resolved SecretKey key from the registered from the elements
+ *
+ * @throws KeyResolverException
+ */
+ public SecretKey engineLookupAndResolveSecretKey(
+ Element element, String BaseURI, StorageResolver storage
+ ) throws KeyResolverException {
+ KeyResolverSpi tmp = cloneIfNeeded();
+ if (!tmp.engineCanResolve(element, BaseURI, storage)) {
+ return null;
+ }
+ return tmp.engineResolveSecretKey(element, BaseURI, storage);
+ }
+
+ /**
+ * Method engineLookupAndResolvePrivateKey
+ *
+ * @param element
+ * @param BaseURI
+ * @param storage
+ * @return resolved PrivateKey key from the registered from the elements
+ *
+ * @throws KeyResolverException
+ */
+ public PrivateKey engineLookupAndResolvePrivateKey(
+ Element element, String BaseURI, StorageResolver storage
+ ) throws KeyResolverException {
+ // This method was added later, it has no equivalent
+ // engineResolvePrivateKey() in the old API.
+ // We cannot throw UnsupportedOperationException because
+ // KeyResolverSpi implementations who don't know about
+ // this method would stop the search too early.
+ return null;
+ }
+
+ /**
+ * Method engineSetProperty
+ *
+ * @param key
+ * @param value
+ */
+ public void engineSetProperty(String key, String value) {
+ if (_properties == null) {
+ _properties = new HashMap<String, String>();
+ }
+ this._properties.put(key, value);
+ }
+
+ /**
+ * Method engineGetProperty
+ *
+ * @param key
+ * @return obtain the property appointed by key
+ */
+ public String engineGetProperty(String key) {
+ if (_properties == null) {
+ return null;
+ }
+
+ return (String) this._properties.get(key);
+ }
+
+ /**
+ * Method understandsProperty
+ *
+ * @param propertyToTest
+ * @return true if understood the property
+ */
+ public boolean understandsProperty(String propertyToTest) {
+ if (_properties == null) {
+ return false;
+ }
+
+ return this._properties.get(propertyToTest) != null;
+ }
- /**
- * Method engineLookupAndResolveSecretKey
- *
- * @param element
- * @param BaseURI
- * @param storage
- * @return resolved SecretKey key from the registered from the elements
- *
- * @throws KeyResolverException
- */
- public SecretKey engineLookupAndResolveSecretKey(
- Element element, String BaseURI, StorageResolver storage)
- throws KeyResolverException {
- KeyResolverSpi tmp = cloneIfNeeded();
- if (!tmp.engineCanResolve(element, BaseURI, storage))
- return null;
- return tmp.engineResolveSecretKey(element, BaseURI, storage);
- }
-
- /**
- * Method engineLookupAndResolvePrivateKey
- *
- * @param element
- * @param BaseURI
- * @param storage
- * @return resolved PrivateKey key from the registered from the elements
- *
- * @throws KeyResolverException
- */
- public PrivateKey engineLookupAndResolvePrivateKey(
- Element element, String BaseURI, StorageResolver storage)
- throws KeyResolverException {
- // This method was added later, it has no equivalent
- // engineResolvePrivateKey() in the old API.
- // We cannot throw UnsupportedOperationException because
- // KeyResolverSpi implementations who don't know about
- // this method would stop the search too early.
- return null;
- }
-
- /** Field _properties */
- protected java.util.Map _properties = null;
-
- protected boolean globalResolver=false;
-
- /**
- * Method engineSetProperty
- *
- * @param key
- * @param value
- */
- public void engineSetProperty(String key, String value) {
- if (_properties==null)
- _properties=new HashMap();
- this._properties.put(key, value);
- }
-
- /**
- * Method engineGetProperty
- *
- * @param key
- * @return obtain the property appointed by key
- */
- public String engineGetProperty(String key) {
- if (_properties==null)
- return null;
-
- return (String) this._properties.get(key);
- }
-
- /**
- * Method understandsProperty
- *
- * @param propertyToTest
- * @return true if understood the property
- */
- public boolean understandsProperty(String propertyToTest) {
- if (_properties==null)
- return false;
-
- return this._properties.get(propertyToTest)!=null;
- }
- public void setGlobalResolver(boolean globalResolver) {
+ public void setGlobalResolver(boolean globalResolver) {
this.globalResolver = globalResolver;
- }
-
+ }
+
}