Search in sources :

Example 6 with ExcC14NParameterSpec

use of javax.xml.crypto.dsig.spec.ExcC14NParameterSpec in project santuario-java by apache.

the class DOMExcC14NMethod method unmarshalParams.

private void unmarshalParams(Element paramsElem) {
    String prefixListAttr = paramsElem.getAttributeNS(null, "PrefixList");
    this.inclusiveNamespaces = prefixListAttr;
    int begin = 0;
    int end = prefixListAttr.indexOf(' ');
    List<String> prefixList = new ArrayList<>();
    while (end != -1) {
        prefixList.add(prefixListAttr.substring(begin, end));
        begin = end + 1;
        end = prefixListAttr.indexOf(' ', begin);
    }
    if (begin <= prefixListAttr.length()) {
        prefixList.add(prefixListAttr.substring(begin));
    }
    this.params = new ExcC14NParameterSpec(prefixList);
}
Also used : ExcC14NParameterSpec(javax.xml.crypto.dsig.spec.ExcC14NParameterSpec)

Example 7 with ExcC14NParameterSpec

use of javax.xml.crypto.dsig.spec.ExcC14NParameterSpec in project santuario-java by apache.

the class CanonicalizationMethodTest method testIsFeatureSupported.

@org.junit.Test
public void testIsFeatureSupported() throws Exception {
    CanonicalizationMethod cm;
    for (int i = 0; i < C14N_ALGOS.length; i++) {
        String algo = C14N_ALGOS[i];
        ExcC14NParameterSpec params = null;
        if (i >= 2) {
            params = new ExcC14NParameterSpec();
        }
        cm = factory.newCanonicalizationMethod(algo, params);
        try {
            cm.isFeatureSupported(null);
            fail("Should raise a NPE for null feature");
        } catch (NullPointerException npe) {
        }
        assertTrue(!cm.isFeatureSupported("not supported"));
    }
}
Also used : ExcC14NParameterSpec(javax.xml.crypto.dsig.spec.ExcC14NParameterSpec)

Aggregations

ExcC14NParameterSpec (javax.xml.crypto.dsig.spec.ExcC14NParameterSpec)7 AlgorithmParameterSpec (java.security.spec.AlgorithmParameterSpec)3 C14NMethodParameterSpec (javax.xml.crypto.dsig.spec.C14NMethodParameterSpec)1 Element (org.w3c.dom.Element)1