Package org.apache.xml.security.signature

Examples of org.apache.xml.security.signature.XMLSignature.checkSignatureValue()


          "Could not find expected " +
          Transforms.TRANSFORM_ENVELOPED_SIGNATURE +
      " transform in signature");
    }
    // finally check the signature
    if (!oSig.checkSignatureValue(oPubKey))
    {
      throw new XMLSecurityException("Signature failed to verify.");
    }
  }
 
View Full Code Here


        X509Certificate cert = signature.getKeyInfo().getX509Certificate();

        if (cert == null) {
            throw new RuntimeException("No certificate");
        }
        assertTrue(signature.checkSignatureValue(cert) );
    }
   
    private File makeDataFile(String relPath) {
        if (BASEDIR != null && !"".equals(BASEDIR)) {
            return new File(BASEDIR + SEP + relPath);
View Full Code Here

        signature.setFollowNestedManifests(followManifests);

        byte keybytes[] = hmacKey;
        javax.crypto.SecretKey sk = signature.createSecretKey(keybytes);

        return signature.checkSignatureValue(sk);
    }

    /**
     * Method verify
     *
 
View Full Code Here

        boolean result = false;
        if (ki != null) {
            X509Certificate cert = ki.getX509Certificate();

            if (cert != null) {
                result = signature.checkSignatureValue(cert);
            } else {
                PublicKey pk = ki.getPublicKey();

                if (pk != null) {
                    result = signature.checkSignatureValue(pk);
View Full Code Here

                result = signature.checkSignatureValue(cert);
            } else {
                PublicKey pk = ki.getPublicKey();

                if (pk != null) {
                    result = signature.checkSignatureValue(pk);
                } else {
                    throw new RuntimeException(
                    "Did not find a public key, so I can't check the signature");
                }
            }
View Full Code Here

        Element sigElement =
            (Element) doc.getElementsByTagNameNS(Constants.SignatureSpecNS,
                                                 Constants._TAG_SIGNATURE).item(0);
        XMLSignature signature = new XMLSignature(sigElement, f.toURI().toURL().toString());
        return signature.checkSignatureValue(signature.getKeyInfo().getPublicKey());
    }
   
    private boolean readAndVerifySignatureAndSetManifest(
        String directory, String file
    ) throws Exception {
View Full Code Here

        Element manifestElement =
            (Element) doc.getElementsByTagName("Manifest").item(0);
        manifestElement.setIdAttribute("Id", true);
       
        XMLSignature signature = new XMLSignature(sigElement, f.toURI().toURL().toString(), true);
        return signature.checkSignatureValue(signature.getKeyInfo().getPublicKey());
    }

}
View Full Code Here

        Element sigElement =
            (Element) doc.getElementsByTagNameNS(Constants.SignatureSpecNS,
                                                 Constants._TAG_SIGNATURE).item(0);
        XMLSignature signature = new XMLSignature(sigElement, f.toURI().toURL().toString(), secValidation);
        return signature.checkSignatureValue(signature.getKeyInfo().getPublicKey());
    }
   
}
View Full Code Here

        Element sigElement =
            (Element) doc.getElementsByTagNameNS(Constants.SignatureSpecNS,
                                                 Constants._TAG_SIGNATURE).item(0);
        XMLSignature signature = new XMLSignature(sigElement, f.toURI().toURL().toString());
        boolean verify =
            signature.checkSignatureValue(signature.getKeyInfo().getPublicKey());

        log.debug("   signature.checkSignatureValue finished: " + verify);

        // if (!verify) {
        StringBuilder sb = new StringBuilder();
View Full Code Here

        Document document = builder.parse(file);

        Element signatureElement = (Element) document.getElementsByTagNameNS("http://www.w3.org/2000/09/xmldsig#", "Signature").item(0);
        ((Element) signatureElement.getParentNode()).setIdAttributeNS(null, "Id", true);
        XMLSignature xmlSignature = new XMLSignature(signatureElement, "", true);
        xmlSignature.checkSignatureValue(cert);
    }

    protected File doStreamingEncryptionOutbound(File file, int tagCount) throws Exception {

        final File signedFile = new File(getTmpFilePath(), "encryption-stax-" + tagCount + ".xml");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.