Examples of SignedInfo


Examples of javax.xml.crypto.dsig.SignedInfo

        return ref;
    }

    private static SignedInfo initSignedInfo(XMLSignatureFactory fac) throws Exception {
        Reference ref = initReference(fac);
        SignedInfo si = fac.newSignedInfo(fac.newCanonicalizationMethod(CanonicalizationMethod.EXCLUSIVE, (C14NMethodParameterSpec) null), fac.newSignatureMethod(SignatureMethod.DSA_SHA1, null), Collections.singletonList(ref));
        return si;
    }

Examples of org.apache.juddi.model.SignedInfo

            apiSignatureList.clear();
            for (org.apache.juddi.model.Signature modelSig : signatureList) {
                SignatureType apiSignature = new SignatureType();
                apiSignature.setId(modelSig.getXmlID());
               
                SignedInfo modelSignedInfo = modelSig.getSignedInfo();
                SignedInfoType apiSignedInfoType = new SignedInfoType();
                apiSignature.setSignedInfo(apiSignedInfoType);
                // Canonicalization method
                CanonicalizationMethod modelCanonMethod = modelSignedInfo.getCanonicalizationMethod();
                CanonicalizationMethodType apiCanonMethod = new CanonicalizationMethodType();
                apiCanonMethod.setAlgorithm(modelCanonMethod.getAlgorithm());
                apiSignedInfoType.setCanonicalizationMethod(apiCanonMethod);
               
                // Signature Method
                String sigAlg = modelSignedInfo.getSignatureMethod().getAlgorithm();
                SignatureMethodType apiSigMethod = new SignatureMethodType();
                apiSigMethod.setAlgorithm(sigAlg);
                apiSignedInfoType.setSignatureMethod(apiSigMethod);
               
                // References
                List<Reference> modelReferenceList = modelSignedInfo.getReference();
                List<ReferenceType> apiReferenceList = apiSignedInfoType.getReference();
                for (Reference modelRef : modelReferenceList) {
                    ReferenceType apiRef = new ReferenceType();
                    String refUri = modelRef.getUri();
                    if (refUri == null) {

Examples of org.apache.juddi.model.SignedInfo

            modelSignatures.clear();
            for (org.w3._2000._09.xmldsig_.SignatureType signatureType : apiSignatures) {
                Signature modelSignature = new Signature();
               
                org.w3._2000._09.xmldsig_.SignedInfoType apiSignedInfo = signatureType.getSignedInfo();
                SignedInfo modelSignedInfo = new SignedInfo();
                modelSignature.setSignedInfo(modelSignedInfo);
               
                String canonicalizationAlgMethod = apiSignedInfo.getCanonicalizationMethod().getAlgorithm();
                CanonicalizationMethod modelCanonMethod = new CanonicalizationMethod();
                modelSignedInfo.setCanonicalizationMethod(modelCanonMethod);
                modelCanonMethod.setAlgorithm(canonicalizationAlgMethod);
               
                SignatureMethod modelSigMethod = new SignatureMethod();
                modelSignedInfo.setSignatureMethod(modelSigMethod);
                String sigMethod = apiSignedInfo.getSignatureMethod().getAlgorithm();
                modelSigMethod.setAlgorithm(sigMethod);
               
                List<org.w3._2000._09.xmldsig_.ReferenceType> apiReferenceList = apiSignedInfo.getReference();
                for (org.w3._2000._09.xmldsig_.ReferenceType apiReference : apiReferenceList) {
                    Reference ref = mapReference(modelSignedInfo, apiReference);
                    modelSignedInfo.getReference().add(ref);
                }
               
                modelSignedInfo.setCanonicalizationMethod(modelCanonMethod);
               
                org.w3._2000._09.xmldsig_.SignatureValueType apiSignatureValue = signatureType.getSignatureValue();
                SignatureValue modelSignatureValue = new SignatureValue();
                byte[] signatureValueBytes = apiSignatureValue.getValue();
                String signatureValueXmlID = apiSignatureValue.getId();

Examples of org.apache.xml.security.signature.SignedInfo

        Reference ref = null;
        try {
            XMLSignature signature = new XMLSignature(signatureElement, "", true);
           
            if (sigProps != null) {
                SignedInfo sInfo = signature.getSignedInfo();
                if (sigProps.getSignatureAlgo() != null
                    && !sigProps.getSignatureAlgo().equals(sInfo.getSignatureMethodURI())) {
                    throwFault("Signature Algorithm is not supported", null);
                }
                if (sigProps.getSignatureC14Method() != null
                    && !sigProps.getSignatureC14Method().equals(sInfo.getCanonicalizationMethodURI())) {
                    throwFault("Signature Algorithm is not supported", null);
                }
            }
           
            ref = getReference(signature);

Examples of org.apache.xml.security.signature.SignedInfo

                /*
                     * Now dig into the Signature element to get the elements that
                     * this Signature covers. Build the QName of these Elements and
                     * return them to caller
                     */
                SignedInfo si = sig.getSignedInfo();
                int numReferences = si.getLength();
                Vector qvec = new Vector(numReferences);
                for (int i = 0; i < numReferences; i++) {
                    Reference siRef;
                    try {
                        siRef = si.item(i);
                    } catch (XMLSecurityException e3) {
                        throw new WSSecurityException(
                                WSSecurityException.FAILED_CHECK);
                    }
                    String uri = siRef.getURI();

Examples of org.apache.xml.security.signature.SignedInfo

                /*
                     * Now dig into the Signature element to get the elements that
                     * this Signature covers. Build the QName of these Elements and
                     * return them to caller
                     */
                SignedInfo si = sig.getSignedInfo();
                int numReferences = si.getLength();
                for (int i = 0; i < numReferences; i++) {
                    Reference siRef;
                    try {
                        siRef = si.item(i);
                    } catch (XMLSecurityException e3) {
                        throw new WSSecurityException(
                                WSSecurityException.FAILED_CHECK);
                    }
                    String uri = siRef.getURI();

Examples of org.apache.xml.security.signature.SignedInfo

        Reference ref = null;
        try {
            XMLSignature signature = new XMLSignature(signatureElement, "", true);
           
            if (sigProps != null) {
                SignedInfo sInfo = signature.getSignedInfo();
                if (sigProps.getSignatureAlgo() != null
                    && !sigProps.getSignatureAlgo().equals(sInfo.getSignatureMethodURI())) {
                    throwFault("Signature Algorithm is not supported", null);
                }
                if (sigProps.getSignatureC14nMethod() != null
                    && !sigProps.getSignatureC14nMethod().equals(sInfo.getCanonicalizationMethodURI())) {
                    throwFault("Signature C14n Algorithm is not supported", null);
                }
            }
           
            ref = getReference(signature);

Examples of org.apache.xml.security.signature.SignedInfo

                //
                // Now dig into the Signature element to get the elements that
                // this Signature covers. Build the QName of these Elements and
                // return them to caller
                //
                SignedInfo si = sig.getSignedInfo();
                int numReferences = si.getLength();
                for (int i = 0; i < numReferences; i++) {
                    Reference siRef;
                    try {
                        siRef = si.item(i);
                    } catch (XMLSecurityException e3) {
                        throw new WSSecurityException(
                            WSSecurityException.FAILED_CHECK, null, null, e3
                        );
                    }
                    String uri = siRef.getURI();
                    if (uri != null && !"".equals(uri)) {
                       
                        Element se = null;
                        try {
                            Transforms transforms = siRef.getTransforms();
                            for (int j = 0; j < transforms.getLength(); j++) {
                                Transform transform = transforms.item(j);
                                // We have some transforming to do before we can
                                // determine the protected element.
                                if (STRTransform.implementedTransformURI
                                        .equals(transform.getURI())) {
                                   
                                    XMLSignatureInput signatureInput =
                                        siRef.getContentsBeforeTransformation();
                                   
                                    if (signatureInput.isElement()) {
                                        // The signature was already validated,
                                        // meaning that this element was already
                                        // parsed.  We can therefore be pretty
                                        // confident that this constructor will work.
                                        SecurityTokenReference secTokenRef =
                                            new SecurityTokenReference(
                                                    (Element) signatureInput.getSubNode());
                                       
                                        // Use the utility to extract the element (or
                                        // generate a new one in some cases) from the
                                        // message.
                                        se = STRTransformUtil.dereferenceSTR(
                                                transform.getDocument(),
                                                secTokenRef, wsDocInfo);
                                    } else {
                                        // The internal impl of Reference changed.
                                        // We expect it to return the signature input
                                        // based on a node/element.
                                        throw new WSSecurityException(
                                                WSSecurityException.FAILURE);
                                    }
                                }
                            }
                        }
                        catch (XMLSecurityException e) {
                            log.warn("Error processing signature coverage elements.", e);
                            throw new WSSecurityException(WSSecurityException.FAILURE);
                        }
                       
                        if (se == null) {
                            se = WSSecurityUtil.getElementByWsuId(elem.getOwnerDocument(), uri);
                        }
                        if (se == null) {
                            se = WSSecurityUtil.getElementByGenId(elem.getOwnerDocument(), uri);
                        }
                        if (se == null) {
                            throw new WSSecurityException(WSSecurityException.FAILED_CHECK);
                        }
                        WSDataRef ref = new WSDataRef(uri);
                        ref.setWsuId(uri);
                        ref.setName(new QName(se.getNamespaceURI(), se.getLocalName()));
                        ref.setProtectedElement(se);
                        ref.setXpath(ReferenceListProcessor.getXPath(se));
                        ref.setAlgorithm(si.getSignatureMethodURI());
                        ref.setDigestAlgorithm(siRef.getMessageDigestAlgorithm().getAlgorithmURI());
                        protectedElements.add(ref);
                        returnElements.add(WSSecurityUtil.getIDFromReference(uri));
                    } else {
                       // This is the case where the signed element is identified
                       // by a transform such as XPath filtering
                       // We add the complete reference element to the return
                       // elements
                       returnElements.add(siRef);
                    }
                }
               
                // Algorithms used for signature and c14n
                signatureMethod = si.getSignatureMethodURI();
                c14nMethod = si.getCanonicalizationMethodURI();
               
                if (certs != null) {
                    returnCert[0] = certs[0];
                    if (validateCertificateChain) {
                        certificates = certs;

Examples of org.apache.xml.security.signature.SignedInfo

                /*
                     * Now dig into the Signature element to get the elements that
                     * this Signature covers. Build the QName of these Elements and
                     * return them to caller
                     */
                SignedInfo si = sig.getSignedInfo();
                int numReferences = si.getLength();
                for (int i = 0; i < numReferences; i++) {
                    Reference siRef;
                    try {
                        siRef = si.item(i);
                    } catch (XMLSecurityException e3) {
                        throw new WSSecurityException(
                                WSSecurityException.FAILED_CHECK);
                    }
                    String uri = siRef.getURI();

Examples of org.apache.xml.security.signature.SignedInfo

      boolean signatureOk = false;
      signatureOk = sig.checkSignatureValue(secretKey);

      if (signatureOk) {
        signatureValue[0] = sig.getSignatureValue();
        SignedInfo si = sig.getSignedInfo();
        int numReferences = si.getLength();
        for (int i = 0; i < numReferences; i++) {
          Reference siRef;
          try {
            siRef = si.item(i);
          } catch (XMLSecurityException e3) {
            throw new WSSecurityException(6);
          }
          String uri = siRef.getURI();
          if (uri != null && !"".equals(uri)) {
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.