com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput Java Examples

The following examples show how to use com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TransformC14NWithComments.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** @inheritDoc */
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transformObject
) throws CanonicalizationException {

    Canonicalizer20010315WithComments c14n = new Canonicalizer20010315WithComments();
    if (os != null) {
        c14n.setWriter(os);
    }

    byte[] result = null;
    result = c14n.engineCanonicalize(input);
    XMLSignatureInput output = new XMLSignatureInput(result);
    if (os != null) {
        output.setOutputStream(os);
    }
    return output;
}
 
Example #2
Source File: RetrievalMethodResolver.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Resolves the input from the given retrieval method
 * @return
 * @throws XMLSecurityException
 */
private static XMLSignatureInput resolveInput(
    RetrievalMethod rm, String baseURI, boolean secureValidation
) throws XMLSecurityException {
    Attr uri = rm.getURIAttr();
    // Apply the transforms
    Transforms transforms = rm.getTransforms();
    ResourceResolver resRes = ResourceResolver.getInstance(uri, baseURI, secureValidation);
    XMLSignatureInput resource = resRes.resolve(uri, baseURI, secureValidation);
    if (transforms != null) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "We have Transforms");
        }
        resource = transforms.performTransforms(resource);
    }
    return resource;
}
 
Example #3
Source File: TransformC14NWithComments.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/** @inheritDoc */
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transformObject
) throws CanonicalizationException {

    Canonicalizer20010315WithComments c14n = new Canonicalizer20010315WithComments();
    if (os != null) {
        c14n.setWriter(os);
    }

    byte[] result = null;
    result = c14n.engineCanonicalize(input);
    XMLSignatureInput output = new XMLSignatureInput(result);
    if (os != null) {
        output.setOutputStream(os);
    }
    return output;
}
 
Example #4
Source File: RetrievalMethodResolver.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Resolves the input from the given retrieval method
 * @return
 * @throws XMLSecurityException
 */
private static XMLSignatureInput resolveInput(
    RetrievalMethod rm, String baseURI, boolean secureValidation
) throws XMLSecurityException {
    Attr uri = rm.getURIAttr();
    // Apply the transforms
    Transforms transforms = rm.getTransforms();
    ResourceResolver resRes = ResourceResolver.getInstance(uri, baseURI, secureValidation);
    XMLSignatureInput resource = resRes.resolve(uri, baseURI, secureValidation);
    if (transforms != null) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "We have Transforms");
        }
        resource = transforms.performTransforms(resource);
    }
    return resource;
}
 
Example #5
Source File: TransformC14N11_WithComments.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transform
) throws CanonicalizationException {

    Canonicalizer11_WithComments c14n = new Canonicalizer11_WithComments();
    if (os != null) {
        c14n.setWriter(os);
    }

    byte[] result = null;
    result = c14n.engineCanonicalize(input);
    XMLSignatureInput output = new XMLSignatureInput(result);
    if (os != null) {
        output.setOutputStream(os);
    }
    return output;
}
 
Example #6
Source File: TransformC14N11_WithComments.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transform
) throws CanonicalizationException {

    Canonicalizer11_WithComments c14n = new Canonicalizer11_WithComments();
    if (os != null) {
        c14n.setWriter(os);
    }

    byte[] result = null;
    result = c14n.engineCanonicalize(input);
    XMLSignatureInput output = new XMLSignatureInput(result);
    if (os != null) {
        output.setOutputStream(os);
    }
    return output;
}
 
Example #7
Source File: TransformC14NExclusiveWithComments.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transformObject
) throws CanonicalizationException {
    try {
        String inclusiveNamespaces = null;

        if (transformObject.length(
            InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
            InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES) == 1
        ) {
            Element inclusiveElement =
                XMLUtils.selectNode(
                    transformObject.getElement().getFirstChild(),
                    InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
                    InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES,
                    0
                );

            inclusiveNamespaces =
                new InclusiveNamespaces(
                    inclusiveElement, transformObject.getBaseURI()
                ).getInclusiveNamespaces();
        }

        Canonicalizer20010315ExclWithComments c14n =
            new Canonicalizer20010315ExclWithComments();
        if (os != null) {
            c14n.setWriter(os);
        }
        byte[] result = c14n.engineCanonicalize(input, inclusiveNamespaces);
        XMLSignatureInput output = new XMLSignatureInput(result);

        return output;
    } catch (XMLSecurityException ex) {
        throw new CanonicalizationException("empty", ex);
    }
}
 
