import iaik.pkcs.pkcs12.Certifica
import iaik.security.provider.IAI
import java.io.ByteArrayInputStre
import java.io.FileInputStream;
import java.io.FileNotFoundExcept
import java.io.IOException;
import java.security.NoSuchProvid
import java.security.cert.Certifi
import java.security.cert.Certifi
import java.security.cert.Certifi
import javax.xml.parsers.Document
import javax.xml.parsers.Document
import javax.xml.parsers.ParserCo
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class parseDsig {
public static void main(String[] args) throws FileNotFoundException,
SAXException, IOException, ParserConfigurationExcepti
DocumentBuilderFactory factory = DocumentBuilderFactory.new
DocumentBuilder builder = factory.newDocumentBuilder
Document doc = builder.parse(new FileInputStream(
"618190000.xml"));
Element root = doc.getDocumentElement();
NodeList list = root.getElementsByTagNameN
String cert = null;
for (int i = 0; i < list.getLength(); i++) {
Node el = list.item(i);
if (el.getNodeName().contains
Node data = el.getChildNodes().item(0)
if (data != null) {
cert = data.getNodeValue();
}
}
}
if(cert!=null){
IAIK.addAsJDK14Provider();
CertificateFactory certfactory = CertificateFactory.getInst
Certificate certificate = certfactory.generateCertif
System.out.println(certifi
}
}
}
Main Topics
Browse All Topics





by: girionisPosted on 2008-01-25 at 01:55:33ID: 20741294
I guess you have the XML signature. All you need to do is to call the xmlSignature.getKeyInfo(). This will return a KeyInfo object. Then you do a keyInfo.getContent() and you will get back a list of XMLStructure objects. Each of these XMLStructure objects represent an element in the KeyInfo.
vices/docs /2.0/tutor ial/doc/ XM LDigitalSi gnatureAPI 8.html
ig-core/#s ec-KeyInfo
You can find some code examples here:
http://java.sun.com/webser
and the KeyInfo specification here:
http://www.w3.org/TR/xmlds