Package org.opensaml.xml.signature

Examples of org.opensaml.xml.signature.X509Digest


         * @param cert the certificate being processed
         */
        protected void processCertX509Digest(X509Data x509Data, java.security.cert.X509Certificate cert) {
            if (options.emitX509Digest) {
                try {
                    X509Digest xmlDigest = KeyInfoHelper.buildX509Digest(cert, options.x509DigestAlgorithmURI);
                    if (xmlDigest != null) {
                        x509Data.getXMLObjects(X509Digest.DEFAULT_ELEMENT_NAME).add(xmlDigest);
                    }
                } catch (CertificateEncodingException e) {
                    // TODO: should wrap in SecurityException once API can be changed
View Full Code Here


       
        for (XMLObject xo : digests) {
            if (!(xo instanceof X509Digest)) {
                continue;
            }
            X509Digest digest = (X509Digest) xo;
            if (!DatatypeHelper.isEmpty(digest.getValue())) {
                xmlValue = Base64.decode(digest.getValue());
                for (X509Certificate cert : certs) {
                    try {
                        certValue = X509Util.getX509Digest(cert, digest.getAlgorithm());
                        if (certValue != null && Arrays.equals(xmlValue, certValue)) {
                            return cert;
                        }
                    } catch (SecurityException e) {
                        // Ignore as no match.
View Full Code Here

            throw new NoSuchAlgorithmException("No JCE algorithm found for " + algorithmURI);
        }
        MessageDigest md = MessageDigest.getInstance(jceAlg);
        byte[] hash = md.digest(javaCert.getEncoded());
       
        X509Digest xmlDigest = (X509Digest) Configuration.getBuilderFactory()
            .getBuilder(X509Digest.DEFAULT_ELEMENT_NAME)
            .buildObject(X509Digest.DEFAULT_ELEMENT_NAME);
        xmlDigest.setAlgorithm(algorithmURI);
        xmlDigest.setValue(Base64.encodeBytes(hash));
       
        return xmlDigest;
    }
View Full Code Here

*/
public class X509DigestMarshaller extends XSBase64BinaryMarshaller {

    /** {@inheritDoc} */
    protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
        X509Digest xd = (X509Digest) xmlObject;

        if (xd.getAlgorithm() != null) {
            domElement.setAttributeNS(null, X509Digest.ALGORITHM_ATTRIB_NAME, xd.getAlgorithm());
        }
    }
View Full Code Here

*/
public class X509DigestUnmarshaller extends XSBase64BinaryUnmarshaller {

    /** {@inheritDoc} */
    protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
        X509Digest xd = (X509Digest) xmlObject;

        if (attribute.getLocalName().equals(X509Digest.ALGORITHM_ATTRIB_NAME)) {
            xd.setAlgorithm(attribute.getValue());
        } else {
            super.processAttribute(xmlObject, attribute);
        }
    }
View Full Code Here

TOP

Related Classes of org.opensaml.xml.signature.X509Digest

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.