Example #8
Source File: TransformC14N11.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transform
) throws CanonicalizationException {
    Canonicalizer11_OmitComments c14n = new Canonicalizer11_OmitComments();
    if (os != null) {
        c14n.setWriter(os);
    }
    byte[] result = null;
    result = c14n.engineCanonicalize(input);
    XMLSignatureInput output = new XMLSignatureInput(result);
    if (os != null) {
        output.setOutputStream(os);
    }
    return output;
}
 
Example #9
Source File: Canonicalizer11.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected void circumventBugIfNeeded(XMLSignatureInput input)
    throws CanonicalizationException, ParserConfigurationException,
    IOException, SAXException {
    if (!input.isNeedsToBeExpanded()) {
        return;
    }
    Document doc = null;
    if (input.getSubNode() != null) {
        doc = XMLUtils.getOwnerDocument(input.getSubNode());
    } else {
        doc = XMLUtils.getOwnerDocument(input.getNodeSet());
    }
    XMLUtils.circumventBug2650(doc);
}
 
Example #10
Source File: RetrievalMethodResolver.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static X509Certificate getRawCertificate(XMLSignatureInput resource)
    throws CanonicalizationException, IOException, CertificateException {
    byte inputBytes[] = resource.getBytes();
    // if the resource stores a raw certificate, we have to handle it
    CertificateFactory certFact =
        CertificateFactory.getInstance(XMLX509Certificate.JCA_CERT_ID);
    X509Certificate cert = (X509Certificate)
        certFact.generateCertificate(new ByteArrayInputStream(inputBytes));
    return cert;
}
 
Example #11
Source File: RetrievalMethodResolver.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static X509Certificate getRawCertificate(XMLSignatureInput resource)
    throws CanonicalizationException, IOException, CertificateException {
    byte inputBytes[] = resource.getBytes();
    // if the resource stores a raw certificate, we have to handle it
    CertificateFactory certFact =
        CertificateFactory.getInstance(XMLX509Certificate.JCA_CERT_ID);
    X509Certificate cert = (X509Certificate)
        certFact.generateCertificate(new ByteArrayInputStream(inputBytes));
    return cert;
}
 
Example #12
Source File: RetrievalMethodResolver.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static X509Certificate getRawCertificate(XMLSignatureInput resource)
    throws CanonicalizationException, IOException, CertificateException {
    byte inputBytes[] = resource.getBytes();
    // if the resource stores a raw certificate, we have to handle it
    CertificateFactory certFact =
        CertificateFactory.getInstance(XMLX509Certificate.JCA_CERT_ID);
    X509Certificate cert = (X509Certificate)
        certFact.generateCertificate(new ByteArrayInputStream(inputBytes));
    return cert;
}
 
Example #13
Source File: Canonicalizer20010315.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
protected void circumventBugIfNeeded(XMLSignatureInput input)
    throws CanonicalizationException, ParserConfigurationException, IOException, SAXException {
    if (!input.isNeedsToBeExpanded()) {
        return;
    }
    Document doc = null;
    if (input.getSubNode() != null) {
        doc = XMLUtils.getOwnerDocument(input.getSubNode());
    } else {
        doc = XMLUtils.getOwnerDocument(input.getNodeSet());
    }
    XMLUtils.circumventBug2650(doc);
}
 
Example #14
Source File: TransformC14N11.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transform
) throws CanonicalizationException {
    Canonicalizer11_OmitComments c14n = new Canonicalizer11_OmitComments();
    if (os != null) {
        c14n.setWriter(os);
    }
    byte[] result = null;
    result = c14n.engineCanonicalize(input);
    XMLSignatureInput output = new XMLSignatureInput(result);
    if (os != null) {
        output.setOutputStream(os);
    }
    return output;
}
 
