Package javax.xml.crypto

Examples of javax.xml.crypto.KeySelector$Purpose


    @org.junit.Test
    public void test_signature_hmac_sha1_40_c14n_comments_detached()
    throws Exception {
        String file = "signature-hmac-sha1-40-c14n-comments-detached.xml";

        KeySelector ks = new KeySelectors.SecretKeySelector
            ("test".getBytes("ASCII") );
        try {
            validator.validate(file, ks);
            fail("Expected HMACOutputLength Exception");
        } catch (XMLSignatureException xse) {
View Full Code Here


    @org.junit.Test
    public void test_signature_hmac_sha1_40_exclusive_c14n_comments_detached()
    throws Exception {
        String file = "signature-hmac-sha1-40-exclusive-c14n-comments-detached.xml";

        KeySelector ks = new KeySelectors.SecretKeySelector
            ("test".getBytes("ASCII") );
        try {
            validator.validate(file, ks);
            fail("Expected HMACOutputLength Exception");
        } catch (XMLSignatureException xse) {
View Full Code Here

    @org.junit.Test
    public void test_signature_hmac_sha1_exclusive_c14n_comments_detached()
    throws Exception {
        String file = "signature-hmac-sha1-exclusive-c14n-comments-detached.xml";

        KeySelector ks = new KeySelectors.SecretKeySelector
            ("test".getBytes("ASCII") );
        boolean coreValidity = validator.validate(file, ks, ud);
        assertTrue("Signature failed core validation", coreValidity);
    }
View Full Code Here

    @org.junit.Test
    public void test_signature_hmac_sha1_exclusive_c14n_enveloped()
    throws Exception {
        String file = "signature-hmac-sha1-exclusive-c14n-enveloped.xml";

        KeySelector ks = new KeySelectors.SecretKeySelector
            ("test".getBytes("ASCII") );
        boolean coreValidity = validator.validate(file, ks);
        assertTrue("Signature failed core validation", coreValidity);
    }
View Full Code Here

    @org.junit.Test
    public void test_signature_enveloping_hmac_sha1() throws Exception {
        String file = "signature-enveloping-hmac-sha1.xml";
       
        KeySelector ks = new KeySelectors.SecretKeySelector
            ("secret".getBytes("ASCII") );
        boolean coreValidity = validator.validate(file, ks);
        assertTrue("Signature failed core validation", coreValidity);
    }
View Full Code Here

    @org.junit.Test
    public void test_signature_enveloping_hmac_sha1_40() throws Exception {
        String file = "signature-enveloping-hmac-sha1-40.xml";
       
        KeySelector ks = new KeySelectors.SecretKeySelector
            ("secret".getBytes("ASCII") );
        try {
            validator.validate(file, ks);
            fail("Expected HMACOutputLength exception");
        } catch (XMLSignatureException xse) {
View Full Code Here

     * @param publicKey the public key corresponding to the key pair the document was signed with
     * @return true if a correct signature is present, false otherwise
     */
    public static boolean validSignature(Document document, Key publicKey) {
        Node signatureNode =  document.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature").item(0);
        KeySelector keySelector = KeySelector.singletonKeySelector(publicKey);

        try {
            String providerName = System.getProperty("jsr105Provider", "org.jcp.xml.dsig.internal.dom.XMLDSigRI");
            XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM", (Provider) Class.forName(providerName).newInstance());
            DOMValidateContext valContext = new DOMValidateContext(keySelector, signatureNode);
View Full Code Here

     * @param publicKey the public key corresponding to the key pair the document was signed with
     * @return true if a correct signature is present, false otherwise
     */
    public static boolean validSignature(Document document, Key publicKey) {
        Node signatureNode =  document.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature").item(0);
        KeySelector keySelector = KeySelector.singletonKeySelector(publicKey);

        try {
            String providerName = System.getProperty("jsr105Provider", "org.jcp.xml.dsig.internal.dom.XMLDSigRI");
            XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM", (Provider) Class.forName(providerName).newInstance());
            DOMValidateContext valContext = new DOMValidateContext(keySelector, signatureNode);
View Full Code Here

     * @param publicKey the public key corresponding to the key pair the document was signed with
     * @return true if a correct signature is present, false otherwise
     */
    public static boolean validSignature(Document document, Key publicKey) {
        Node signatureNode =  document.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature").item(0);
        KeySelector keySelector = KeySelector.singletonKeySelector(publicKey);

        try {
            String providerName = System.getProperty("jsr105Provider", "org.jcp.xml.dsig.internal.dom.XMLDSigRI");
            XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM", (Provider) Class.forName(providerName).newInstance());
            DOMValidateContext valContext = new DOMValidateContext(keySelector, signatureNode);
View Full Code Here

     * @param publicKey the public key corresponding to the key pair the document was signed with
     * @return true if a correct signature is present, false otherwise
     */
    public static boolean validSignature(Document document, Key publicKey) {
        Node signatureNode = document.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature").item(0);
        KeySelector keySelector = KeySelector.singletonKeySelector(publicKey);

        try {
            String providerName = System.getProperty("jsr105Provider", "org.jcp.xml.dsig.internal.dom.XMLDSigRI");
            XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM", (Provider) Class.forName(providerName).newInstance());
            DOMValidateContext valContext = new DOMValidateContext(keySelector, signatureNode);
View Full Code Here

TOP

Related Classes of javax.xml.crypto.KeySelector$Purpose

Copyright © 2018 www.massapicom. 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.