Examples of DOMSignContext


Examples of javax.xml.crypto.dsig.dom.DOMSignContext

        // create XMLSignature
        XMLSignature sig = fac.newXMLSignature
        (si, ki, Collections.singletonList(obj), null, null);

        DOMSignContext dsc = new DOMSignContext(signingKey, doc);
        dsc.setDefaultNamespacePrefix("dsig");

        sig.sign(dsc);
       
        // XMLUtils.outputDOM(doc.getDocumentElement(), System.out);
View Full Code Here

Examples of javax.xml.crypto.dsig.dom.DOMSignContext

                ki = kifac.newKeyInfo(Collections.singletonList
                    (kifac.newKeyName("testuser")));
            }
            sig = fac.newXMLSignature(si, ki, objs, id, sigValueId);
            Document doc = TestUtils.newDocument();
            signContext = new DOMSignContext(SIGN_KEYS[i], doc);
            signContext.setURIDereferencer(ud);
            sig.sign(signContext);
            validateContext = new DOMValidateContext
                (VALIDATE_KEYS[i], doc.getDocumentElement());
            validateContext.setURIDereferencer(ud);
View Full Code Here

Examples of javax.xml.crypto.dsig.dom.DOMSignContext

                ki = kifac.newKeyInfo(Collections.singletonList
                    (kifac.newKeyName("testuser")));
            }
            sig = fac.newXMLSignature(si, ki, objs, id, sigValueId);
            Document doc = TestUtils.newDocument();
            signContext = new DOMSignContext(SIGN_KEYS[i], doc);
            signContext.setProperty
                ("org.jcp.xml.dsig.internal.dom.SignatureProvider", p);
            signContext.setURIDereferencer(ud);
            try {
                sig.sign(signContext);
View Full Code Here

Examples of javax.xml.crypto.dsig.dom.DOMSignContext

        SignedInfo si = createSignedInfo(SIG_METHODS[1]);
        KeyInfo  ki = kifac.newKeyInfo(Collections.singletonList
                    (kifac.newKeyValue((PublicKey) VALIDATE_KEYS[1])));
        XMLSignature sig = fac.newXMLSignature(si, ki, objs, id, sigValueId);
        Document doc = TestUtils.newDocument();
        XMLSignContext signContext = new DOMSignContext(SIGN_KEYS[1], doc);
        signContext.putNamespacePrefix(XMLSignature.XMLNS, "");
        signContext.setURIDereferencer(ud);
        sig.sign(signContext);
/*
        StringWriter sw = new StringWriter();
        dumpDocument(doc, sw);
        System.out.println(sw);
View Full Code Here

Examples of javax.xml.crypto.dsig.dom.DOMSignContext

        KeyInfo  ki = kifac.newKeyInfo(Collections.singletonList
                    (kifac.newKeyValue((PublicKey) VALIDATE_KEYS[1])));

        // create XMLSignature
        XMLSignature sig = fac.newXMLSignature(si, ki, objs, "signature", null);
        DOMSignContext dsc = new DOMSignContext(SIGN_KEYS[1], doc);

        sig.sign(dsc);

/*
        StringWriter sw = new StringWriter();
View Full Code Here

Examples of javax.xml.crypto.dsig.dom.DOMSignContext

            (signature.getSignedInfo(), null, signature.getObjects(),
             signature.getId(), signature.getSignatureValue().getId());

        // Sign the template
        Node parent = domSignature.getNode().getParentNode();
        DOMSignContext signContext = new DOMSignContext(SIGN_KEYS[0], parent);
        // remove the signature node (since it will get recreated)
        parent.removeChild(domSignature.getNode());
        newSignature.sign(signContext);

        // check that Object element retained namespace definitions
View Full Code Here

Examples of javax.xml.crypto.dsig.dom.DOMSignContext

        // create XMLSignature
        XMLSignature sig = fac.newXMLSignature(si, ki,
                                               Collections.singletonList(obj),
                                               "signature", null);
        DOMSignContext dsc = new DOMSignContext(SIGN_KEYS[1], doc);
        sig.sign(dsc);
    }
View Full Code Here

Examples of javax.xml.crypto.dsig.dom.DOMSignContext

        KeyInfo ki = kifac.newKeyInfo(Collections.singletonList
            (kifac.newKeyValue((PublicKey)TestUtils.getPublicKey("DSA", 2048))));
        XMLSignature sig = fac.newXMLSignature(si, ki, objs, id, sigValueId);
        Document doc = TestUtils.newDocument();
        XMLSignContext signContext =
            new DOMSignContext(TestUtils.getPrivateKey("DSA", 2048), doc);
        signContext.setURIDereferencer(ud);
        sig.sign(signContext);
        XMLValidateContext validateContext = new DOMValidateContext
            (TestUtils.getPublicKey("DSA", 2048), doc.getDocumentElement());
        validateContext.setURIDereferencer(ud);
        assertTrue(sig.validate(validateContext));
View Full Code Here

Examples of javax.xml.crypto.dsig.dom.DOMSignContext

    ki = kifac.newKeyInfo(Collections.singletonList
        (kifac.newKeyName("testuser")));
      }
      sig = fac.newXMLSignature(si, ki, objs, id, sigValueId);
      Document doc = TestUtils.newDocument();
      signContext = new DOMSignContext(SIGN_KEYS[i], doc);
      sig.sign(signContext);
      validateContext = new DOMValidateContext
    (VALIDATE_KEYS[i], doc.getDocumentElement());
      if (sig.validate(validateContext) == false) {
    status = false;
View Full Code Here

Examples of javax.xml.crypto.dsig.dom.DOMSignContext

    ki = kifac.newKeyInfo(Collections.singletonList
        (kifac.newKeyName("testuser")));
      }
      sig = fac.newXMLSignature(si, ki, objs, id, sigValueId);
      Document doc = TestUtils.newDocument();
      signContext = new DOMSignContext(SIGN_KEYS[i], doc);
      signContext.setProperty
    ("org.jcp.xml.dsig.internal.dom.SignatureProvider", p);
      try {
          sig.sign(signContext);
          fail("Should have failed because TestProvider does not " +
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.