public KeyInfo getKeyInfo() throws MarshalException { XMLSignature xmlSignature = getXMLSignature(); if (xmlSignature != null) { return xmlSignature.getKeyInfo(); } return null; }
XMLSignature signature = new XMLSignature(sigElement, null); KeyInfo keyInfo = signature.getKeyInfo(); NodeList x509Certificates = keyInfo.getElement().getElementsByTagNameNS("http://www.w3.org/2000/09/xmldsig#", "X509Certificate"); ArrayList<X509Certificate> allCertificates = new ArrayList<X509Certificate>(); for (int i = 0; i < x509Certificates.getLength(); i++) { Node x509CertificateElement = x509Certificates.item(i); byte[] decodedX509Certificate = Base64.decode(x509CertificateElement.getTextContent()); X509Certificate x509Certificate = (X509Certificate) CertificateFactory.getInstance("X509").generateCertificate(new ByteArrayInputStream(decodedX509Certificate)); allCertificates.add(x509Certificate); } // now you have all certificates in allCertificates
KeyInfo ki = signature.getKeyInfo(); if (ki == null) { throw new Exception("Did not find KeyInfo"); X509Certificate cert = signature.getKeyInfo().getX509Certificate(); if (cert == null) { PublicKey pk = signature.getKeyInfo().getPublicKey(); if (pk == null) { throw new Exception("Did not find Certificate or Public Key");
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof XMLSignature)) { return false; } XMLSignature osig = (XMLSignature)o; boolean idEqual = id == null ? osig.getId() == null : id.equals(osig.getId()); boolean keyInfoEqual = ki == null ? osig.getKeyInfo() == null : ki.equals(osig.getKeyInfo()); return idEqual && keyInfoEqual && sv.equals(osig.getSignatureValue()) && si.equals(osig.getSignedInfo()) && objects.equals(osig.getObjects()); }
XMLSignature signature = new XMLSignature(sigElement, ""); KeyInfo ki = signature.getKeyInfo(); if (ki == null) { throw new Exception("Did not find KeyInfo"); X509Certificate cert = signature.getKeyInfo().getX509Certificate(); if (cert == null) { PublicKey pk = signature.getKeyInfo().getPublicKey(); if (pk == null) { throw new Exception("Did not find Certificate or Public Key");
KeyInfo keyInfo = signature.getKeyInfo();
for (Object keyInfoItem : signature.getKeyInfo().getContent ()) { if (keyInfoItem instanceof X509Data) { for (Object X509Item : ((X509Data) keyInfoItem).getContent ()) { for (Object keyInfoItem : signature.getKeyInfo().getContent ()) { if (keyInfoItem instanceof X509Data) { for (Object X509Item : ((X509Data) keyInfoItem).getContent ()) {