当前位置: 首页>>代码示例>>Java>>正文


Java Transform类代码示例

本文整理汇总了Java中org.apache.xml.security.transforms.Transform的典型用法代码示例。如果您正苦于以下问题:Java Transform类的具体用法?Java Transform怎么用?Java Transform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Transform类属于org.apache.xml.security.transforms包,在下文中一共展示了Transform类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: enginePerformTransform

import org.apache.xml.security.transforms.Transform; //导入依赖的package包/类
/**
 * @inheritDoc
 */
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transformObject
) throws TransformationException {
    /**
     * If the actual input is an octet stream, then the application MUST
     * convert the octet stream to an XPath node-set suitable for use by
     * Canonical XML with Comments. (A subsequent application of the
     * REQUIRED Canonical XML algorithm would strip away these comments.)
     *
     * ...
     *
     * The evaluation of this expression includes all of the document's nodes
     * (including comments) in the node-set representing the octet stream.
     */

    Node signatureElement = transformObject.getElement();

    signatureElement = searchSignatureElement(signatureElement);
    input.setExcludeNode(signatureElement);
    input.addNodeFilter(new EnvelopedNodeFilter(signatureElement));
    return input;
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:26,代码来源:TransformEnvelopedSignature.java

示例2: enginePerformTransform

import org.apache.xml.security.transforms.Transform; //导入依赖的package包/类
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transformObject
) throws CanonicalizationException {
    Canonicalizer20010315OmitComments c14n = new Canonicalizer20010315OmitComments();
    c14n.setSecureValidation(secureValidation);
    if (os != null) {
        c14n.setWriter(os);
    }
    byte[] result = null;
    result = c14n.engineCanonicalize(input);         		         	
    XMLSignatureInput output = new XMLSignatureInput(result);
    output.setSecureValidation(secureValidation);
    if (os != null) {
        output.setOutputStream(os);
    }
    return output;
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:18,代码来源:TransformC14N.java

示例3: enginePerformTransform

import org.apache.xml.security.transforms.Transform; //导入依赖的package包/类
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transform
) throws CanonicalizationException {
    Canonicalizer11_OmitComments c14n = new Canonicalizer11_OmitComments();
    c14n.setSecureValidation(secureValidation);
    if (os != null) {
        c14n.setWriter(os);
    }
    byte[] result = null;
    result = c14n.engineCanonicalize(input);         		         	
    XMLSignatureInput output = new XMLSignatureInput(result);
    output.setSecureValidation(secureValidation);
    if (os != null) {
        output.setOutputStream(os);
    }
    return output;
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:18,代码来源:TransformC14N11.java

示例4: enginePerformTransform

import org.apache.xml.security.transforms.Transform; //导入依赖的package包/类
/** @inheritDoc */
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transformObject
) throws CanonicalizationException {

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

    byte[] result = null;
    result = c14n.engineCanonicalize(input);         		         	
    XMLSignatureInput output = new XMLSignatureInput(result);
    output.setSecureValidation(secureValidation);
    if (os != null) {
        output.setOutputStream(os);
    }
    return output;
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:21,代码来源:TransformC14NWithComments.java

示例5: enginePerformTransform

import org.apache.xml.security.transforms.Transform; //导入依赖的package包/类
protected XMLSignatureInput enginePerformTransform(
    XMLSignatureInput input, OutputStream os, Transform transform
) throws CanonicalizationException {

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

    byte[] result = null;
    result = c14n.engineCanonicalize(input);         		         	
    XMLSignatureInput output = new XMLSignatureInput(result);
    output.setSecureValidation(secureValidation);
    if (os != null) {
        output.setOutputStream(os);
    }
    return output;
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:20,代码来源:TransformC14N11_WithComments.java

示例6: createTransform

import org.apache.xml.security.transforms.Transform; //导入依赖的package包/类
/**
 * Creates a Transform element for a given algorithm.
 * @param algorithm algorithm
 * @param parametersMarshallingProvider algorithm parameters marshaller
 * @param document the target XML document
 * @return the Transform
 * @throws UnsupportedAlgorithmException if the algorithm is not supported
 */
public static Transform createTransform(Algorithm algorithm, AlgorithmsParametersMarshallingProvider parametersMarshallingProvider, Document document) throws UnsupportedAlgorithmException
{
    List<Node> params = parametersMarshallingProvider.marshalParameters(algorithm, document);
    try
    {
        if (null == params)
        {
            return new Transform(document, algorithm.getUri());
        }
        else
        {
            return new Transform(document, algorithm.getUri(), DOMHelper.nodeList(params));
        }
    }
    catch (InvalidTransformException ex)
    {
        throw new UnsupportedAlgorithmException("C14N algorithm not supported in the XML Signature provider", algorithm.getUri(), ex);
    }
}
 
开发者ID:luisgoncalves,项目名称:xades4j,代码行数:28,代码来源:TransformUtils.java

示例7: addToDigestInput

import org.apache.xml.security.transforms.Transform; //导入依赖的package包/类
private void addToDigestInput(XMLSignatureInput refData, Document doc) throws CannotAddDataToDigestInputException
{
    try
    {
        if (refData.isNodeSet() || refData.isElement())
        {
            Transform c14nTransform = TransformUtils.createTransform(this.c14n, this.parametersMarshallingProvider, doc);
            refData = c14nTransform.performTransform(refData);
            // Fall through to add the bytes resulting from the canonicalization.
        }

        if (refData.isByteArray())
        {
            digestInput.write(refData.getBytes());
        } else if (refData.isOctetStream())
        {
            StreamUtils.readWrite(refData.getOctetStream(), digestInput);
        }
    }
    catch (Exception ex)
    {
        throw new CannotAddDataToDigestInputException(ex);
    }
}
 
开发者ID:luisgoncalves,项目名称:xades4j,代码行数:25,代码来源:TimeStampDigestInputImpl.java

示例8: staticInit

import org.apache.xml.security.transforms.Transform; //导入依赖的package包/类
private synchronized void
staticInit() {
    if (!staticallyInitialized) {
        org.apache.xml.security.Init.init();
        if (addJceProviders) {
            /*
             * The last provider added has precedence, that is if JuiCE can be added
             * then WSS4J uses this provider.
             */
            addJceProvider("BC", "org.bouncycastle.jce.provider.BouncyCastleProvider");
            addJceProvider("JuiCE", "org.apache.security.juice.provider.JuiCEProviderOpenSSL");
        }
        //Transform.init();
        try {
            Transform.register(
                STRTransform.implementedTransformURI,
                "org.apache.ws.security.transform.STRTransform"
            );
        } catch (Exception ex) {
            if (log.isDebugEnabled()) {
                log.debug(ex.getMessage(), ex);
            }
        }
        staticallyInitialized = true;
    }
}
 
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:27,代码来源:WSSConfig.java

示例9: processExclusiveTransform

import org.apache.xml.security.transforms.Transform; //导入依赖的package包/类
/**
 * Populate the inclusive namspace prefixes on the specified Apache (exclusive) transform object.
 * 
 * @param signature the Apache XMLSignature object
 * @param transform the Apache Transform object representing an exclusive transform
 */
private void processExclusiveTransform(XMLSignature signature, Transform transform) {
    // Namespaces that aren't visibly used, such as those used in QName attribute values, would
    // be stripped out by exclusive canonicalization. Need to make sure they aren't by explicitly
    // telling the transformer about them.
    log.debug("Adding list of inclusive namespaces for signature exclusive canonicalization transform");
    LazySet<String> inclusiveNamespacePrefixes = new LazySet<String>();
    populateNamespacePrefixes(inclusiveNamespacePrefixes, signableObject);
    
    if (inclusiveNamespacePrefixes != null && inclusiveNamespacePrefixes.size() > 0) {
        InclusiveNamespaces inclusiveNamespaces = new InclusiveNamespaces(signature.getDocument(),
                inclusiveNamespacePrefixes);
        transform.getElement().appendChild(inclusiveNamespaces.getElement());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:SAMLObjectContentReference.java

示例10: enginePerformTransform

import org.apache.xml.security.transforms.Transform; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:16,代码来源:TransformXPointer.java

示例11: enginePerformTransform

import org.apache.xml.security.transforms.Transform; //导入依赖的package包/类
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();
        c14n.setSecureValidation(secureValidation);
        if (os != null) {
            c14n.setWriter(os);
        }
        byte[] result = c14n.engineCanonicalize(input, inclusiveNamespaces);
        XMLSignatureInput output = new XMLSignatureInput(result);
        output.setSecureValidation(secureValidation);

        return output;
    } catch (XMLSecurityException ex) {
        throw new CanonicalizationException(ex);
    }
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:40,代码来源:TransformC14NExclusiveWithComments.java

示例12: test1

import org.apache.xml.security.transforms.Transform; //导入依赖的package包/类
/**
 * Make sure Transform.performTransform does not throw NullPointerException.
 * See bug 41927 for more info.
 */
@org.junit.Test
public void test1() throws Exception {
    File file1  = null;
    File file2  = null;
    if (BASEDIR != null && !"".equals(BASEDIR)) {
        file1 = new File(BASEDIR + SEP + SOURCE_PATH, SIGNATURE_FILE);
        file2 = new File(BASEDIR + SEP + SOURCE_PATH, STYLESHEET_FILE);
    } else {
        file1 = new File(SOURCE_PATH, SIGNATURE_FILE);
        file1 = new File(SOURCE_PATH, STYLESHEET_FILE);
    }
    Document doc1 = getDocument(file1);
    Document doc2 = getDocument(file2);

    XPathFactory xpf = XPathFactory.newInstance();
    XPath xpath = xpf.newXPath();
    xpath.setNamespaceContext(new DSNamespaceContext());

    String expression = "//ds:Transform[1]";
    Element transformEl =
        (Element) xpath.evaluate(expression, doc1, XPathConstants.NODE);

    Transform transform =
        new Transform(doc1, Transforms.TRANSFORM_XSLT, transformEl.getChildNodes());

    transform.performTransform(new XMLSignatureInput(doc2));
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:32,代码来源:TransformXSLTTest.java

示例13: transform

import org.apache.xml.security.transforms.Transform; //导入依赖的package包/类
public byte[] transform(final DSSDocument input) throws DSSException {
	try {
		final String dssTransformAlgorithm = dssTransform.getAlgorithm();
		final NodeList childNodes = document.getFirstChild().getChildNodes();
		final Transform transformObject = new Transform(document, dssTransformAlgorithm, childNodes);

		final byte[] bytes = DSSUtils.toByteArray(input);
		final XMLSignatureInput xmlSignatureInput = new XMLSignatureInput(bytes);
		final XMLSignatureInput xmlSignatureInputOut = transformObject.performTransform(xmlSignatureInput);
		return xmlSignatureInputOut.getBytes();
	} catch (Exception e) {
		throw new DSSException(e);
	}
}
 
开发者ID:esig,项目名称:dss,代码行数:15,代码来源:DSSTransformXPath.java

示例14: processExclusiveTransform

import org.apache.xml.security.transforms.Transform; //导入依赖的package包/类
/**
 * Populate the inclusive namspace prefixes on the specified Apache (exclusive) transform object.
 * 
 * @param signature the Apache XMLSignature object
 * @param transform the Apache Transform object representing an exclusive transform
 */
private void processExclusiveTransform(XMLSignature signature, Transform transform) {
    // Namespaces that aren't visibly used, such as those used in QName attribute values, would
    // be stripped out by exclusive canonicalization. Need to make sure they aren't by explicitly
    // telling the transformer about them.
    log.debug("Adding list of inclusive namespaces for signature exclusive canonicalization transform");
    HashSet<String> inclusiveNamespacePrefixes = new HashSet<String>();
    populateNamespacePrefixes(inclusiveNamespacePrefixes, signableObject);
    
    if (inclusiveNamespacePrefixes != null && inclusiveNamespacePrefixes.size() > 0) {
        InclusiveNamespaces inclusiveNamespaces = new InclusiveNamespaces(signature.getDocument(),
                inclusiveNamespacePrefixes);
        transform.getElement().appendChild(inclusiveNamespaces.getElement());
    }
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:21,代码来源:SAMLObjectContentReference.java

示例15: enginePerformTransform

import org.apache.xml.security.transforms.Transform; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected XMLSignatureInput enginePerformTransform(
        XMLSignatureInput input, OutputStream os, Transform _transformObject)
        throws IOException,
               CanonicalizationException, InvalidCanonicalizerException,
               TransformationException, ParserConfigurationException,
               SAXException {
        return enginePerformTransform(input, _transformObject);
}
 
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:12,代码来源:STRTransform.java


注:本文中的org.apache.xml.security.transforms.Transform类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。