Example #15
Source File: TransformXPointer.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Method enginePerformTransform
 *
 * @param input
 * @return  {@link XMLSignatureInput} as the result of transformation
 * @throws TransformationException
 */
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transformObject
) throws TransformationException {

    Object exArgs[] = { implementedTransformURI };

    throw new TransformationException("signature.Transform.NotYetImplemented", exArgs);
}
 
Example #16
Source File: RetrievalMethodResolver.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static X509Certificate getRawCertificate(XMLSignatureInput resource)
    throws CanonicalizationException, IOException, CertificateException {
    byte inputBytes[] = resource.getBytes();
    // if the resource stores a raw certificate, we have to handle it
    CertificateFactory certFact =
        CertificateFactory.getInstance(XMLX509Certificate.JCA_CERT_ID);
    X509Certificate cert = (X509Certificate)
        certFact.generateCertificate(new ByteArrayInputStream(inputBytes));
    return cert;
}
 
Example #17
Source File: KeyInfoReferenceResolver.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Resolve the KeyInfoReference Element's URI attribute into a KeyInfo instance.
 *
 * @param element
 * @param baseURI
 * @param storage
 * @return the KeyInfo which is referred to by this KeyInfoReference, or null if can not be resolved
 * @throws XMLSecurityException
 */
private KeyInfo resolveReferentKeyInfo(Element element, String baseURI, StorageResolver storage) throws XMLSecurityException {
    KeyInfoReference reference = new KeyInfoReference(element, baseURI);
    Attr uriAttr = reference.getURIAttr();

    XMLSignatureInput resource = resolveInput(uriAttr, baseURI, secureValidation);

    Element referentElement = null;
    try {
        referentElement = obtainReferenceElement(resource);
    } catch (Exception e) {
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "XMLSecurityException", e);
        }
        return null;
    }

    if (referentElement == null) {
        log.log(java.util.logging.Level.FINE, "De-reference of KeyInfoReference URI returned null: " + uriAttr.getValue());
        return null;
    }

    validateReference(referentElement);

    KeyInfo referent = new KeyInfo(referentElement, baseURI);
    referent.addStorageResolver(storage);
    return referent;
}
 
Example #18
Source File: DOMReference.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static Data copyDerefData(Data dereferencedData) {
    if (dereferencedData instanceof ApacheData) {
        // need to make a copy of the Data
        ApacheData ad = (ApacheData)dereferencedData;
        XMLSignatureInput xsi = ad.getXMLSignatureInput();
        if (xsi.isNodeSet()) {
            try {
                final Set<Node> s = xsi.getNodeSet();
                return new NodeSetData() {
                    public Iterator<Node> iterator() { return s.iterator(); }
                };
            } catch (Exception e) {
                // log a warning
                log.log(java.util.logging.Level.WARNING, "cannot cache dereferenced data: " + e);
                return null;
            }
        } else if (xsi.isElement()) {
            return new DOMSubTreeData
                (xsi.getSubNode(), xsi.isExcludeComments());
        } else if (xsi.isOctetStream() || xsi.isByteArray()) {
            try {
                return new OctetStreamData
                    (xsi.getOctetStream(), xsi.getSourceURI(),
                     xsi.getMIMEType());
            } catch (IOException ioe) {
                // log a warning
                log.log(java.util.logging.Level.WARNING, "cannot cache dereferenced data: " + ioe);
                return null;
            }
        }
    }
    return dereferencedData;
}
 
Example #19
Source File: TransformC14NExclusiveWithComments.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transformObject
) throws CanonicalizationException {
    try {
        String inclusiveNamespaces = null;

        if (transformObject.length(
            InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
            InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES) == 1
        ) {
            Element inclusiveElement =
                XMLUtils.selectNode(
                    transformObject.getElement().getFirstChild(),
                    InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
                    InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES,
                    0
                );

            inclusiveNamespaces =
                new InclusiveNamespaces(
                    inclusiveElement, transformObject.getBaseURI()
                ).getInclusiveNamespaces();
        }

        Canonicalizer20010315ExclWithComments c14n =
            new Canonicalizer20010315ExclWithComments();
        if (os != null) {
            c14n.setWriter(os);
        }
        byte[] result = c14n.engineCanonicalize(input, inclusiveNamespaces);
        XMLSignatureInput output = new XMLSignatureInput(result);

        return output;
    } catch (XMLSecurityException ex) {
        throw new CanonicalizationException("empty", ex);
    }
}
 
