Package javax.xml.crypto.dsig

Examples of javax.xml.crypto.dsig.Reference


          + " at ds:Reference ";
      logger.log(Level.SEVERE, errorStr + " Empty or NULL ");
      throw new XWSSecurityException(errorStr);
    }
    for (int i = 0; i < referenceList.size(); i++) {
      Reference ref = referenceList.get(i);
      verifyTransforms(ref.getTransforms());
      verifyDigestMethod(ref.getDigestMethod());
    }
  }
View Full Code Here


        //  String dm = map.getProperty(SIGNATURE_OPTION_DIGEST_METHOD);
        //if (dm == null) {
        String dm = DigestMethod.SHA1;
        //}
        Reference ref = fac.newReference("", fac.newDigestMethod(dm, null), transformers, null, null);
        return ref;
    }
View Full Code Here

        Reference ref = fac.newReference("", fac.newDigestMethod(dm, null), transformers, null, null);
        return ref;
    }

    private SignedInfo initSignedInfo(XMLSignatureFactory fac) throws Exception {
        Reference ref = initReference(fac);
        SignedInfo si = fac.newSignedInfo(fac.newCanonicalizationMethod(CanonicalizationMethod.EXCLUSIVE,
                (C14NMethodParameterSpec) null),
                fac.newSignatureMethod(SignatureMethod.RSA_SHA1,
                null),
                Collections.singletonList(ref));
View Full Code Here

                String dm = map.getProperty(SIGNATURE_OPTION_DIGEST_METHOD);
                if (dm == null) {
                        dm = DigestMethod.SHA1;
                }
                Reference ref = fac.newReference("", fac.newDigestMethod(dm, null), transformers, null, null);
                return ref;
        }
View Full Code Here

                Reference ref = fac.newReference("", fac.newDigestMethod(dm, null), transformers, null, null);
                return ref;
        }

        private SignedInfo initSignedInfo(XMLSignatureFactory fac) throws Exception {
                Reference ref = initReference(fac);
                String cm = null;
                cm = map.getProperty(CANONICALIZATIONMETHOD);
                String sigmethod = null;
                sigmethod = map.getProperty(SIGNATURE_METHOD);
                if (sigmethod == null) {
View Full Code Here

                                // Check the validation status of each Reference.
                                @SuppressWarnings("unchecked")
                                Iterator<Reference> i = signature.getSignedInfo().getReferences().iterator();
                                //System.out.println("---------------------------------------------");
                                for (int j = 0; i.hasNext(); j++) {
                                        Reference ref = (Reference) i.next();
                                        boolean refValid = ref.validate(valContext);
                                        logger.debug(j);
                                        logger.debug("ref[" + j + "] validity status: " + refValid);
                                        if (!refValid) {
                                                OutReadableErrorMessage.set("signature reference " + j + " invalid. " + OutReadableErrorMessage.get());
                                        }
                                        logger.debug("Ref type: " + ref.getType() + ", URI: " + ref.getURI());
                                        for (Object xform : ref.getTransforms()) {
                                                logger.debug("Transform: " + xform);
                                        }
                                        String calcDigValStr = digestToString(ref.getCalculatedDigestValue());
                                        String expectedDigValStr = digestToString(ref.getDigestValue());
                                        logger.warn("    Calc Digest: " + calcDigValStr);
                                        logger.warn("Expected Digest: " + expectedDigValStr);
                                        if (!calcDigValStr.equalsIgnoreCase(expectedDigValStr)) {
                                                OutReadableErrorMessage.set("digest mismatch for signature ref " + j + "." + OutReadableErrorMessage.get());
                                        }
View Full Code Here

    protected List<? extends Reference> getReferences(XmlSignatureProperties.Input input, XmlSignatureProperties.Output properties,
            String keyInfoId) throws Exception { //NOPMD

        // Create Reference with URI="#<objectId>" for enveloping signature or URI="" for enveloped signature and the transforms
        Reference ref = createReference(input.getSignatureFactory(), getContentReferenceUri(input.getMessage()),
                getContentReferenceType(input.getMessage()));
        Reference keyInfoRef = createKeyInfoReference(input.getSignatureFactory(), keyInfoId, input.getContentDigestAlgorithm());

        int propsRefsSize = properties == null || properties.getReferences() == null || properties.getReferences().isEmpty() ? 0
                : properties.getReferences().size();
        int size = keyInfoRef == null ? propsRefsSize + 1 : propsRefsSize + 2;
        List<Reference> referenceList = new ArrayList<Reference>(size);
View Full Code Here

    protected Reference createReference(XMLSignatureFactory fac, String uri, String type) throws InvalidAlgorithmParameterException,
            XmlSignatureException {
        try {
            List<Transform> transforms = getTransforms(fac);
            Reference ref = fac.newReference(uri, fac.newDigestMethod(getDigestAlgorithmUri(), null), transforms, type, null);
            return ref;
        } catch (NoSuchAlgorithmException e) {
            throw new XmlSignatureException("Wrong algorithm specified in the configuration.", e);
        }
    }
View Full Code Here

    private void test_create_signature_enveloping(
        SignatureMethod sm, DigestMethod dm, KeyInfo ki, Key signingKey, KeySelector ks
    ) throws Exception {

        // create reference
        Reference ref = fac.newReference("#DSig.Object_1", dm, null,
                                         XMLObject.TYPE, null);

        // create SignedInfo
        SignedInfo si = fac.newSignedInfo(withoutComments, sm,
                                          Collections.singletonList(ref));
View Full Code Here

    protected List<? extends Reference> getReferences(XmlSignatureProperties.Input input, XmlSignatureProperties.Output properties,
            String keyInfoId) throws Exception { //NOPMD

        // Create Reference with URI="#<objectId>" for enveloping signature, URI="" for enveloped signature, and URI = <value from configuration> for detached signature and the transforms
        Reference ref = createReference(input.getSignatureFactory(), input.getContentReferenceUri(),
                getContentReferenceType(input.getMessage()), input.getSignatureType());
        Reference keyInfoRef = createKeyInfoReference(input.getSignatureFactory(), keyInfoId, input.getContentDigestAlgorithm());

        int propsRefsSize = properties == null || properties.getReferences() == null || properties.getReferences().isEmpty() ? 0
                : properties.getReferences().size();
        int size = keyInfoRef == null ? propsRefsSize + 1 : propsRefsSize + 2;
        List<Reference> referenceList = new ArrayList<Reference>(size);
View Full Code Here

TOP

Related Classes of javax.xml.crypto.dsig.Reference

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.