OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 118 → Rev 119

/trunk/Modules/Module EBICS/src/org/openconcerto/modules/finance/payment/ebics/crypto/X509CertificateGenerator.java
File deleted
\ No newline at end of file
/trunk/Modules/Module EBICS/src/org/openconcerto/modules/finance/payment/ebics/crypto/TransformXPointer.java
New file
0,0 → 1,87
package org.openconcerto.modules.finance.payment.ebics.crypto;
 
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
 
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathFactory;
 
import org.apache.xml.security.c14n.CanonicalizationException;
import org.apache.xml.security.signature.XMLSignatureInput;
import org.apache.xml.security.transforms.Transform;
import org.apache.xml.security.transforms.TransformSpi;
import org.apache.xml.security.transforms.TransformationException;
import org.apache.xml.security.transforms.Transforms;
import org.openconcerto.utils.StringInputStream;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Class TransformXPointer
*/
public class TransformXPointer extends TransformSpi {
 
/** Field implementedTransformURI */
public static final String implementedTransformURI = Transforms.TRANSFORM_XPOINTER;
 
/** @inheritDoc */
protected String engineGetURI() {
return implementedTransformURI;
}
 
/**
* Method enginePerformTransform
*
* @param input
* @return {@link XMLSignatureInput} as the result of transformation
* @throws TransformationException
*
*/
protected XMLSignatureInput enginePerformTransform(XMLSignatureInput input, Transform _transformObject) throws TransformationException {
//
try {
// System.err.println(new String(input.getBytes()));
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
Document doc = dbf.newDocumentBuilder().parse(new ByteArrayInputStream(input.getBytes()));
 
String PATH = "//*[@authenticate='true']";
XPathFactory factory = XPathFactory.newInstance();
XPath xpath = factory.newXPath();
XPathExpression expr = xpath.compile(PATH);
NodeList nodes = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
 
if (nodes.getLength() < 1) {
System.out.println("Invalid document, can't find node by PATH: " + PATH);
return null;
}
final Set<Node> l = new HashSet<Node>();
for (int i = 0; i < nodes.getLength(); i++) {
final Node item = nodes.item(i);
l.add(item);
final NodeList childNodes = item.getChildNodes();
for (int j = 0; j < childNodes.getLength(); j++) {
Node node = childNodes.item(i);
// l.add(node);
}
}
XMLSignatureInput out = new XMLSignatureInput(nodes.item(0));
// System.err.println(new String(out.getBytes()));
return out;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Object exArgs[] = { implementedTransformURI };
 
throw new TransformationException("signature.Transform.NotYetImplemented", exArgs);
}
}
/trunk/Modules/Module EBICS/.classpath
2,7 → 2,7
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry combineaccessrules="false" kind="src" path="/OpenConcerto GoogleCode"/>
<classpathentry combineaccessrules="false" kind="src" path="/OpenConcerto"/>
<classpathentry kind="lib" path="lib/bcmail-jdk16-146.jar"/>
<classpathentry kind="lib" path="lib/bcprov-jdk16-146.jar"/>
<classpathentry kind="lib" path="lib/serializer-2.7.1.jar"/>
10,5 → 10,6
<classpathentry kind="lib" path="lib/xalan-2.7.1.jar"/>
<classpathentry kind="lib" path="lib/xml-apis-1.3.03.jar"/>
<classpathentry kind="lib" path="lib/xmlsec-1.4.5.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin"/>
</classpath>
/trunk/Modules/Module EBICS/module.properties
New file
0,0 → 1,5
# [\p{Alnum}_.]{3,}
id=org.openconcerto.modules.finance.payment.ebics
# \p{Digit}(\.\p{Digit}+)?
version=1.0
contact=ILM Informatique