Example #20
Source File: TransformC14NExclusiveWithComments.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transformObject
) throws CanonicalizationException {
    try {
        String inclusiveNamespaces = null;

        if (transformObject.length(
            InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
            InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES) == 1
        ) {
            Element inclusiveElement =
                XMLUtils.selectNode(
                    transformObject.getElement().getFirstChild(),
                    InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
                    InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES,
                    0
                );

            inclusiveNamespaces =
                new InclusiveNamespaces(
                    inclusiveElement, transformObject.getBaseURI()
                ).getInclusiveNamespaces();
        }

        Canonicalizer20010315ExclWithComments c14n =
            new Canonicalizer20010315ExclWithComments();
        if (os != null) {
            c14n.setWriter(os);
        }
        byte[] result = c14n.engineCanonicalize(input, inclusiveNamespaces);
        XMLSignatureInput output = new XMLSignatureInput(result);

        return output;
    } catch (XMLSecurityException ex) {
        throw new CanonicalizationException("empty", ex);
    }
}
 
Example #21
Source File: DOMReference.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static Data copyDerefData(Data dereferencedData) {
    if (dereferencedData instanceof ApacheData) {
        // need to make a copy of the Data
        ApacheData ad = (ApacheData)dereferencedData;
        XMLSignatureInput xsi = ad.getXMLSignatureInput();
        if (xsi.isNodeSet()) {
            try {
                final Set<Node> s = xsi.getNodeSet();
                return new NodeSetData() {
                    public Iterator iterator() { return s.iterator(); }
                };
            } catch (Exception e) {
                // log a warning
                log.log(java.util.logging.Level.WARNING, "cannot cache dereferenced data: " + e);
                return null;
            }
        } else if (xsi.isElement()) {
            return new DOMSubTreeData
                (xsi.getSubNode(), xsi.isExcludeComments());
        } else if (xsi.isOctetStream() || xsi.isByteArray()) {
            try {
                return new OctetStreamData
                    (xsi.getOctetStream(), xsi.getSourceURI(),
                     xsi.getMIMEType());
            } catch (IOException ioe) {
                // log a warning
                log.log(java.util.logging.Level.WARNING, "cannot cache dereferenced data: " + ioe);
                return null;
            }
        }
    }
    return dereferencedData;
}
 
Example #22
Source File: RetrievalMethodResolver.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static X509Certificate getRawCertificate(XMLSignatureInput resource)
    throws CanonicalizationException, IOException, CertificateException {
    byte inputBytes[] = resource.getBytes();
    // if the resource stores a raw certificate, we have to handle it
    CertificateFactory certFact =
        CertificateFactory.getInstance(XMLX509Certificate.JCA_CERT_ID);
    X509Certificate cert = (X509Certificate)
        certFact.generateCertificate(new ByteArrayInputStream(inputBytes));
    return cert;
}
 
Example #23
Source File: TransformC14NExclusiveWithComments.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transformObject
) throws CanonicalizationException {
    try {
        String inclusiveNamespaces = null;

        if (transformObject.length(
            InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
            InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES) == 1
        ) {
            Element inclusiveElement =
                XMLUtils.selectNode(
                    transformObject.getElement().getFirstChild(),
                    InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
                    InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES,
                    0
                );

            inclusiveNamespaces =
                new InclusiveNamespaces(
                    inclusiveElement, transformObject.getBaseURI()
                ).getInclusiveNamespaces();
        }

        Canonicalizer20010315ExclWithComments c14n =
            new Canonicalizer20010315ExclWithComments();
        if (os != null) {
            c14n.setWriter(os);
        }
        byte[] result = c14n.engineCanonicalize(input, inclusiveNamespaces);
        XMLSignatureInput output = new XMLSignatureInput(result);

        return output;
    } catch (XMLSecurityException ex) {
        throw new CanonicalizationException("empty", ex);
    }
}
 
