Displaying keyword search results 1 - 5
Created by Dr. Xi on April 29, 2013 09:00:48 Last update: April 29, 2013 09:00:48
In the case proposed by Diony , signing multiple elements by id, simply change the newSignedInfo to:
// Create the SignedInfo final List transforms0...I must admit that I don't understand transformations, so take my example code with a grain of salt. Also, signing a doc fragment by PATH does not work, simply because there's no way to identify the fragment with a URI without referring to it by id. Reference ode from org.jcp.xml.dsig.internal.dom.DOMURIDereferencer :
// Check if same-document URI and register...
Created by Dr. Xi on August 27, 2010 22:35:53 Last update: August 27, 2010 22:35:53
This example decompresses a gzip compressed file with java.util.zip.GZIPInputStream . The input is assumed to be Base64 encoded after being gzipped (such would be the case when binary data is transmitted within an XML file). You don't need the Base64InputStream if the data is not Base64 encoded.
import java.io.*; import java.util.zip.GZIPInpu...
Created by Fang on August 23, 2010 22:55:58 Last update: August 24, 2010 15:45:04
The tags XML flow control tags are exactly the same as their Core flow control equivalents, except that the test condition with a boolean EL expression is replaced by the select condition with an XPath expression. In the case of the forEach tag, the items attribute is replaced with the select attribute. In a test condition, the XPath expression is evaluated to a boolean value by the rules of the XPath boolean() function, which converts its argument to a boolean as follows: a number is true if and only if it is neither positive or negative zero nor NaN. a node-set is true if and only if it is non-empty. a string is true if and only if its length is non-zero. an object of...
Created by Dr. Xi on July 19, 2010 21:58:34 Last update: July 23, 2010 21:37:23
Parsing XML in Java is really simple:
import java.io.*; import javax.xml.parsers.Docu...The parser implementation details are hidden behind the JAXP API. In case you want to know which parser implementation is used, this is what the JavaDoc for DocumentBuilderFactory.newInstance says: Use the javax.xml.parsers.DocumentBuilderFactory system property. Use the properties file " lib/jaxp.properties " in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. The jaxp.properties file is read only once by the JAXP implementation and it's values are then cached for future use. If the file does not exist when the first attempt is made to read from it, no further attempts are made to...
Created by Dr. Xi on June 19, 2010 04:34:01 Last update: June 19, 2010 04:39:13
Java SE 6 contains built-in utilities to generate XML signatures. This is an example that generates XML signatures using a Java keystore. It has options to generate signature for the whole document, for an element with a specific ID, or for elements matched by an XPATH expression. The XML document used to test is taken from Getting Started with XML Security :
<?xml version="1.0"?> <PatientRecord> ...This is the Java code:
import java.io.FileInputStream; import java.io....However, it looks like the XPATH transform is not working. The digest generated with XPATH filter is exactly the same as that without it (i.e., the whole document)! Another reference: Programming With the Java XML Digital Signature API