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 2015/12/15 18:13:22 UTC
svn commit: r1720201 [3/24] - in /santuario/xml-security-java/trunk:
samples/javax/xml/crypto/dsig/samples/
samples/org/apache/xml/security/samples/
samples/org/apache/xml/security/samples/algorithms/
samples/org/apache/xml/security/samples/canonicaliz...
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/XmlWriterToTree.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/XmlWriterToTree.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/XmlWriterToTree.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/jcp/xml/dsig/internal/dom/XmlWriterToTree.java Tue Dec 15 17:13:17 2015
@@ -37,13 +37,13 @@ import org.w3c.dom.Text;
* Manifestation of XmlWriter interface designed to write to a tree.
*/
public class XmlWriterToTree implements XmlWriter {
-
+
private Document factory;
-
+
private Element createdElement;
-
+
private Node nextSibling;
-
+
private Node currentNode;
private List<XmlWriter.ToMarshal<? extends XMLStructure>> m_marshallers;
@@ -53,7 +53,7 @@ public class XmlWriterToTree implements
factory = parent instanceof Document ? (Document)parent : parent.getOwnerDocument();
currentNode = parent;
}
-
+
/**
* Reset to a new parent so that the writer can be re-used.
* @param newParent
@@ -62,7 +62,7 @@ public class XmlWriterToTree implements
currentNode = newParent;
createdElement = null;
}
-
+
/**
* Get the root element created with this writer.
* @return the root element created with this writer.
@@ -70,12 +70,12 @@ public class XmlWriterToTree implements
public Element getCreatedElement() {
return createdElement;
}
-
+
/**
* In cases where the serialization is supposed to precede a specific
* element, we add an extra parameter to capture that. Only affects the
* first element insertion (obviously?).
- *
+ *
* @param marshallers
* @param parent
* @param nextSibling The first element created will be created *before* this element.
@@ -84,7 +84,7 @@ public class XmlWriterToTree implements
this(marshallers, parent);
this.nextSibling = nextSibling;
}
-
+
@Override
public void writeStartElement(String prefix, String localName, String namespaceURI) {
Element newElem = factory.createElementNS(namespaceURI, DOMUtils.getQNameString(prefix, localName));
@@ -96,7 +96,7 @@ public class XmlWriterToTree implements
}
nextSibling = null;
currentNode = newElem;
-
+
if (createdElement == null) {
createdElement = newElem;
}
@@ -107,7 +107,7 @@ public class XmlWriterToTree implements
currentNode = currentNode.getParentNode();
}
-
+
@Override
public void writeTextElement(String prefix, String localName, String namespaceURI, String value) {
writeStartElement(prefix, localName, namespaceURI);
@@ -130,7 +130,7 @@ public class XmlWriterToTree implements
Text textNode = factory.createTextNode(text);
currentNode.appendChild(textNode);
}
-
+
@Override
public void writeComment(String text) {
@@ -177,7 +177,7 @@ public class XmlWriterToTree implements
@Override
public void marshalStructure(XMLStructure toMarshal, String dsPrefix, XMLCryptoContext context) throws MarshalException {
-
+
// look for the first isInstance match, and marshal to that.
for (int idx = 0 ; idx < m_marshallers.size() ; idx++) {
@SuppressWarnings("unchecked")
@@ -190,5 +190,5 @@ public class XmlWriterToTree implements
throw new IllegalArgumentException("Unable to marshal unexpected object of class " + toMarshal.getClass().toString());
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/Init.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/Init.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/Init.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/Init.java Tue Dec 15 17:13:17 2015
@@ -51,7 +51,7 @@ import org.w3c.dom.Node;
* of the files of this library. We ensure that this call is only executed once.
*/
public class Init {
-
+
/** The namespace for CONF file **/
public static final String CONF_NS = "http://www.xmlsecurity.org/NS/#configuration";
@@ -60,10 +60,10 @@ public class Init {
/** Field alreadyInitialized */
private static boolean alreadyInitialized = false;
-
+
/**
* Method isInitialized
- * @return true if the library is already initialized.
+ * @return true if the library is already initialized.
*/
public static final synchronized boolean isInitialized() {
return Init.alreadyInitialized;
@@ -77,12 +77,12 @@ public class Init {
if (alreadyInitialized) {
return;
}
-
- InputStream is =
+
+ InputStream is =
AccessController.doPrivileged(
new PrivilegedAction<InputStream>() {
public InputStream run() {
- String cfile =
+ String cfile =
System.getProperty("org.apache.xml.security.resource.config");
if (cfile == null) {
return null;
@@ -98,7 +98,7 @@ public class Init {
alreadyInitialized = true;
}
-
+
/**
* Dynamically initialise the library by registering the default algorithms/implementations
*/
@@ -109,7 +109,7 @@ public class Init {
// method.
//
I18n.init("en", "US");
-
+
if (log.isDebugEnabled()) {
log.debug("Registering default algorithms");
}
@@ -120,32 +120,32 @@ public class Init {
// Bind the default prefixes
//
ElementProxy.registerDefaultPrefixes();
-
+
//
// Set the default Transforms
//
Transform.registerDefaultAlgorithms();
-
+
//
// Set the default signature algorithms
//
SignatureAlgorithm.registerDefaultAlgorithms();
-
+
//
// Set the default JCE algorithms
//
JCEMapper.registerDefaultAlgorithms();
-
+
//
// Set the default c14n algorithms
//
Canonicalizer.registerDefaultAlgorithms();
-
+
//
// Register the default resolvers
//
ResourceResolver.registerDefaultResolvers();
-
+
//
// Register the default key resolvers
//
@@ -159,7 +159,7 @@ public class Init {
log.error(xse.getMessage(), xse);
}
}
-
+
/**
* Initialise the library from a configuration file
*/
@@ -194,16 +194,16 @@ public class Init {
/* configure internationalization */
Attr langAttr = resource.getAttributeNodeNS(null, "defaultLanguageCode");
Attr countryAttr = resource.getAttributeNodeNS(null, "defaultCountryCode");
- String languageCode =
+ String languageCode =
(langAttr == null) ? null : langAttr.getNodeValue();
- String countryCode =
+ String countryCode =
(countryAttr == null) ? null : countryAttr.getNodeValue();
I18n.init(languageCode, countryCode);
}
if (tag.equals("CanonicalizationMethods")) {
Element[] list =
- XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "CanonicalizationMethod");
+ XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "CanonicalizationMethod");
for (int i = 0; i < list.length; i++) {
String uri = list[i].getAttributeNS(null, "URI");
@@ -222,7 +222,7 @@ public class Init {
}
if (tag.equals("TransformAlgorithms")) {
- Element[] tranElem =
+ Element[] tranElem =
XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "TransformAlgorithm");
for (int i = 0; i < tranElem.length; i++) {
@@ -247,7 +247,7 @@ public class Init {
if ("JCEAlgorithmMappings".equals(tag)) {
Node algorithmsNode = ((Element)el).getElementsByTagName("Algorithms").item(0);
if (algorithmsNode != null) {
- Element[] algorithms =
+ Element[] algorithms =
XMLUtils.selectNodes(algorithmsNode.getFirstChild(), CONF_NS, "Algorithm");
for (int i = 0; i < algorithms.length; i++) {
Element element = algorithms[i];
@@ -258,7 +258,7 @@ public class Init {
}
if (tag.equals("SignatureAlgorithms")) {
- Element[] sigElems =
+ Element[] sigElems =
XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "SignatureAlgorithm");
for (int i = 0; i < sigElems.length; i++) {
@@ -283,7 +283,7 @@ public class Init {
}
if (tag.equals("ResourceResolvers")) {
- Element[]resolverElem =
+ Element[]resolverElem =
XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "Resolver");
for (int i = 0; i < resolverElem.length; i++) {
@@ -307,16 +307,16 @@ public class Init {
ResourceResolver.register(javaClass);
} catch (Throwable e) {
log.warn(
- "Cannot register:" + javaClass
- + " perhaps some needed jars are not installed",
+ "Cannot register:" + javaClass
+ + " perhaps some needed jars are not installed",
e
);
}
- }
+ }
}
if (tag.equals("KeyResolver")){
- Element[] resolverElem =
+ Element[] resolverElem =
XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "Resolver");
List<String> classNames = new ArrayList<String>(resolverElem.length);
for (int i = 0; i < resolverElem.length; i++) {
@@ -347,7 +347,7 @@ public class Init {
log.debug("Now I try to bind prefixes:");
}
- Element[] nl =
+ Element[] nl =
XMLUtils.selectNodes(el.getFirstChild(), CONF_NS, "PrefixMapping");
for (int i = 0; i < nl.length; i++) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/JCEMapper.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/JCEMapper.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/JCEMapper.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/JCEMapper.java Tue Dec 15 17:13:17 2015
@@ -35,11 +35,11 @@ public class JCEMapper {
private static org.slf4j.Logger log =
org.slf4j.LoggerFactory.getLogger(JCEMapper.class);
- private static Map<String, Algorithm> algorithmsMap =
+ private static Map<String, Algorithm> algorithmsMap =
new ConcurrentHashMap<String, Algorithm>();
private static String providerName = null;
-
+
/**
* Method register
*
@@ -52,63 +52,63 @@ public class JCEMapper {
JavaUtils.checkRegisterPermission();
algorithmsMap.put(id, algorithm);
}
-
+
/**
* This method registers the default algorithms.
*/
public static void registerDefaultAlgorithms() {
// Digest algorithms
algorithmsMap.put(
- MessageDigestAlgorithm.ALGO_ID_DIGEST_NOT_RECOMMENDED_MD5,
+ MessageDigestAlgorithm.ALGO_ID_DIGEST_NOT_RECOMMENDED_MD5,
new Algorithm("", "MD5", "MessageDigest")
);
algorithmsMap.put(
- MessageDigestAlgorithm.ALGO_ID_DIGEST_RIPEMD160,
+ MessageDigestAlgorithm.ALGO_ID_DIGEST_RIPEMD160,
new Algorithm("", "RIPEMD160", "MessageDigest")
);
algorithmsMap.put(
- MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1,
+ MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1,
new Algorithm("", "SHA-1", "MessageDigest")
);
algorithmsMap.put(
- MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA224,
+ MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA224,
new Algorithm("", "SHA-224", "MessageDigest")
);
algorithmsMap.put(
- MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA256,
+ MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA256,
new Algorithm("", "SHA-256", "MessageDigest")
);
algorithmsMap.put(
- MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA384,
+ MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA384,
new Algorithm("", "SHA-384", "MessageDigest")
);
algorithmsMap.put(
- MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA512,
+ MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA512,
new Algorithm("", "SHA-512", "MessageDigest")
);
algorithmsMap.put(
- MessageDigestAlgorithm.ALGO_ID_DIGEST_WHIRLPOOL,
+ MessageDigestAlgorithm.ALGO_ID_DIGEST_WHIRLPOOL,
new Algorithm("", "WHIRLPOOL", "MessageDigest")
);
algorithmsMap.put(
- MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_224,
+ MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_224,
new Algorithm("", "SHA3-224", "MessageDigest")
);
algorithmsMap.put(
- MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_256,
+ MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_256,
new Algorithm("", "SHA3-256", "MessageDigest")
);
algorithmsMap.put(
- MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_384,
+ MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_384,
new Algorithm("", "SHA3-384", "MessageDigest")
);
algorithmsMap.put(
- MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_512,
+ MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA3_512,
new Algorithm("", "SHA3-512", "MessageDigest")
);
// Signature algorithms
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_DSA,
+ XMLSignature.ALGO_ID_SIGNATURE_DSA,
new Algorithm("DSA", "SHA1withDSA", "Signature")
);
algorithmsMap.put(
@@ -116,75 +116,75 @@ public class JCEMapper {
new Algorithm("DSA", "SHA256withDSA", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5,
+ XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5,
new Algorithm("RSA", "MD5withRSA", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_RSA_RIPEMD160,
+ XMLSignature.ALGO_ID_SIGNATURE_RSA_RIPEMD160,
new Algorithm("RSA", "RIPEMD160withRSA", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1,
+ XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1,
new Algorithm("RSA", "SHA1withRSA", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA224,
+ XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA224,
new Algorithm("RSA", "SHA224withRSA", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256,
+ XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256,
new Algorithm("RSA", "SHA256withRSA", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384,
+ XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384,
new Algorithm("RSA", "SHA384withRSA", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512,
+ XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512,
new Algorithm("RSA", "SHA512withRSA", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1_MGF1,
+ XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1_MGF1,
new Algorithm("RSA", "SHA1withRSAandMGF1", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA224_MGF1,
+ XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA224_MGF1,
new Algorithm("RSA", "SHA224withRSAandMGF1", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256_MGF1,
+ XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256_MGF1,
new Algorithm("RSA", "SHA256withRSAandMGF1", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384_MGF1,
+ XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384_MGF1,
new Algorithm("RSA", "SHA384withRSAandMGF1", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512_MGF1,
+ XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA512_MGF1,
new Algorithm("RSA", "SHA512withRSAandMGF1", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA1,
+ XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA1,
new Algorithm("EC", "SHA1withECDSA", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA224,
+ XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA224,
new Algorithm("EC", "SHA224withECDSA", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA256,
+ XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA256,
new Algorithm("EC", "SHA256withECDSA", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA384,
+ XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA384,
new Algorithm("EC", "SHA384withECDSA", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA512,
+ XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA512,
new Algorithm("EC", "SHA512withECDSA", "Signature")
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_SIGNATURE_ECDSA_RIPEMD160,
+ XMLSignature.ALGO_ID_SIGNATURE_ECDSA_RIPEMD160,
new Algorithm("EC", "RIPEMD160withECDSA", "Signature")
);
algorithmsMap.put(
@@ -192,120 +192,120 @@ public class JCEMapper {
new Algorithm("", "HmacMD5", "Mac", 128, 0)
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_MAC_HMAC_RIPEMD160,
+ XMLSignature.ALGO_ID_MAC_HMAC_RIPEMD160,
new Algorithm("", "HMACRIPEMD160", "Mac", 160, 0)
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_MAC_HMAC_SHA1,
+ XMLSignature.ALGO_ID_MAC_HMAC_SHA1,
new Algorithm("", "HmacSHA1", "Mac", 160, 0)
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_MAC_HMAC_SHA224,
+ XMLSignature.ALGO_ID_MAC_HMAC_SHA224,
new Algorithm("", "HmacSHA224", "Mac", 224, 0)
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_MAC_HMAC_SHA256,
+ XMLSignature.ALGO_ID_MAC_HMAC_SHA256,
new Algorithm("", "HmacSHA256", "Mac", 256, 0)
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_MAC_HMAC_SHA384,
+ XMLSignature.ALGO_ID_MAC_HMAC_SHA384,
new Algorithm("", "HmacSHA384", "Mac", 384, 0)
);
algorithmsMap.put(
- XMLSignature.ALGO_ID_MAC_HMAC_SHA512,
+ XMLSignature.ALGO_ID_MAC_HMAC_SHA512,
new Algorithm("", "HmacSHA512", "Mac", 512, 0)
);
// Encryption algorithms
algorithmsMap.put(
- XMLCipher.TRIPLEDES,
+ XMLCipher.TRIPLEDES,
new Algorithm("DESede", "DESede/CBC/ISO10126Padding", "BlockEncryption", 192, 64)
);
algorithmsMap.put(
- XMLCipher.AES_128,
+ XMLCipher.AES_128,
new Algorithm("AES", "AES/CBC/ISO10126Padding", "BlockEncryption", 128, 128)
);
algorithmsMap.put(
- XMLCipher.AES_192,
+ XMLCipher.AES_192,
new Algorithm("AES", "AES/CBC/ISO10126Padding", "BlockEncryption", 192, 128)
);
algorithmsMap.put(
- XMLCipher.AES_256,
+ XMLCipher.AES_256,
new Algorithm("AES", "AES/CBC/ISO10126Padding", "BlockEncryption", 256, 128)
);
algorithmsMap.put(
- XMLCipher.AES_128_GCM,
+ XMLCipher.AES_128_GCM,
new Algorithm("AES", "AES/GCM/NoPadding", "BlockEncryption", 128, 96)
);
algorithmsMap.put(
- XMLCipher.AES_192_GCM,
+ XMLCipher.AES_192_GCM,
new Algorithm("AES", "AES/GCM/NoPadding", "BlockEncryption", 192, 96)
);
algorithmsMap.put(
- XMLCipher.AES_256_GCM,
+ XMLCipher.AES_256_GCM,
new Algorithm("AES", "AES/GCM/NoPadding", "BlockEncryption", 256, 96)
);
algorithmsMap.put(
- XMLCipher.SEED_128,
+ XMLCipher.SEED_128,
new Algorithm("SEED", "SEED/CBC/ISO10126Padding", "BlockEncryption", 128, 128)
);
algorithmsMap.put(
- XMLCipher.CAMELLIA_128,
+ XMLCipher.CAMELLIA_128,
new Algorithm("Camellia", "Camellia/CBC/ISO10126Padding", "BlockEncryption", 128, 128)
);
algorithmsMap.put(
- XMLCipher.CAMELLIA_192,
+ XMLCipher.CAMELLIA_192,
new Algorithm("Camellia", "Camellia/CBC/ISO10126Padding", "BlockEncryption", 192, 128)
);
algorithmsMap.put(
- XMLCipher.CAMELLIA_256,
+ XMLCipher.CAMELLIA_256,
new Algorithm("Camellia", "Camellia/CBC/ISO10126Padding", "BlockEncryption", 256, 128)
);
algorithmsMap.put(
- XMLCipher.RSA_v1dot5,
+ XMLCipher.RSA_v1dot5,
new Algorithm("RSA", "RSA/ECB/PKCS1Padding", "KeyTransport")
);
algorithmsMap.put(
- XMLCipher.RSA_OAEP,
+ XMLCipher.RSA_OAEP,
new Algorithm("RSA", "RSA/ECB/OAEPPadding", "KeyTransport")
);
algorithmsMap.put(
- XMLCipher.RSA_OAEP_11,
+ XMLCipher.RSA_OAEP_11,
new Algorithm("RSA", "RSA/ECB/OAEPPadding", "KeyTransport")
);
algorithmsMap.put(
- XMLCipher.DIFFIE_HELLMAN,
+ XMLCipher.DIFFIE_HELLMAN,
new Algorithm("", "", "KeyAgreement")
);
algorithmsMap.put(
- XMLCipher.TRIPLEDES_KeyWrap,
+ XMLCipher.TRIPLEDES_KeyWrap,
new Algorithm("DESede", "DESedeWrap", "SymmetricKeyWrap", 192, 0)
);
algorithmsMap.put(
- XMLCipher.AES_128_KeyWrap,
+ XMLCipher.AES_128_KeyWrap,
new Algorithm("AES", "AESWrap", "SymmetricKeyWrap", 128, 0)
);
algorithmsMap.put(
- XMLCipher.AES_192_KeyWrap,
+ XMLCipher.AES_192_KeyWrap,
new Algorithm("AES", "AESWrap", "SymmetricKeyWrap", 192, 0)
);
algorithmsMap.put(
- XMLCipher.AES_256_KeyWrap,
+ XMLCipher.AES_256_KeyWrap,
new Algorithm("AES", "AESWrap", "SymmetricKeyWrap", 256, 0)
);
algorithmsMap.put(
- XMLCipher.CAMELLIA_128_KeyWrap,
+ XMLCipher.CAMELLIA_128_KeyWrap,
new Algorithm("Camellia", "CamelliaWrap", "SymmetricKeyWrap", 128, 0)
);
algorithmsMap.put(
- XMLCipher.CAMELLIA_192_KeyWrap,
+ XMLCipher.CAMELLIA_192_KeyWrap,
new Algorithm("Camellia", "CamelliaWrap", "SymmetricKeyWrap", 192, 0)
);
algorithmsMap.put(
- XMLCipher.CAMELLIA_256_KeyWrap,
+ XMLCipher.CAMELLIA_256_KeyWrap,
new Algorithm("Camellia", "CamelliaWrap", "SymmetricKeyWrap", 256, 0)
);
algorithmsMap.put(
- XMLCipher.SEED_128_KeyWrap,
+ XMLCipher.SEED_128_KeyWrap,
new Algorithm("SEED", "SEEDWrap", "SymmetricKeyWrap", 128, 0)
);
}
@@ -327,7 +327,7 @@ public class JCEMapper {
}
return null;
}
-
+
/**
* Method getAlgorithmClassFromURI
* @param algorithmURI
@@ -369,7 +369,7 @@ public class JCEMapper {
}
return 0;
}
-
+
/**
* Method getJCEKeyAlgorithmFromURI
*
@@ -388,7 +388,7 @@ public class JCEMapper {
}
return null;
}
-
+
/**
* Method getJCEProviderFromURI
*
@@ -408,7 +408,7 @@ public class JCEMapper {
/**
* Gets the default Provider for obtaining the security algorithms
- * @return the default providerId.
+ * @return the default providerId.
*/
public static String getProviderId() {
return providerName;
@@ -416,7 +416,7 @@ public class JCEMapper {
/**
* Sets the default Provider for obtaining the security algorithms
- * @param provider the default providerId.
+ * @param provider the default providerId.
* @throws SecurityException if a security manager is installed and the
* caller does not have permission to register the JCE algorithm
*/
@@ -427,16 +427,16 @@ public class JCEMapper {
/**
* Represents the Algorithm xml element
- */
+ */
public static class Algorithm {
-
+
final String requiredKey;
final String jceName;
final String algorithmClass;
final int keyLength;
final int ivLength;
final String jceProvider;
-
+
/**
* Gets data from element
* @param el
@@ -457,24 +457,24 @@ public class JCEMapper {
ivLength = 0;
}
}
-
+
public Algorithm(String requiredKey, String jceName) {
this(requiredKey, jceName, null, 0, 0);
}
-
+
public Algorithm(String requiredKey, String jceName, String algorithmClass) {
this(requiredKey, jceName, algorithmClass, 0, 0);
}
-
+
public Algorithm(String requiredKey, String jceName, int keyLength) {
this(requiredKey, jceName, null, keyLength, 0);
}
-
+
public Algorithm(String requiredKey, String jceName, String algorithmClass, int keyLength, int ivLength) {
this(requiredKey, jceName, algorithmClass, keyLength, ivLength, null);
}
-
- public Algorithm(String requiredKey, String jceName,
+
+ public Algorithm(String requiredKey, String jceName,
String algorithmClass, int keyLength, int ivLength, String jceProvider) {
this.requiredKey = requiredKey;
this.jceName = jceName;
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/MessageDigestAlgorithm.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/MessageDigestAlgorithm.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/MessageDigestAlgorithm.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/MessageDigestAlgorithm.java Tue Dec 15 17:13:17 2015
@@ -36,7 +36,7 @@ import org.w3c.dom.Document;
public class MessageDigestAlgorithm extends Algorithm {
/** Message Digest - NOT RECOMMENDED MD5*/
- public static final String ALGO_ID_DIGEST_NOT_RECOMMENDED_MD5 =
+ public static final String ALGO_ID_DIGEST_NOT_RECOMMENDED_MD5 =
Constants.MoreAlgorithmsSpecNS + "md5";
/** Digest - Required SHA1*/
public static final String ALGO_ID_DIGEST_SHA1 = Constants.SignatureSpecNS + "sha1";
@@ -44,40 +44,40 @@ public class MessageDigestAlgorithm exte
public static final String ALGO_ID_DIGEST_SHA224 =
Constants.MoreAlgorithmsSpecNS + "sha224";
/** Message Digest - RECOMMENDED SHA256*/
- public static final String ALGO_ID_DIGEST_SHA256 =
+ public static final String ALGO_ID_DIGEST_SHA256 =
EncryptionConstants.EncryptionSpecNS + "sha256";
/** Message Digest - OPTIONAL SHA384*/
- public static final String ALGO_ID_DIGEST_SHA384 =
+ public static final String ALGO_ID_DIGEST_SHA384 =
Constants.MoreAlgorithmsSpecNS + "sha384";
/** Message Digest - OPTIONAL SHA512*/
- public static final String ALGO_ID_DIGEST_SHA512 =
+ public static final String ALGO_ID_DIGEST_SHA512 =
EncryptionConstants.EncryptionSpecNS + "sha512";
/** Message Digest - OPTIONAL RIPEMD-160*/
- public static final String ALGO_ID_DIGEST_RIPEMD160 =
+ public static final String ALGO_ID_DIGEST_RIPEMD160 =
EncryptionConstants.EncryptionSpecNS + "ripemd160";
-
+
// Newer digest algorithms...all optional
- public static final String ALGO_ID_DIGEST_WHIRLPOOL =
+ public static final String ALGO_ID_DIGEST_WHIRLPOOL =
Constants.XML_DSIG_NS_MORE_07_05 + "whirlpool";
- public static final String ALGO_ID_DIGEST_SHA3_224 =
+ public static final String ALGO_ID_DIGEST_SHA3_224 =
Constants.XML_DSIG_NS_MORE_07_05 + "sha3-224";
- public static final String ALGO_ID_DIGEST_SHA3_256 =
+ public static final String ALGO_ID_DIGEST_SHA3_256 =
Constants.XML_DSIG_NS_MORE_07_05 + "sha3-256";
- public static final String ALGO_ID_DIGEST_SHA3_384 =
+ public static final String ALGO_ID_DIGEST_SHA3_384 =
Constants.XML_DSIG_NS_MORE_07_05 + "sha3-384";
- public static final String ALGO_ID_DIGEST_SHA3_512 =
+ public static final String ALGO_ID_DIGEST_SHA3_512 =
Constants.XML_DSIG_NS_MORE_07_05 + "sha3-512";
/** Field algorithm stores the actual {@link java.security.MessageDigest} */
private final MessageDigest algorithm;
-
+
/**
- * Constructor for the brave who pass their own message digest algorithms and the
+ * Constructor for the brave who pass their own message digest algorithms and the
* corresponding URI.
* @param doc
* @param algorithmURI
*/
- private MessageDigestAlgorithm(Document doc, String algorithmURI)
+ private MessageDigestAlgorithm(Document doc, String algorithmURI)
throws XMLSignatureException {
super(doc, algorithmURI);
@@ -123,7 +123,7 @@ public class MessageDigestAlgorithm exte
throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
}
-
+
return md;
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/SignatureAlgorithm.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/SignatureAlgorithm.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/SignatureAlgorithm.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/SignatureAlgorithm.java Tue Dec 15 17:13:17 2015
@@ -40,7 +40,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
- * Allows selection of digital signature's algorithm, private keys, other
+ * Allows selection of digital signature's algorithm, private keys, other
* security parameters, and algorithm's ID.
*
* @author Christian Geuer-Pollmann
@@ -51,9 +51,9 @@ public class SignatureAlgorithm extends
org.slf4j.LoggerFactory.getLogger(SignatureAlgorithm.class);
/** All available algorithm classes are registered here */
- private static Map<String, Class<? extends SignatureAlgorithmSpi>> algorithmHash =
+ private static Map<String, Class<? extends SignatureAlgorithmSpi>> algorithmHash =
new ConcurrentHashMap<String, Class<? extends SignatureAlgorithmSpi>>();
-
+
/** Field signatureAlgorithm */
private final SignatureAlgorithmSpi signatureAlgorithm;
@@ -69,7 +69,7 @@ public class SignatureAlgorithm extends
public SignatureAlgorithm(Document doc, String algorithmURI) throws XMLSecurityException {
super(doc, algorithmURI);
this.algorithmURI = algorithmURI;
-
+
signatureAlgorithm = getSignatureAlgorithmSpi(algorithmURI);
signatureAlgorithm.engineGetContextFromElement(getElement());
}
@@ -87,10 +87,10 @@ public class SignatureAlgorithm extends
) throws XMLSecurityException {
super(doc, algorithmURI);
this.algorithmURI = algorithmURI;
-
+
signatureAlgorithm = getSignatureAlgorithmSpi(algorithmURI);
signatureAlgorithm.engineGetContextFromElement(getElement());
-
+
signatureAlgorithm.engineSetHMACOutputLength(hmacOutputLength);
((IntegrityHmac)signatureAlgorithm).engineAddContextToElement(getElement());
}
@@ -105,7 +105,7 @@ public class SignatureAlgorithm extends
public SignatureAlgorithm(Element element, String baseURI) throws XMLSecurityException {
this(element, baseURI, false);
}
-
+
/**
* Constructor SignatureAlgorithm
*
@@ -117,21 +117,21 @@ public class SignatureAlgorithm extends
public SignatureAlgorithm(
Element element, String baseURI, boolean secureValidation
) throws XMLSecurityException {
- super(element, baseURI);
+ super(element, baseURI);
algorithmURI = this.getURI();
-
+
Attr attr = element.getAttributeNodeNS(null, "Id");
if (attr != null) {
element.setIdAttributeNode(attr, true);
}
-
+
if (secureValidation && (XMLSignature.ALGO_ID_MAC_HMAC_NOT_RECOMMENDED_MD5.equals(algorithmURI)
|| XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5.equals(algorithmURI))) {
Object exArgs[] = { algorithmURI };
throw new XMLSecurityException("signature.signatureAlgorithm", exArgs);
}
-
+
signatureAlgorithm = getSignatureAlgorithmSpi(algorithmURI);
signatureAlgorithm.engineGetContextFromElement(getElement());
}
@@ -139,16 +139,16 @@ public class SignatureAlgorithm extends
/**
* Get a SignatureAlgorithmSpi object corresponding to the algorithmURI argument
*/
- private static SignatureAlgorithmSpi getSignatureAlgorithmSpi(String algorithmURI)
+ private static SignatureAlgorithmSpi getSignatureAlgorithmSpi(String algorithmURI)
throws XMLSignatureException {
try {
- Class<? extends SignatureAlgorithmSpi> implementingClass =
+ Class<? extends SignatureAlgorithmSpi> implementingClass =
algorithmHash.get(algorithmURI);
if (log.isDebugEnabled()) {
log.debug("Create URI \"" + algorithmURI + "\" class \""
+ implementingClass + "\"");
}
- return implementingClass.newInstance();
+ return implementingClass.newInstance();
} catch (IllegalAccessException ex) {
Object exArgs[] = { algorithmURI, ex.getMessage() };
throw new XMLSignatureException(ex, "algorithms.NoSuchAlgorithm", exArgs);
@@ -234,12 +234,12 @@ public class SignatureAlgorithm extends
* @param signingKey
* @throws XMLSignatureException
*/
- public void initSign(Key signingKey) throws XMLSignatureException {
+ public void initSign(Key signingKey) throws XMLSignatureException {
signatureAlgorithm.engineInitSign(signingKey);
}
/**
- * Proxy method for {@link java.security.Signature#initSign(java.security.PrivateKey,
+ * Proxy method for {@link java.security.Signature#initSign(java.security.PrivateKey,
* java.security.SecureRandom)}
* which is executed on the internal {@link java.security.Signature} object.
*
@@ -287,14 +287,14 @@ public class SignatureAlgorithm extends
public void initVerify(Key verificationKey) throws XMLSignatureException {
signatureAlgorithm.engineInitVerify(verificationKey);
}
-
+
/**
* Proxy method for {@link java.security.Signature#verify(byte[])}
* which is executed on the internal {@link java.security.Signature} object.
*
* @param signature
* @return true if if the signature is valid.
- *
+ *
* @throws XMLSignatureException
*/
public boolean verify(byte[] signature) throws XMLSignatureException {
@@ -314,7 +314,7 @@ public class SignatureAlgorithm extends
* Registers implementing class of the SignatureAlgorithm with algorithmURI
*
* @param algorithmURI algorithmURI URI representation of <code>SignatureAlgorithm</code>.
- * @param implementingClass <code>implementingClass</code> the implementing class of
+ * @param implementingClass <code>implementingClass</code> the implementing class of
* {@link SignatureAlgorithmSpi}
* @throws AlgorithmAlreadyRegisteredException if specified algorithmURI is already registered
* @throws XMLSignatureException
@@ -323,7 +323,7 @@ public class SignatureAlgorithm extends
*/
@SuppressWarnings("unchecked")
public static void register(String algorithmURI, String implementingClass)
- throws AlgorithmAlreadyRegisteredException, ClassNotFoundException,
+ throws AlgorithmAlreadyRegisteredException, ClassNotFoundException,
XMLSignatureException {
JavaUtils.checkRegisterPermission();
if (log.isDebugEnabled()) {
@@ -339,7 +339,7 @@ public class SignatureAlgorithm extends
);
}
try {
- Class<? extends SignatureAlgorithmSpi> clazz =
+ Class<? extends SignatureAlgorithmSpi> clazz =
(Class<? extends SignatureAlgorithmSpi>)
ClassLoaderUtils.loadClass(implementingClass, SignatureAlgorithm.class);
algorithmHash.put(algorithmURI, clazz);
@@ -348,12 +348,12 @@ public class SignatureAlgorithm extends
throw new XMLSignatureException(ex, "algorithms.NoSuchAlgorithm", exArgs);
}
}
-
+
/**
* Registers implementing class of the SignatureAlgorithm with algorithmURI
*
* @param algorithmURI algorithmURI URI representation of <code>SignatureAlgorithm</code>.
- * @param implementingClass <code>implementingClass</code> the implementing class of
+ * @param implementingClass <code>implementingClass</code> the implementing class of
* {@link SignatureAlgorithmSpi}
* @throws AlgorithmAlreadyRegisteredException if specified algorithmURI is already registered
* @throws XMLSignatureException
@@ -361,7 +361,7 @@ public class SignatureAlgorithm extends
* caller does not have permission to register the signature algorithm
*/
public static void register(String algorithmURI, Class<? extends SignatureAlgorithmSpi> implementingClass)
- throws AlgorithmAlreadyRegisteredException, ClassNotFoundException,
+ throws AlgorithmAlreadyRegisteredException, ClassNotFoundException,
XMLSignatureException {
JavaUtils.checkRegisterPermission();
if (log.isDebugEnabled()) {
@@ -378,7 +378,7 @@ public class SignatureAlgorithm extends
}
algorithmHash.put(algorithmURI, implementingClass);
}
-
+
/**
* This method registers the default algorithms.
*/
@@ -396,11 +396,11 @@ public class SignatureAlgorithm extends
XMLSignature.ALGO_ID_MAC_HMAC_SHA1, IntegrityHmac.IntegrityHmacSHA1.class
);
algorithmHash.put(
- XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5,
+ XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5,
SignatureBaseRSA.SignatureRSAMD5.class
);
algorithmHash.put(
- XMLSignature.ALGO_ID_SIGNATURE_RSA_RIPEMD160,
+ XMLSignature.ALGO_ID_SIGNATURE_RSA_RIPEMD160,
SignatureBaseRSA.SignatureRSARIPEMD160.class
);
algorithmHash.put(
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/SignatureAlgorithmSpi.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/SignatureAlgorithmSpi.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/SignatureAlgorithmSpi.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/SignatureAlgorithmSpi.java Tue Dec 15 17:13:17 2015
@@ -89,7 +89,7 @@ public abstract class SignatureAlgorithm
protected abstract void engineInitSign(Key signingKey) throws XMLSignatureException;
/**
- * Proxy method for {@link java.security.Signature#initSign(java.security.PrivateKey,
+ * Proxy method for {@link java.security.Signature#initSign(java.security.PrivateKey,
* java.security.SecureRandom)}
* which is executed on the internal {@link java.security.Signature} object.
*
@@ -97,7 +97,7 @@ public abstract class SignatureAlgorithm
* @param secureRandom
* @throws XMLSignatureException if this method is called on a MAC
*/
- protected abstract void engineInitSign(Key signingKey, SecureRandom secureRandom)
+ protected abstract void engineInitSign(Key signingKey, SecureRandom secureRandom)
throws XMLSignatureException;
/**
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/IntegrityHmac.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/IntegrityHmac.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/IntegrityHmac.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/IntegrityHmac.java Tue Dec 15 17:13:17 2015
@@ -49,7 +49,7 @@ public abstract class IntegrityHmac exte
/** Field HMACOutputLength */
private int HMACOutputLength = 0;
private boolean HMACOutputLengthSet = false;
-
+
/**
* Method engineGetURI
*
@@ -330,7 +330,7 @@ public abstract class IntegrityHmac exte
}
Text hmaclength =
- XMLUtils.selectDsNodeText(element.getFirstChild(), Constants._TAG_HMACOUTPUTLENGTH, 0);
+ XMLUtils.selectDsNodeText(element.getFirstChild(), Constants._TAG_HMACOUTPUTLENGTH, 0);
if (hmaclength != null) {
this.HMACOutputLength = Integer.parseInt(hmaclength.getData());
@@ -350,7 +350,7 @@ public abstract class IntegrityHmac exte
if (this.HMACOutputLengthSet) {
Document doc = element.getOwnerDocument();
- Element HMElem =
+ Element HMElem =
XMLUtils.createElementInSignatureSpace(doc, Constants._TAG_HMACOUTPUTLENGTH);
Text HMText =
doc.createTextNode("" + this.HMACOutputLength);
@@ -389,7 +389,7 @@ public abstract class IntegrityHmac exte
return 160;
}
}
-
+
/**
* Class IntegrityHmacSHA224
*/
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/SignatureBaseRSA.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/SignatureBaseRSA.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/SignatureBaseRSA.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/SignatureBaseRSA.java Tue Dec 15 17:13:17 2015
@@ -115,7 +115,7 @@ public abstract class SignatureBaseRSA e
try {
this.signatureAlgorithm = Signature.getInstance(signatureAlgorithm.getAlgorithm());
} catch (Exception e) {
- // this shouldn't occur, but if it does, restore previous
+ // this shouldn't occur, but if it does, restore previous
// Signature
if (log.isDebugEnabled()) {
log.debug("Exception when reinstantiating Signature:" + e);
@@ -123,7 +123,7 @@ public abstract class SignatureBaseRSA e
this.signatureAlgorithm = sig;
}
throw new XMLSignatureException(ex);
- }
+ }
}
/** @inheritDoc */
@@ -254,7 +254,7 @@ public abstract class SignatureBaseRSA e
return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA224;
}
}
-
+
/**
* Class SignatureRSASHA256
*/
@@ -354,7 +354,7 @@ public abstract class SignatureBaseRSA e
return XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5;
}
}
-
+
/**
* Class SignatureRSASHA1MGF1
*/
@@ -374,7 +374,7 @@ public abstract class SignatureBaseRSA e
return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1_MGF1;
}
}
-
+
/**
* Class SignatureRSASHA224MGF1
*/
@@ -394,7 +394,7 @@ public abstract class SignatureBaseRSA e
return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA224_MGF1;
}
}
-
+
/**
* Class SignatureRSASHA256MGF1
*/
@@ -414,7 +414,7 @@ public abstract class SignatureBaseRSA e
return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA256_MGF1;
}
}
-
+
/**
* Class SignatureRSASHA384MGF1
*/
@@ -434,7 +434,7 @@ public abstract class SignatureBaseRSA e
return XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA384_MGF1;
}
}
-
+
/**
* Class SignatureRSASHA512MGF1
*/
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/SignatureDSA.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/SignatureDSA.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/SignatureDSA.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/SignatureDSA.java Tue Dec 15 17:13:17 2015
@@ -73,7 +73,7 @@ public class SignatureDSA extends Signat
if (provider == null) {
this.signatureAlgorithm = Signature.getInstance(algorithmID);
} else {
- this.signatureAlgorithm =
+ this.signatureAlgorithm =
Signature.getInstance(algorithmID, provider);
}
} catch (java.security.NoSuchAlgorithmException ex) {
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/SignatureECDSA.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/SignatureECDSA.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/SignatureECDSA.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/algorithms/implementations/SignatureECDSA.java Tue Dec 15 17:13:17 2015
@@ -97,14 +97,14 @@ public abstract class SignatureECDSA ext
|| asn1Bytes[offset] != 2
|| asn1Bytes[offset + 2 + rLength] != 2) {
throw new IOException("Invalid ASN.1 format of ECDSA signature");
- }
+ }
byte xmldsigBytes[] = new byte[2*rawLen];
System.arraycopy(asn1Bytes, offset + 2 + rLength - i, xmldsigBytes, rawLen - i, i);
System.arraycopy(asn1Bytes, offset + 2 + rLength + 2 + sLength - j, xmldsigBytes,
2 * rawLen - j, j);
- return xmldsigBytes;
+ return xmldsigBytes;
}
/**
@@ -399,7 +399,7 @@ public abstract class SignatureECDSA ext
return XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA224;
}
}
-
+
/**
* Class SignatureECDSASHA256
*
@@ -465,7 +465,7 @@ public abstract class SignatureECDSA ext
return XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA512;
}
}
-
+
/**
* Class SignatureECDSARIPEMD160
*/
@@ -485,5 +485,5 @@ public abstract class SignatureECDSA ext
return XMLSignature.ALGO_ID_SIGNATURE_ECDSA_RIPEMD160;
}
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/CanonicalizationException.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/CanonicalizationException.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/CanonicalizationException.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/CanonicalizationException.java Tue Dec 15 17:13:17 2015
@@ -28,7 +28,7 @@ import org.apache.xml.security.exception
public class CanonicalizationException extends XMLSecurityException {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
@@ -39,7 +39,7 @@ public class CanonicalizationException e
public CanonicalizationException() {
super();
}
-
+
public CanonicalizationException(Exception ex) {
super(ex);
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/Canonicalizer.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/Canonicalizer.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/Canonicalizer.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/Canonicalizer.java Tue Dec 15 17:13:17 2015
@@ -53,54 +53,54 @@ public class Canonicalizer {
public static final String ENCODING = "UTF8";
/**
- * XPath Expression for selecting every node and continuous comments joined
- * in only one node
+ * XPath Expression for selecting every node and continuous comments joined
+ * in only one node
*/
- public static final String XPATH_C14N_WITH_COMMENTS_SINGLE_NODE =
+ public static final String XPATH_C14N_WITH_COMMENTS_SINGLE_NODE =
"(.//. | .//@* | .//namespace::*)";
/**
* The URL defined in XML-SEC Rec for inclusive c14n <b>without</b> comments.
*/
- public static final String ALGO_ID_C14N_OMIT_COMMENTS =
+ public static final String ALGO_ID_C14N_OMIT_COMMENTS =
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
/**
* The URL defined in XML-SEC Rec for inclusive c14n <b>with</b> comments.
*/
- public static final String ALGO_ID_C14N_WITH_COMMENTS =
+ public static final String ALGO_ID_C14N_WITH_COMMENTS =
ALGO_ID_C14N_OMIT_COMMENTS + "#WithComments";
/**
* The URL defined in XML-SEC Rec for exclusive c14n <b>without</b> comments.
*/
- public static final String ALGO_ID_C14N_EXCL_OMIT_COMMENTS =
+ public static final String ALGO_ID_C14N_EXCL_OMIT_COMMENTS =
"http://www.w3.org/2001/10/xml-exc-c14n#";
/**
* The URL defined in XML-SEC Rec for exclusive c14n <b>with</b> comments.
*/
- public static final String ALGO_ID_C14N_EXCL_WITH_COMMENTS =
+ public static final String ALGO_ID_C14N_EXCL_WITH_COMMENTS =
ALGO_ID_C14N_EXCL_OMIT_COMMENTS + "WithComments";
/**
* The URI for inclusive c14n 1.1 <b>without</b> comments.
*/
- public static final String ALGO_ID_C14N11_OMIT_COMMENTS =
+ public static final String ALGO_ID_C14N11_OMIT_COMMENTS =
"http://www.w3.org/2006/12/xml-c14n11";
/**
* The URI for inclusive c14n 1.1 <b>with</b> comments.
*/
- public static final String ALGO_ID_C14N11_WITH_COMMENTS =
+ public static final String ALGO_ID_C14N11_WITH_COMMENTS =
ALGO_ID_C14N11_OMIT_COMMENTS + "#WithComments";
/**
* Non-standard algorithm to serialize the physical representation for XML Encryption
*/
- public static final String ALGO_ID_C14N_PHYSICAL =
+ public static final String ALGO_ID_C14N_PHYSICAL =
"http://santuario.apache.org/c14n/physical";
- private static Map<String, Class<? extends CanonicalizerSpi>> canonicalizerHash =
+ private static Map<String, Class<? extends CanonicalizerSpi>> canonicalizerHash =
new ConcurrentHashMap<String, Class<? extends CanonicalizerSpi>>();
-
+
private final CanonicalizerSpi canonicalizerSpi;
private boolean secureValidation;
-
+
/**
* Constructor Canonicalizer
*
@@ -109,7 +109,7 @@ public class Canonicalizer {
*/
private Canonicalizer(String algorithmURI) throws InvalidCanonicalizerException {
try {
- Class<? extends CanonicalizerSpi> implementingClass =
+ Class<? extends CanonicalizerSpi> implementingClass =
canonicalizerHash.get(algorithmURI);
canonicalizerSpi = implementingClass.newInstance();
@@ -148,7 +148,7 @@ public class Canonicalizer {
throws AlgorithmAlreadyRegisteredException, ClassNotFoundException {
JavaUtils.checkRegisterPermission();
// check whether URI is already registered
- Class<? extends CanonicalizerSpi> registeredClass =
+ Class<? extends CanonicalizerSpi> registeredClass =
canonicalizerHash.get(algorithmURI);
if (registeredClass != null) {
@@ -161,7 +161,7 @@ public class Canonicalizer {
ClassLoaderUtils.loadClass(implementingClass, Canonicalizer.class)
);
}
-
+
/**
* Method register
*
@@ -184,37 +184,37 @@ public class Canonicalizer {
canonicalizerHash.put(algorithmURI, implementingClass);
}
-
+
/**
* This method registers the default algorithms.
*/
public static void registerDefaultAlgorithms() {
canonicalizerHash.put(
- Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS,
+ Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS,
Canonicalizer20010315OmitComments.class
);
canonicalizerHash.put(
- Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS,
+ Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS,
Canonicalizer20010315WithComments.class
);
canonicalizerHash.put(
- Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS,
+ Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS,
Canonicalizer20010315ExclOmitComments.class
);
canonicalizerHash.put(
- Canonicalizer.ALGO_ID_C14N_EXCL_WITH_COMMENTS,
+ Canonicalizer.ALGO_ID_C14N_EXCL_WITH_COMMENTS,
Canonicalizer20010315ExclWithComments.class
);
canonicalizerHash.put(
- Canonicalizer.ALGO_ID_C14N11_OMIT_COMMENTS,
+ Canonicalizer.ALGO_ID_C14N11_OMIT_COMMENTS,
Canonicalizer11_OmitComments.class
);
canonicalizerHash.put(
- Canonicalizer.ALGO_ID_C14N11_WITH_COMMENTS,
+ Canonicalizer.ALGO_ID_C14N11_WITH_COMMENTS,
Canonicalizer11_WithComments.class
);
canonicalizerHash.put(
- Canonicalizer.ALGO_ID_C14N_PHYSICAL,
+ Canonicalizer.ALGO_ID_C14N_PHYSICAL,
CanonicalizerPhysical.class
);
}
@@ -358,9 +358,9 @@ public class Canonicalizer {
NodeList xpathNodeSet, String inclusiveNamespaces
) throws CanonicalizationException {
canonicalizerSpi.secureValidation = secureValidation;
- return
+ return
canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet, inclusiveNamespaces);
- }
+ }
/**
* Canonicalizes an XPath node set.
@@ -369,7 +369,7 @@ public class Canonicalizer {
* @return the result of the c14n.
* @throws CanonicalizationException
*/
- public byte[] canonicalizeXPathNodeSet(Set<Node> xpathNodeSet)
+ public byte[] canonicalizeXPathNodeSet(Set<Node> xpathNodeSet)
throws CanonicalizationException {
canonicalizerSpi.secureValidation = secureValidation;
return canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet);
@@ -387,12 +387,12 @@ public class Canonicalizer {
Set<Node> xpathNodeSet, String inclusiveNamespaces
) throws CanonicalizationException {
canonicalizerSpi.secureValidation = secureValidation;
- return
+ return
canonicalizerSpi.engineCanonicalizeXPathNodeSet(xpathNodeSet, inclusiveNamespaces);
}
/**
- * Sets the writer where the canonicalization ends. ByteArrayOutputStream
+ * Sets the writer where the canonicalization ends. ByteArrayOutputStream
* if none is set.
* @param os
*/
@@ -423,5 +423,5 @@ public class Canonicalizer {
public void setSecureValidation(boolean secureValidation) {
this.secureValidation = secureValidation;
}
-
+
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/CanonicalizerSpi.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/CanonicalizerSpi.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/CanonicalizerSpi.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/CanonicalizerSpi.java Tue Dec 15 17:13:17 2015
@@ -40,12 +40,12 @@ public abstract class CanonicalizerSpi {
/** Reset the writer after a c14n */
protected boolean reset = false;
protected boolean secureValidation;
-
+
/**
* Method canonicalize
*
* @param inputBytes
- * @return the c14n bytes.
+ * @return the c14n bytes.
*
* @throws CanonicalizationException
* @throws java.io.IOException
@@ -53,12 +53,12 @@ public abstract class CanonicalizerSpi {
* @throws org.xml.sax.SAXException
*/
public byte[] engineCanonicalize(byte[] inputBytes)
- throws javax.xml.parsers.ParserConfigurationException, java.io.IOException,
+ throws javax.xml.parsers.ParserConfigurationException, java.io.IOException,
org.xml.sax.SAXException, CanonicalizationException {
java.io.InputStream bais = new ByteArrayInputStream(inputBytes);
InputSource in = new InputSource(bais);
-
+
DocumentBuilder db = XMLUtils.createDocumentBuilder(false, secureValidation);
Document document;
@@ -99,7 +99,7 @@ public abstract class CanonicalizerSpi {
);
}
- /**
+ /**
* Returns the URI of this engine.
* @return the URI
*/
@@ -168,7 +168,7 @@ public abstract class CanonicalizerSpi {
throws CanonicalizationException;
/**
- * Sets the writer where the canonicalization ends. ByteArrayOutputStream if
+ * Sets the writer where the canonicalization ends. ByteArrayOutputStream if
* none is set.
* @param os
*/
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/InvalidCanonicalizerException.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/InvalidCanonicalizerException.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/InvalidCanonicalizerException.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/InvalidCanonicalizerException.java Tue Dec 15 17:13:17 2015
@@ -23,7 +23,7 @@ import org.apache.xml.security.exception
public class InvalidCanonicalizerException extends XMLSecurityException {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/helper/AttrCompare.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/helper/AttrCompare.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/helper/AttrCompare.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/helper/AttrCompare.java Tue Dec 15 17:13:17 2015
@@ -27,7 +27,7 @@ import java.util.Comparator;
* Compares two attributes based on the C14n specification.
*
* <UL>
- * <LI>Namespace nodes have a lesser document order position than attribute
+ * <LI>Namespace nodes have a lesser document order position than attribute
* nodes.
* <LI> An element's namespace nodes are sorted lexicographically by
* local name (the default namespace node, if one exists, has no
@@ -50,7 +50,7 @@ public class AttrCompare implements Comp
* Compares two attributes based on the C14n specification.
*
* <UL>
- * <LI>Namespace nodes have a lesser document order position than
+ * <LI>Namespace nodes have a lesser document order position than
* attribute nodes.
* <LI> An element's namespace nodes are sorted lexicographically by
* local name (the default namespace node, if one exists, has no
@@ -62,14 +62,14 @@ public class AttrCompare implements Comp
*
* @param attr0
* @param attr1
- * @return returns a negative integer, zero, or a positive integer as
+ * @return returns a negative integer, zero, or a positive integer as
* obj0 is less than, equal to, or greater than obj1
*
*/
public int compare(Attr attr0, Attr attr1) {
- String namespaceURI0 = attr0.getNamespaceURI();
+ String namespaceURI0 = attr0.getNamespaceURI();
String namespaceURI1 = attr1.getNamespaceURI();
-
+
boolean isNamespaceAttr0 = XMLNS.equals(namespaceURI0);
boolean isNamespaceAttr1 = XMLNS.equals(namespaceURI1);
@@ -94,7 +94,7 @@ public class AttrCompare implements Comp
} else if (isNamespaceAttr1) {
// attr1 is a namespace, attr0 is not
return ATTR1_BEFORE_ATTR0;
- }
+ }
// none is a namespace
if (namespaceURI0 == null) {
@@ -106,13 +106,13 @@ public class AttrCompare implements Comp
return ATTR0_BEFORE_ATTR1;
} else if (namespaceURI1 == null) {
return ATTR1_BEFORE_ATTR0;
- }
+ }
int a = namespaceURI0.compareTo(namespaceURI1);
if (a != 0) {
return a;
}
-
+
return attr0.getLocalName().compareTo(attr1.getLocalName());
}
}
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/helper/C14nHelper.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/helper/C14nHelper.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/helper/C14nHelper.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/helper/C14nHelper.java Tue Dec 15 17:13:17 2015
@@ -43,7 +43,7 @@ public final class C14nHelper {
* Method namespaceIsRelative
*
* @param namespace
- * @return true if the given namespace is relative.
+ * @return true if the given namespace is relative.
*/
public static boolean namespaceIsRelative(Attr namespace) {
return !namespaceIsAbsolute(namespace);
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer11.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer11.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer11.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer11.java Tue Dec 15 17:13:17 2015
@@ -46,20 +46,20 @@ import org.apache.xml.security.utils.XML
/**
* Implements <A HREF="http://www.w3.org/TR/2008/PR-xml-c14n11-20080129/">
- * Canonical XML Version 1.1</A>, a W3C Proposed Recommendation from 29
+ * Canonical XML Version 1.1</A>, a W3C Proposed Recommendation from 29
* January 2008.
*
* @author Sean Mullan
* @author Raul Benito
*/
public abstract class Canonicalizer11 extends CanonicalizerBase {
-
+
private static final String XMLNS_URI = Constants.NamespaceSpecNS;
private static final String XML_LANG_URI = Constants.XML_LANG_SPACE_SpecNS;
- private static org.slf4j.Logger log =
+ private static org.slf4j.Logger log =
org.slf4j.LoggerFactory.getLogger(Canonicalizer11.class);
private final SortedSet<Attr> result = new TreeSet<Attr>(COMPARE);
-
+
private boolean firstCall = true;
private static class XmlAttrStack {
@@ -68,12 +68,12 @@ public abstract class Canonicalizer11 ex
boolean rendered = false;
List<Attr> nodes = new ArrayList<Attr>();
}
-
+
int currentLevel = 0;
int lastlevel = 0;
XmlsStackElement cur;
- List<XmlsStackElement> levels = new ArrayList<XmlsStackElement>();
-
+ List<XmlsStackElement> levels = new ArrayList<XmlsStackElement>();
+
void push(int level) {
currentLevel = level;
if (currentLevel == -1) {
@@ -90,7 +90,7 @@ public abstract class Canonicalizer11 ex
lastlevel = levels.get(newSize - 1).level;
}
}
-
+
void addXmlnsAttr(Attr n) {
if (cur == null) {
cur = new XmlsStackElement();
@@ -100,7 +100,7 @@ public abstract class Canonicalizer11 ex
}
cur.nodes.add(n);
}
-
+
void getXmlnsAttr(Collection<Attr> col) {
int size = levels.size() - 1;
if (cur == null) {
@@ -181,9 +181,9 @@ public abstract class Canonicalizer11 ex
col.addAll(loa.values());
}
}
-
+
private XmlAttrStack xmlattrStack = new XmlAttrStack();
-
+
/**
* Constructor Canonicalizer11
*
@@ -240,7 +240,7 @@ public abstract class Canonicalizer11 ex
* <br>
* The code of this method is a copy of {@link #handleAttributes(Element,
* NameSpaceSymbTable)},
- * whereas it takes into account that subtree-c14n is -- well --
+ * whereas it takes into account that subtree-c14n is -- well --
* subtree-based.
* So if the element in question isRoot of c14n, it's parent is not in the
* node set, as well as all other ancestors.
@@ -254,29 +254,29 @@ public abstract class Canonicalizer11 ex
protected Iterator<Attr> handleAttributesSubtree(Element element, NameSpaceSymbTable ns)
throws CanonicalizationException {
if (!element.hasAttributes() && !firstCall) {
- return null;
+ return null;
}
// result will contain the attrs which have to be output
- final SortedSet<Attr> result = this.result;
+ final SortedSet<Attr> result = this.result;
result.clear();
if (element.hasAttributes()) {
NamedNodeMap attrs = element.getAttributes();
- int attrsLength = attrs.getLength();
-
+ int attrsLength = attrs.getLength();
+
for (int i = 0; i < attrsLength; i++) {
Attr attribute = (Attr) attrs.item(i);
String NUri = attribute.getNamespaceURI();
String NName = attribute.getLocalName();
- String NValue = attribute.getValue();
-
+ String NValue = attribute.getValue();
+
if (!XMLNS_URI.equals(NUri)) {
// It's not a namespace attr node. Add to the result and continue.
result.add(attribute);
} else if (!(XML.equals(NName) && XML_LANG_URI.equals(NValue))) {
// The default mapping for xml must not be output.
Node n = ns.addMappingAndRender(NName, NValue, attribute);
-
+
if (n != null) {
// Render the ns definition
result.add((Attr)n);
@@ -294,11 +294,11 @@ public abstract class Canonicalizer11 ex
if (firstCall) {
// It is the first node of the subtree
// Obtain all the namespaces defined in the parents, and added to the output.
- ns.getUnrenderedNodes(result);
+ ns.getUnrenderedNodes(result);
// output the attributes in the xml namespace.
xmlattrStack.getXmlnsAttr(result);
firstCall = false;
- }
+ }
return result.iterator();
}
@@ -306,25 +306,25 @@ public abstract class Canonicalizer11 ex
/**
* Returns the Attr[]s to be output for the given element.
* <br>
- * IMPORTANT: This method expects to work on a modified DOM tree, i.e. a
- * DOM which has been prepared using
+ * IMPORTANT: This method expects to work on a modified DOM tree, i.e. a
+ * DOM which has been prepared using
* {@link org.apache.xml.security.utils.XMLUtils#circumventBug2650(
* org.w3c.dom.Document)}.
- *
+ *
* @param element
* @param ns
* @return the Attr[]s to be output
* @throws CanonicalizationException
*/
@Override
- protected Iterator<Attr> handleAttributes(Element element, NameSpaceSymbTable ns)
- throws CanonicalizationException {
+ protected Iterator<Attr> handleAttributes(Element element, NameSpaceSymbTable ns)
+ throws CanonicalizationException {
// result will contain the attrs which have to be output
xmlattrStack.push(ns.getLevel());
boolean isRealVisible = isVisibleDO(element, ns.getLevel()) == 1;
- final SortedSet<Attr> result = this.result;
+ final SortedSet<Attr> result = this.result;
result.clear();
-
+
if (element.hasAttributes()) {
NamedNodeMap attrs = element.getAttributes();
int attrsLength = attrs.getLength();
@@ -334,13 +334,13 @@ public abstract class Canonicalizer11 ex
String NUri = attribute.getNamespaceURI();
String NName = attribute.getLocalName();
String NValue = attribute.getValue();
-
+
if (!XMLNS_URI.equals(NUri)) {
//A non namespace definition node.
if (XML_LANG_URI.equals(NUri)) {
if (NName.equals("id")) {
if (isRealVisible) {
- // treat xml:id like any other attribute
+ // treat xml:id like any other attribute
// (emit it, but don't inherit it)
result.add(attribute);
}
@@ -350,10 +350,10 @@ public abstract class Canonicalizer11 ex
} else if (isRealVisible) {
//The node is visible add the attribute to the list of output attributes.
result.add(attribute);
- }
+ }
} else if (!XML.equals(NName) || !XML_LANG_URI.equals(NValue)) {
/* except omit namespace node with local name xml, which defines
- * the xml prefix, if its string value is
+ * the xml prefix, if its string value is
* http://www.w3.org/XML/1998/namespace.
*/
// add the prefix binding to the ns symb table.
@@ -373,7 +373,7 @@ public abstract class Canonicalizer11 ex
}
} else {
if (isRealVisible && !XMLNS.equals(NName)) {
- ns.removeMapping(NName);
+ ns.removeMapping(NName);
} else {
ns.addMapping(NName, NValue, attribute);
}
@@ -381,14 +381,14 @@ public abstract class Canonicalizer11 ex
}
}
}
-
- if (isRealVisible) {
- //The element is visible, handle the xmlns definition
+
+ if (isRealVisible) {
+ //The element is visible, handle the xmlns definition
Attr xmlns = element.getAttributeNodeNS(XMLNS_URI, XMLNS);
Node n = null;
if (xmlns == null) {
//No xmlns def just get the already defined.
- n = ns.getMapping(XMLNS);
+ n = ns.getMapping(XMLNS);
} else if (!isVisible(xmlns)) {
//There is a definition but the xmlns is not selected by the xpath.
//then xmlns=""
@@ -399,7 +399,7 @@ public abstract class Canonicalizer11 ex
if (n != null) {
result.add((Attr)n);
}
- //Float all xml:* attributes of the unselected parent elements to this one.
+ //Float all xml:* attributes of the unselected parent elements to this one.
xmlattrStack.getXmlnsAttr(result);
ns.getUnrenderedNodes(result);
}
@@ -407,8 +407,8 @@ public abstract class Canonicalizer11 ex
return result.iterator();
}
- protected void circumventBugIfNeeded(XMLSignatureInput input)
- throws CanonicalizationException, ParserConfigurationException,
+ protected void circumventBugIfNeeded(XMLSignatureInput input)
+ throws CanonicalizationException, ParserConfigurationException,
IOException, SAXException {
if (!input.isNeedsToBeExpanded()) {
return;
@@ -433,7 +433,7 @@ public abstract class Canonicalizer11 ex
Attr attribute = (Attr) attrs.item(i);
String NName = attribute.getLocalName();
String NValue = attribute.getNodeValue();
-
+
if (Constants.NamespaceSpecNS.equals(attribute.getNamespaceURI())) {
if (!XML.equals(NName) || !Constants.XML_LANG_SPACE_SpecNS.equals(NValue)) {
ns.addMapping(NName, NValue, attribute);
@@ -510,7 +510,7 @@ public abstract class Canonicalizer11 ex
} else {
if (bauthority != null && bpath.length() == 0) {
tpath = "/" + rpath;
- } else {
+ } else {
int last = bpath.lastIndexOf('/');
if (last == -1) {
tpath = rpath;
Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer20010315.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer20010315.java?rev=1720201&r1=1720200&r2=1720201&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer20010315.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/c14n/implementations/Canonicalizer20010315.java Tue Dec 15 17:13:17 2015
@@ -52,22 +52,22 @@ import org.xml.sax.SAXException;
public abstract class Canonicalizer20010315 extends CanonicalizerBase {
private static final String XMLNS_URI = Constants.NamespaceSpecNS;
private static final String XML_LANG_URI = Constants.XML_LANG_SPACE_SpecNS;
-
+
private boolean firstCall = true;
private final SortedSet<Attr> result = new TreeSet<Attr>(COMPARE);
-
+
private static class XmlAttrStack {
static class XmlsStackElement {
int level;
boolean rendered = false;
List<Attr> nodes = new ArrayList<Attr>();
}
-
+
int currentLevel = 0;
int lastlevel = 0;
XmlsStackElement cur;
List<XmlsStackElement> levels = new ArrayList<XmlsStackElement>();
-
+
void push(int level) {
currentLevel = level;
if (currentLevel == -1) {
@@ -84,7 +84,7 @@ public abstract class Canonicalizer20010
lastlevel = levels.get(newSize - 1).level;
}
}
-
+
void addXmlnsAttr(Attr n) {
if (cur == null) {
cur = new XmlsStackElement();
@@ -94,7 +94,7 @@ public abstract class Canonicalizer20010
}
cur.nodes.add(n);
}
-
+
void getXmlnsAttr(Collection<Attr> col) {
int size = levels.size() - 1;
if (cur == null) {
@@ -130,7 +130,7 @@ public abstract class Canonicalizer20010
}
}
}
-
+
cur.rendered = true;
col.addAll(loa.values());
}
@@ -147,7 +147,7 @@ public abstract class Canonicalizer20010
public Canonicalizer20010315(boolean includeComments) {
super(includeComments);
}
-
+
/**
* Always throws a CanonicalizationException because this is inclusive c14n.
*
@@ -212,29 +212,29 @@ public abstract class Canonicalizer20010
protected Iterator<Attr> handleAttributesSubtree(Element element, NameSpaceSymbTable ns)
throws CanonicalizationException {
if (!element.hasAttributes() && !firstCall) {
- return null;
+ return null;
}
// result will contain the attrs which have to be output
- final SortedSet<Attr> result = this.result;
+ final SortedSet<Attr> result = this.result;
result.clear();
if (element.hasAttributes()) {
NamedNodeMap attrs = element.getAttributes();
- int attrsLength = attrs.getLength();
-
+ int attrsLength = attrs.getLength();
+
for (int i = 0; i < attrsLength; i++) {
Attr attribute = (Attr) attrs.item(i);
String NUri = attribute.getNamespaceURI();
String NName = attribute.getLocalName();
- String NValue = attribute.getValue();
-
+ String NValue = attribute.getValue();
+
if (!XMLNS_URI.equals(NUri)) {
//It's not a namespace attr node. Add to the result and continue.
result.add(attribute);
} else if (!(XML.equals(NName) && XML_LANG_URI.equals(NValue))) {
//The default mapping for xml must not be output.
- Node n = ns.addMappingAndRender(NName, NValue, attribute);
-
+ Node n = ns.addMappingAndRender(NName, NValue, attribute);
+
if (n != null) {
//Render the ns definition
result.add((Attr)n);
@@ -252,11 +252,11 @@ public abstract class Canonicalizer20010
if (firstCall) {
//It is the first node of the subtree
//Obtain all the namespaces defined in the parents, and added to the output.
- ns.getUnrenderedNodes(result);
+ ns.getUnrenderedNodes(result);
//output the attributes in the xml namespace.
xmlattrStack.getXmlnsAttr(result);
firstCall = false;
- }
+ }
return result.iterator();
}
@@ -267,21 +267,21 @@ public abstract class Canonicalizer20010
* IMPORTANT: This method expects to work on a modified DOM tree, i.e. a DOM which has
* been prepared using {@link org.apache.xml.security.utils.XMLUtils#circumventBug2650(
* org.w3c.dom.Document)}.
- *
+ *
* @param element
* @param ns
* @return the Attr[]s to be output
* @throws CanonicalizationException
*/
@Override
- protected Iterator<Attr> handleAttributes(Element element, NameSpaceSymbTable ns)
- throws CanonicalizationException {
+ protected Iterator<Attr> handleAttributes(Element element, NameSpaceSymbTable ns)
+ throws CanonicalizationException {
// result will contain the attrs which have to be output
xmlattrStack.push(ns.getLevel());
boolean isRealVisible = isVisibleDO(element, ns.getLevel()) == 1;
- final SortedSet<Attr> result = this.result;
+ final SortedSet<Attr> result = this.result;
result.clear();
-
+
if (element.hasAttributes()) {
NamedNodeMap attrs = element.getAttributes();
int attrsLength = attrs.getLength();
@@ -291,7 +291,7 @@ public abstract class Canonicalizer20010
String NUri = attribute.getNamespaceURI();
String NName = attribute.getLocalName();
String NValue = attribute.getValue();
-
+
if (!XMLNS_URI.equals(NUri)) {
//A non namespace definition node.
if (XML_LANG_URI.equals(NUri)) {
@@ -299,7 +299,7 @@ public abstract class Canonicalizer20010
} else if (isRealVisible) {
//The node is visible add the attribute to the list of output attributes.
result.add(attribute);
- }
+ }
} else if (!XML.equals(NName) || !XML_LANG_URI.equals(NValue)) {
/* except omit namespace node with local name xml, which defines
* the xml prefix, if its string value is http://www.w3.org/XML/1998/namespace.
@@ -329,8 +329,8 @@ public abstract class Canonicalizer20010
}
}
}
- if (isRealVisible) {
- //The element is visible, handle the xmlns definition
+ if (isRealVisible) {
+ //The element is visible, handle the xmlns definition
Attr xmlns = element.getAttributeNodeNS(XMLNS_URI, XMLNS);
Node n = null;
if (xmlns == null) {
@@ -346,15 +346,15 @@ public abstract class Canonicalizer20010
if (n != null) {
result.add((Attr)n);
}
- //Float all xml:* attributes of the unselected parent elements to this one.
+ //Float all xml:* attributes of the unselected parent elements to this one.
xmlattrStack.getXmlnsAttr(result);
ns.getUnrenderedNodes(result);
}
return result.iterator();
}
-
- protected void circumventBugIfNeeded(XMLSignatureInput input)
+
+ protected void circumventBugIfNeeded(XMLSignatureInput input)
throws CanonicalizationException, ParserConfigurationException, IOException, SAXException {
if (!input.isNeedsToBeExpanded()) {
return;
@@ -380,7 +380,7 @@ public abstract class Canonicalizer20010
Attr attribute = (Attr) attrs.item(i);
String NName = attribute.getLocalName();
String NValue = attribute.getNodeValue();
-
+
if (Constants.NamespaceSpecNS.equals(attribute.getNamespaceURI())) {
if (!XML.equals(NName) || !Constants.XML_LANG_SPACE_SpecNS.equals(NValue)) {
ns.addMapping(NName, NValue, attribute);