Example #24
Source File: RetrievalMethodResolver.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static X509Certificate getRawCertificate(XMLSignatureInput resource)
    throws CanonicalizationException, IOException, CertificateException {
    byte inputBytes[] = resource.getBytes();
    // if the resource stores a raw certificate, we have to handle it
    CertificateFactory certFact =
        CertificateFactory.getInstance(XMLX509Certificate.JCA_CERT_ID);
    X509Certificate cert = (X509Certificate)
        certFact.generateCertificate(new ByteArrayInputStream(inputBytes));
    return cert;
}
 
Example #25
Source File: TransformC14NExclusive.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transformObject
) throws CanonicalizationException {
    try {
        String inclusiveNamespaces = null;

        if (transformObject.length(
            InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
            InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES) == 1
        ) {
            Element inclusiveElement =
                XMLUtils.selectNode(
                    transformObject.getElement().getFirstChild(),
                    InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
                    InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES,
                    0
                );

            inclusiveNamespaces =
                new InclusiveNamespaces(
                    inclusiveElement, transformObject.getBaseURI()).getInclusiveNamespaces();
        }

        Canonicalizer20010315ExclOmitComments c14n =
            new Canonicalizer20010315ExclOmitComments();
        if (os != null) {
            c14n.setWriter(os);
        }
        byte[] result = c14n.engineCanonicalize(input, inclusiveNamespaces);

        XMLSignatureInput output = new XMLSignatureInput(result);
        if (os != null) {
            output.setOutputStream(os);
        }
        return output;
    } catch (XMLSecurityException ex) {
        throw new CanonicalizationException("empty", ex);
    }
}
 
Example #26
Source File: Canonicalizer20010315Excl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected void circumventBugIfNeeded(XMLSignatureInput input)
    throws CanonicalizationException, ParserConfigurationException,
           IOException, SAXException {
    if (!input.isNeedsToBeExpanded() || inclusiveNSSet.isEmpty() || inclusiveNSSet.isEmpty()) {
        return;
    }
    Document doc = null;
    if (input.getSubNode() != null) {
        doc = XMLUtils.getOwnerDocument(input.getSubNode());
    } else {
        doc = XMLUtils.getOwnerDocument(input.getNodeSet());
    }
    XMLUtils.circumventBug2650(doc);
}
 
Example #27
Source File: Canonicalizer20010315Excl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected void circumventBugIfNeeded(XMLSignatureInput input)
    throws CanonicalizationException, ParserConfigurationException,
           IOException, SAXException {
    if (!input.isNeedsToBeExpanded() || inclusiveNSSet.isEmpty() || inclusiveNSSet.isEmpty()) {
        return;
    }
    Document doc = null;
    if (input.getSubNode() != null) {
        doc = XMLUtils.getOwnerDocument(input.getSubNode());
    } else {
        doc = XMLUtils.getOwnerDocument(input.getNodeSet());
    }
    XMLUtils.circumventBug2650(doc);
}
 
Example #28
Source File: TransformXPointer.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Method enginePerformTransform
 *
 * @param input
 * @return  {@link XMLSignatureInput} as the result of transformation
 * @throws TransformationException
 */
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transformObject
) throws TransformationException {

    Object exArgs[] = { implementedTransformURI };

    throw new TransformationException("signature.Transform.NotYetImplemented", exArgs);
}
 
Example #29
Source File: RetrievalMethodResolver.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static X509Certificate getRawCertificate(XMLSignatureInput resource)
    throws CanonicalizationException, IOException, CertificateException {
    byte inputBytes[] = resource.getBytes();
    // if the resource stores a raw certificate, we have to handle it
    CertificateFactory certFact =
        CertificateFactory.getInstance(XMLX509Certificate.JCA_CERT_ID);
    X509Certificate cert = (X509Certificate)
        certFact.generateCertificate(new ByteArrayInputStream(inputBytes));
    return cert;
}
 
Example #30
Source File: RetrievalMethodResolver.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static X509Certificate getRawCertificate(XMLSignatureInput resource)
    throws CanonicalizationException, IOException, CertificateException {
    byte inputBytes[] = resource.getBytes();
    // if the resource stores a raw certificate, we have to handle it
    CertificateFactory certFact =
        CertificateFactory.getInstance(XMLX509Certificate.JCA_CERT_ID);
    X509Certificate cert = (X509Certificate)
        certFact.generateCertificate(new ByteArrayInputStream(inputBytes));
    return cert;
}