Package javax.xml.crypto.dsig

Examples of javax.xml.crypto.dsig.DigestMethod


        XMLSignatureFactory signatureFactory,
        WSSecHeader secHeader,
        WSSConfig wssConfig,
        String digestAlgo
    ) throws WSSecurityException {
        DigestMethod digestMethod;
        try {
            digestMethod = signatureFactory.newDigestMethod(digestAlgo, null);
        } catch (Exception ex) {
            log.error("", ex);
            throw new WSSecurityException(
View Full Code Here


    throws XMLSignatureException {
        // the references appear in the package signature or the package object
        // so we can use the default digest algorithm
        String digestMethodUri = signatureConfig.getDigestMethodUri();
        XMLSignatureFactory sigFac = signatureConfig.getSignatureFactory();
        DigestMethod digestMethod;
        try {
            digestMethod = sigFac.newDigestMethod(digestMethodUri, null);
        } catch (GeneralSecurityException e) {
            throw new XMLSignatureException("unknown digest method uri: "+digestMethodUri, e);
        }
View Full Code Here

        return reference;
    }
   
    // helper method ... will be removed soon
    public static void brokenJvmWorkaround(Reference reference) {
        DigestMethod digestMethod = reference.getDigestMethod();
        String digestMethodUri = digestMethod.getAlgorithm();
       
        // workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1155012
        // overwrite standard message digest, if a digest <> SHA1 is used
        Provider bcProv = Security.getProvider("BC");
        if (bcProv != null && !DigestMethod.SHA1.equals(digestMethodUri)) {
View Full Code Here

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

//     dsc.putNamespacePrefix(XMLSignature.XMLNS, "ds");
    
     DigestMethod digestMethodObj = fac.newDigestMethod(digestMethod, null);
     Transform transform = fac.newTransform(Transform.ENVELOPED,
           (TransformParameterSpec) null);
    
     List<Transform> transformList = Collections.singletonList(transform);
     Reference ref = fac.newReference
View Full Code Here

     PublicKey publicKey = keyPair.getPublic();
     
     DOMSignContext dsc = new DOMSignContext(signingKey, doc.getDocumentElement());  
//     dsc.putNamespacePrefix(XMLSignature.XMLNS, "ds");
    
     DigestMethod digestMethodObj = fac.newDigestMethod(digestMethod, null);
     Transform transform = fac.newTransform(Transform.ENVELOPED,
           (TransformParameterSpec) null);
    
     List<Transform> transformList = Collections.singletonList(transform);
     Reference ref = fac.newReference
View Full Code Here

        Certificate[] chain = privateKeyEntry.getChain();
        X509Certificate certificate = (X509Certificate) chain[0];
        PublicKey publicKey = certificate.getPublicKey();

        String digestType = this.getDigestMethodName(certificate.getSigAlgName());
        DigestMethod digestMethod = this.xmlSignatureFactory.newDigestMethod(digestType, null);
        List<Transform> transforms = Collections.singletonList(this.xmlSignatureFactory.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null));
        Reference reference = this.xmlSignatureFactory.newReference(XMLSigner.REFERENCE_URI, digestMethod, transforms, null, null);

        CanonicalizationMethod canonicalizationMethod = this.xmlSignatureFactory.newCanonicalizationMethod(CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS, (C14NMethodParameterSpec) null);
        SignatureMethod signatureMethod = this.xmlSignatureFactory.newSignatureMethod(this.getSignatureDigestName(certificate.getSigAlgName()), null);
View Full Code Here

        Certificate[] chain = privateKeyEntry.getChain();
        X509Certificate certificate = (X509Certificate) chain[0];
        PublicKey publicKey = certificate.getPublicKey();

        String digestType = this.getDigestMethodName(certificate.getSigAlgName());
        DigestMethod digestMethod = this.xmlSignatureFactory.newDigestMethod(digestType, null);
        List<Transform> transforms = Collections.singletonList(this.xmlSignatureFactory.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null));
        Reference reference = this.xmlSignatureFactory.newReference(XMLSigner.REFERENCE_URI, digestMethod, transforms, null, null);

        CanonicalizationMethod canonicalizationMethod = this.xmlSignatureFactory.newCanonicalizationMethod(CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS, (C14NMethodParameterSpec) null);
        SignatureMethod signatureMethod = this.xmlSignatureFactory.newSignatureMethod(this.getSignatureDigestName(certificate.getSigAlgName()), null);
View Full Code Here

        PrivateKey privateKey = identity.getPrivateKey();
        Certificate[] chain = identity.getChain();
        X509Certificate certificate = (X509Certificate) chain[0];
        PublicKey publicKey = certificate.getPublicKey();

        DigestMethod digestMethod = this.xmlSignatureFactory.newDigestMethod(DigestMethod.SHA1, null);
        List<Transform> transforms = Collections.singletonList(this.xmlSignatureFactory.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null));
        Reference reference = this.xmlSignatureFactory.newReference(XMLSigner.REFERENCE_URI, digestMethod, transforms, null, null);

        CanonicalizationMethod canonicalizationMethod = this.xmlSignatureFactory.newCanonicalizationMethod(CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS, (C14NMethodParameterSpec) null);
        SignatureMethod signatureMethod = this.xmlSignatureFactory.newSignatureMethod(SignatureMethod.RSA_SHA1, null);
View Full Code Here

        XMLSignatureFactory signatureFactory,
        WSSecHeader secHeader,
        WSSConfig wssConfig,
        String digestAlgo
    ) throws WSSecurityException {
        DigestMethod digestMethod;
        try {
            digestMethod = signatureFactory.newDigestMethod(digestAlgo, null);
        } catch (Exception ex) {
            LOG.error("", ex);
            throw new WSSecurityException(
View Full Code Here

    private static void signImpl(DOMSignContext dsc, String digestMethod, String signatureMethod, String referenceURI, PublicKey publicKey,
                                 X509Certificate x509Certificate)
            throws GeneralSecurityException, MarshalException, XMLSignatureException {
        dsc.setDefaultNamespacePrefix("dsig");

        DigestMethod digestMethodObj = fac.newDigestMethod(digestMethod, null);
        Transform transform1 = fac.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null);
        Transform transform2 = fac.newTransform("http://www.w3.org/2001/10/xml-exc-c14n#", (TransformParameterSpec) null);

        List<Transform> transformList = new ArrayList<Transform>();
        transformList.add(transform1);
View Full Code Here

TOP

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

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.