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


Java Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS属性代码示例

本文整理汇总了Java中org.apache.xml.security.c14n.Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS属性的典型用法代码示例。如果您正苦于以下问题:Java Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS属性的具体用法?Java Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS怎么用?Java Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.xml.security.c14n.Canonicalizer的用法示例。


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

示例1: test_generate_hmac_sha1_40

@org.junit.Test
public void test_generate_hmac_sha1_40() throws Exception {
    Document doc = XMLUtils.createDocumentBuilder(false).newDocument();
    XMLSignature sig =
        new XMLSignature(
            doc, null, XMLSignature.ALGO_ID_MAC_HMAC_SHA1,
            40, Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS
        );
    try {
        sig.sign(getSecretKey("secret".getBytes("ASCII")));
        fail("Expected HMACOutputLength Exception");
    } catch (XMLSignatureException xse) {
        // System.out.println(xse.getMessage());
        if (!xse.getMsgID().equals("algorithms.HMACOutputLengthMin")) {
            fail(xse.getMessage());
        }
    }
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:18,代码来源:HMACOutputLengthTest.java

示例2: test31subtree

/**
 * 3.1 PIs, Comments, and Outside of Document Element
 *
 * @throws CanonicalizationException
 * @throws FileNotFoundException
 * @throws IOException
 * @throws InvalidCanonicalizerException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-OutsideDoc">the example from the spec</A>
 * @throws TransformerException
 * @throws XPathExpressionException
 */
@org.junit.Test
public void test31subtree()
    throws IOException, FileNotFoundException, SAXException,
    ParserConfigurationException, CanonicalizationException,
    InvalidCanonicalizerException, TransformerException, XPathExpressionException {
    String descri =
        "3.1: PIs, Comments, and Outside of Document Element. (uncommented)";
    String fileIn = prefix + "in/31_input.xml";
    String fileRef = prefix + "in/31_c14n.xml";
    String fileOut = prefix + "out/xpath_31_output.xml";
    String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
    boolean validating = true;
    String xpath = null;

    assertTrue(descri,
               c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:30,代码来源:Canonicalizer20010315Test.java

示例3: test31subset

/**
 * 3.1 PIs, Comments, and Outside of Document Element
 *
 * @throws CanonicalizationException
 * @throws FileNotFoundException
 * @throws IOException
 * @throws InvalidCanonicalizerException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-OutsideDoc">the example from the spec</A>
 * @throws TransformerException
 * @throws XPathExpressionException
 */
@org.junit.Test
public void test31subset()
    throws IOException, FileNotFoundException, SAXException,
    ParserConfigurationException, CanonicalizationException,
    InvalidCanonicalizerException, TransformerException, XPathExpressionException {

    String descri =
        "3.1: PIs, Comments, and Outside of Document Element. (uncommented)";
    String fileIn = prefix + "in/31_input.xml";
    String fileRef = prefix + "in/31_c14n.xml";
    String fileOut = prefix + "out/xpath_31_output.xml";
    String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
    boolean validating = true;
    String xpath = Canonicalizer.XPATH_C14N_WITH_COMMENTS_SINGLE_NODE;

    assertTrue(descri,
               c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:31,代码来源:Canonicalizer20010315Test.java

示例4: test32subtree

/**
 * 3.2 Whitespace in Document Content
 *
 * @throws CanonicalizationException
 * @throws FileNotFoundException
 * @throws IOException
 * @throws InvalidCanonicalizerException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-WhitespaceInContent">the example from the spec</A>
 * @throws TransformerException
 * @throws XPathExpressionException
 */
@org.junit.Test
public void test32subtree()
    throws IOException, FileNotFoundException, SAXException,
    ParserConfigurationException, CanonicalizationException,
    InvalidCanonicalizerException, TransformerException, XPathExpressionException {
    String descri = "3.2 Whitespace in Document Content. (uncommented)";
    String fileIn = prefix + "in/32_input.xml";
    String fileRef = prefix + "in/32_c14n.xml";
    String fileOut = prefix + "out/xpath_32_output.xml";
    String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
    boolean validating = true;
    String xpath = null;

    assertTrue(descri,
               c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:29,代码来源:Canonicalizer20010315Test.java

示例5: test32subset

/**
 * 3.2 Whitespace in Document Content
 *
 * @throws CanonicalizationException
 * @throws FileNotFoundException
 * @throws IOException
 * @throws InvalidCanonicalizerException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-WhitespaceInContent">the example from the spec</A>
 * @throws TransformerException
 * @throws XPathExpressionException
 */
@org.junit.Test
public void test32subset()
    throws IOException, FileNotFoundException, SAXException,
    ParserConfigurationException, CanonicalizationException,
    InvalidCanonicalizerException, TransformerException, XPathExpressionException {
    String descri = "3.2 Whitespace in Document Content. (uncommented)";
    String fileIn = prefix + "in/32_input.xml";
    String fileRef = prefix + "in/32_c14n.xml";
    String fileOut = prefix + "out/xpath_32_output.xml";
    String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
    boolean validating = true;
    String xpath = Canonicalizer.XPATH_C14N_WITH_COMMENTS_SINGLE_NODE;

    assertTrue(descri,
               c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:29,代码来源:Canonicalizer20010315Test.java

示例6: test33subtree

/**
 * 3.3 Start and End Tags
 *
 * @throws CanonicalizationException
 * @throws FileNotFoundException
 * @throws IOException
 * @throws InvalidCanonicalizerException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-SETags">the example from the spec</A>
 * @throws TransformerException
 * @throws XPathExpressionException
 */
@org.junit.Test
public void test33subtree()
    throws IOException, FileNotFoundException, SAXException,
    ParserConfigurationException, CanonicalizationException,
    InvalidCanonicalizerException, TransformerException, XPathExpressionException {
    String descri = "3.3 Start and End Tags. (uncommented)";
    String fileIn = prefix + "in/33_input.xml";
    String fileRef = prefix + "in/33_c14n.xml";
    String fileOut = prefix + "out/xpath_33_output.xml";
    String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
    boolean validating = true;
    String xpath = null;    // Canonicalizer.XPATH_C14N_OMIT_COMMENTS_SINGLE_NODE;

    assertTrue(descri,
               c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:29,代码来源:Canonicalizer20010315Test.java

示例7: test33subset

@org.junit.Test
public void test33subset()
    throws IOException, FileNotFoundException, SAXException,
    ParserConfigurationException, CanonicalizationException,
    InvalidCanonicalizerException, TransformerException, XPathExpressionException {
    String descri = "3.3 Start and End Tags. (uncommented)";
    String fileIn = prefix + "in/33_input.xml";
    String fileRef = prefix + "in/33_c14n.xml";
    String fileOut = prefix + "out/xpath_33_output.xml";
    String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
    boolean validating = true;
    String xpath = Canonicalizer.XPATH_C14N_WITH_COMMENTS_SINGLE_NODE;

    assertTrue(descri,
               c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:16,代码来源:Canonicalizer20010315Test.java

示例8: test34

/**
 * 3.4 Character Modifications and Character References
 *
 * @throws CanonicalizationException
 * @throws FileNotFoundException
 * @throws IOException
 * @throws InvalidCanonicalizerException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @see #test34validatingParser
 * @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Chars">the example from the spec</A>
 * @throws TransformerException
 * @throws XPathExpressionException
 */
@org.junit.Test
public void test34()
    throws IOException, FileNotFoundException, SAXException,
    ParserConfigurationException, CanonicalizationException,
    InvalidCanonicalizerException, TransformerException, XPathExpressionException {
    String descri =
        "3.4 Character Modifications and Character References. (uncommented)";
    String fileIn = prefix + "in/34_input.xml";
    String fileRef = prefix + "in/34_c14n.xml";
    String fileOut = prefix + "out/xpath_34_output.xml";
    String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
    boolean validating = false;
    String xpath = null;

    assertTrue(descri,
               c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:31,代码来源:Canonicalizer20010315Test.java

示例9: test35subtree

/**
 * 3.5 Entity References
 *
 * @throws CanonicalizationException
 * @throws FileNotFoundException
 * @throws IOException
 * @throws InvalidCanonicalizerException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Entities">the example from the spec</A>
 * @throws TransformerException
 * @throws XPathExpressionException
 */
@org.junit.Test
public void test35subtree()
    throws IOException, FileNotFoundException, SAXException,
    ParserConfigurationException, CanonicalizationException,
    InvalidCanonicalizerException, TransformerException, XPathExpressionException {
    String descri = "3.5 Entity References. (uncommented)";
    String fileIn = prefix + "in/35_input.xml";
    String fileRef = prefix + "in/35_c14n.xml";
    String fileOut = prefix + "out/xpath_35_output.xml";
    String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
    boolean validating = true;
    String xpath = null;

    assertTrue(descri,
               c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:29,代码来源:Canonicalizer20010315Test.java

示例10: test35subset

/**
 * 3.5 Entity References
 *
 * @throws CanonicalizationException
 * @throws FileNotFoundException
 * @throws IOException
 * @throws InvalidCanonicalizerException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Entities">the example from the spec</A>
 * @throws TransformerException
 * @throws XPathExpressionException
 */
@org.junit.Test
public void test35subset()
    throws IOException, FileNotFoundException, SAXException,
    ParserConfigurationException, CanonicalizationException,
    InvalidCanonicalizerException, TransformerException, XPathExpressionException {
    String descri = "3.5 Entity References. (uncommented)";
    String fileIn = prefix + "in/35_input.xml";
    String fileRef = prefix + "in/35_c14n.xml";
    String fileOut = prefix + "out/xpath_35_output.xml";
    String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
    boolean validating = true;
    String xpath = Canonicalizer.XPATH_C14N_WITH_COMMENTS_SINGLE_NODE;

    assertTrue(descri,
               c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:29,代码来源:Canonicalizer20010315Test.java

示例11: test36subtree

/**
 * 3.6 UTF-8 Encoding
 *
 * @throws CanonicalizationException
 * @throws FileNotFoundException
 * @throws IOException
 * @throws InvalidCanonicalizerException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-UTF8">the example from the spec</A>
 * @throws TransformerException
 * @throws XPathExpressionException
 */
@org.junit.Test
public void test36subtree()
    throws IOException, FileNotFoundException, SAXException,
    ParserConfigurationException, CanonicalizationException,
    InvalidCanonicalizerException, TransformerException, XPathExpressionException {
    String descri = "3.6 UTF-8 Encoding. (uncommented)";
    String fileIn = prefix + "in/36_input.xml";
    String fileRef = prefix + "in/36_c14n.xml";
    String fileOut = prefix + "out/xpath_36_output.xml";
    String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
    boolean validating = true;
    String xpath = null;

    assertTrue(descri,
               c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:29,代码来源:Canonicalizer20010315Test.java

示例12: test36subset

/**
 * 3.6 UTF-8 Encoding
 *
 * @throws CanonicalizationException
 * @throws FileNotFoundException
 * @throws IOException
 * @throws InvalidCanonicalizerException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-UTF8">the example from the spec</A>
 * @throws TransformerException
 * @throws XPathExpressionException
 */
@org.junit.Test
public void test36subset()
    throws IOException, FileNotFoundException, SAXException,
    ParserConfigurationException, CanonicalizationException,
    InvalidCanonicalizerException, TransformerException, XPathExpressionException {
    String descri = "3.6 UTF-8 Encoding. (uncommented)";
    String fileIn = prefix + "in/36_input.xml";
    String fileRef = prefix + "in/36_c14n.xml";
    String fileOut = prefix + "out/xpath_36_output.xml";
    String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
    boolean validating = true;
    String xpath = Canonicalizer.XPATH_C14N_WITH_COMMENTS_SINGLE_NODE;

    assertTrue(descri,
               c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath));
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:29,代码来源:Canonicalizer20010315Test.java

示例13: test37

/**
 * 3.7 Document Subsets
 *
 * @throws CanonicalizationException
 * @throws FileNotFoundException
 * @throws IOException
 * @throws InvalidCanonicalizerException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-DocSubsets">the example from the spec</A>
 * @throws TransformerException
 * @throws XPathExpressionException
 */
@org.junit.Test
public void test37()
    throws IOException, FileNotFoundException, SAXException,
    ParserConfigurationException, CanonicalizationException,
    InvalidCanonicalizerException, TransformerException, XPathExpressionException {
    String descri = "3.7 Document Subsets. (uncommented)";
    String fileIn = prefix + "in/37_input.xml";
    String fileRef = prefix + "in/37_c14n.xml";
    String fileOut = prefix + "out/xpath_37_output.xml";
    String c14nURI = Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
    boolean validating = true;

    Map<String, String> namespace = new HashMap<String, String>();
    namespace.put("ietf", "http://www.ietf.org");
    String xpath =
        "(//. | //@* | //namespace::*)"
        + "[ "
        + "self::ietf:e1 or "
        + "(parent::ietf:e1 and not(self::text() or self::e2)) or "
        + "count(id(\"E3\")|ancestor-or-self::node()) = count(ancestor-or-self::node()) "
        + "]";

    assertTrue(descri,
               c14nAndCompare(fileIn, fileRef, fileOut, c14nURI, validating, xpath, namespace));
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:38,代码来源:Canonicalizer20010315Test.java

示例14: convertTimeStamps

protected void convertTimeStamps(
        List<XmlXAdESTimeStampType> xmlTimeStamps,
        QualifyingPropertiesDataCollector propertyDataCollector) throws PropertyUnmarshalException
{
    if (null == xmlTimeStamps || xmlTimeStamps.isEmpty())
        return;

    for (XmlXAdESTimeStampType xmlTS : xmlTimeStamps)
    {
        if(!xmlTS.getReferenceInfo().isEmpty())
            throw new PropertyUnmarshalException("ReferenceInfo is not supported in XAdESTimeStamp", propName);

        Algorithm c14n;
        XmlCanonicalizationMethodType xmlCanonMethod = xmlTS.getCanonicalizationMethod();
        if(null == xmlCanonMethod)
        {
            c14n = new GenericAlgorithm(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
        }
        else
        {
            List params = CollectionUtils.filterByType(xmlCanonMethod.getContent(), Element.class);
            c14n = new GenericAlgorithm(xmlCanonMethod.getAlgorithm(), params);
        }
        TPropData tsData = createTSData(c14n);

        List<Object> tsTokens = xmlTS.getEncapsulatedTimeStampOrXMLTimeStamp();
        if (tsTokens.isEmpty())
            throw new PropertyUnmarshalException("No time-stamp tokens", propName);

        for (Object tkn : tsTokens)
        {
            if (!(tkn instanceof XmlEncapsulatedPKIDataType))
                throw new PropertyUnmarshalException("XML time-stamps are not supported", propName);
            tsData.addTimeStampToken(((XmlEncapsulatedPKIDataType)tkn).getValue());
        }

        doSpecificConvert(xmlTS, tsData);
        setTSData(tsData, propertyDataCollector);
    }
}
 
开发者ID:luisgoncalves,项目名称:xades4j,代码行数:40,代码来源:FromXmlBaseTimeStampConverter.java

示例15: engineGetURI

/** @inheritDoc */
public final String engineGetURI() {
    return Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS;
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:4,代码来源:Canonicalizer20010315OmitComments.java


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