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


Java URIDereferencer类代码示例

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


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

示例1: testsetngetURIDereferencer

import javax.xml.crypto.URIDereferencer; //导入依赖的package包/类
@org.junit.Test
public void testsetngetURIDereferencer() throws Exception {
    assertNull(defContext.getURIDereferencer());
    byte[] data = "simpleDereferencer".getBytes();
    URIDereferencer deref = new TestUtils.OctetStreamURIDereferencer(data);

    defContext.setURIDereferencer(deref);
    assertEquals(defContext.getURIDereferencer(), deref);
    defContext.setURIDereferencer(null);
    assertNull(defContext.getURIDereferencer());
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:12,代码来源:XMLSignContextTest.java

示例2: dereference

import javax.xml.crypto.URIDereferencer; //导入依赖的package包/类
public Data dereference(URIReference uriReference, XMLCryptoContext context) throws URIReferenceException {

        if (uriReference == null) {
            throw new NullPointerException("Parameter 'uriReference' cannot be null.");
        }

        if (context == null) {
            throw new NullPointerException("Parameter 'context' can notbe null.");
        }

        if (!(uriReference instanceof DOMURIReference && context instanceof DOMCryptoContext)) {
            throw new IllegalArgumentException(String.format("This %s implementation supports the DOM XML mechanism only.",
                    URIDereferencer.class.getName()));
        }

        String uriString = uriReference.getURI();

        if (uriString == null) {
            throw new URIReferenceException("Cannot resolve a URI of value 'null'.");
        }

        if (uriString != null && ((uriString.length() != 0 && uriString.charAt(0) == '#') || uriString.isEmpty())) {
            // same document uri
            XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");
            return fac.getURIDereferencer().dereference(uriReference, context);
        }

        throw new URIReferenceException(String.format("URI reference %s not supported", uriString));
    }
 
开发者ID:HydAu,项目名称:Camel,代码行数:30,代码来源:SameDocumentUriDereferencer.java

示例3: verify

import javax.xml.crypto.URIDereferencer; //导入依赖的package包/类
private boolean verify(Document document, List<EbMSDataSource> dataSources) throws MarshalException, XMLSignatureException
{
	NodeList nodeList = document.getElementsByTagNameNS(XMLSignature.XMLNS,"Signature");
	if (nodeList.getLength() > 0)
	{
		XMLSignatureFactory signFactory = XMLSignatureFactory.getInstance();
		DOMValidateContext validateContext = new DOMValidateContext(new XMLDSigKeySelector(),nodeList.item(0));
		URIDereferencer dereferencer = new EbMSDataSourceURIDereferencer(dataSources);
		validateContext.setURIDereferencer(dereferencer);
		XMLSignature signature = signFactory.unmarshalXMLSignature(validateContext);
		return signature.validate(validateContext);
	}
	return true;
}
 
开发者ID:mprins,项目名称:muleebmsadapter,代码行数:15,代码来源:XMLDSignatureInInterceptor.java

示例4: getURIDereferencer

import javax.xml.crypto.URIDereferencer; //导入依赖的package包/类
public URIDereferencer getURIDereferencer() {
    return dereferencer;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:DOMCryptoContext.java

示例5: setURIDereferencer

import javax.xml.crypto.URIDereferencer; //导入依赖的package包/类
public void setURIDereferencer(URIDereferencer dereferencer) {
    this.dereferencer = dereferencer;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:DOMCryptoContext.java

示例6: dereference

import javax.xml.crypto.URIDereferencer; //导入依赖的package包/类
@Override
public Data dereference(XMLCryptoContext context)
    throws URIReferenceException
{
    if (context == null) {
        throw new NullPointerException("context cannot be null");
    }

    /*
     * If URIDereferencer is specified in context; use it, otherwise use
     * built-in.
     */
    URIDereferencer deref = context.getURIDereferencer();
    if (deref == null) {
        deref = DOMURIDereferencer.INSTANCE;
    }

    Data data = deref.dereference(this, context);

    // pass dereferenced data through Transforms
    try {
        for (Transform transform : transforms) {
            data = transform.transform(data, context);
        }
    } catch (Exception e) {
        throw new URIReferenceException(e);
    }

    // guard against RetrievalMethod loops
    if (data instanceof NodeSetData && Utils.secureValidation(context)) {
        NodeSetData nsd = (NodeSetData)data;
        Iterator<?> i = nsd.iterator();
        if (i.hasNext()) {
            Node root = (Node)i.next();
            if ("RetrievalMethod".equals(root.getLocalName())) {
                throw new URIReferenceException(
                    "It is forbidden to have one RetrievalMethod point " +
                    "to another when secure validation is enabled");
            }
        }
    }

    return data;
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:45,代码来源:DOMRetrievalMethod.java

示例7: test_create_hmac_sha1_exclusive_c14n_comments_detached

import javax.xml.crypto.URIDereferencer; //导入依赖的package包/类
private void test_create_hmac_sha1_exclusive_c14n_comments_detached(boolean fortyBit)
    throws Exception {

    // create reference
    Reference ref = fac.newReference
        ("http://www.ietf.org/rfc/rfc3161.txt",
         fac.newDigestMethod(DigestMethod.SHA1, null));

    // create SignedInfo
    HMACParameterSpec spec = null;
    if (fortyBit) {
        spec = new HMACParameterSpec(40);
    }

    SignedInfo si = fac.newSignedInfo(
        fac.newCanonicalizationMethod
            (CanonicalizationMethod.EXCLUSIVE_WITH_COMMENTS,
             (C14NMethodParameterSpec) null),
        fac.newSignatureMethod(SignatureMethod.HMAC_SHA1, spec),
        Collections.singletonList(ref));

    // create XMLSignature
    XMLSignature sig = fac.newXMLSignature(si, null);

    Document doc = db.newDocument();
    DOMSignContext dsc = new DOMSignContext
        (new KeySelectors.SecretKeySelector
         ("test".getBytes("ASCII")), doc);
    dsc.putNamespacePrefix(XMLSignature.XMLNS, "dsig");
    URIDereferencer ud = new LocalHttpCacheURIDereferencer();
    dsc.setURIDereferencer(ud);

    sig.sign(dsc);
    TestUtils.validateSecurityOrEncryptionElement(doc.getDocumentElement());

    DOMValidateContext dvc = new DOMValidateContext
        (new KeySelectors.SecretKeySelector
         ("test".getBytes("ASCII")), doc);
    dvc.setURIDereferencer(ud);

    XMLSignature sig2 = fac.unmarshalXMLSignature(dvc);

    assertTrue(sig.equals(sig2));

    assertTrue(sig2.validate(dvc));
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:47,代码来源:CreatePhaosXMLDSig3Test.java

示例8: getUriDereferencer

import javax.xml.crypto.URIDereferencer; //导入依赖的package包/类
public URIDereferencer getUriDereferencer() {
    return uriDereferencer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:XmlSignatureConfiguration.java

示例9: getUriDereferencer

import javax.xml.crypto.URIDereferencer; //导入依赖的package包/类
public URIDereferencer getUriDereferencer() {
    return getConfiguration().getUriDereferencer();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:XmlSignatureEndpoint.java

示例10: setUriDereferencer

import javax.xml.crypto.URIDereferencer; //导入依赖的package包/类
public void setUriDereferencer(URIDereferencer uriDereferencer) {
    getConfiguration().setUriDereferencer(uriDereferencer);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:XmlSignatureEndpoint.java

示例11: getSameDocumentUriDereferencer

import javax.xml.crypto.URIDereferencer; //导入依赖的package包/类
public static URIDereferencer getSameDocumentUriDereferencer() {
    return SameDocumentUriDereferencer.getInstance();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:XmlSignatureTest.java

示例12: getInstance

import javax.xml.crypto.URIDereferencer; //导入依赖的package包/类
public static URIDereferencer getInstance() {
    return INSTANCE;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:SameDocumentUriDereferencer.java

示例13: getURIDereferencer

import javax.xml.crypto.URIDereferencer; //导入依赖的package包/类
@Override
protected final URIDereferencer getURIDereferencer() {
	URL odfUrl = getOpenDocumentURL();
	return new ODFURIDereferencer(odfUrl);
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:6,代码来源:AbstractODFSignatureService.java

示例14: getURIDereferencer

import javax.xml.crypto.URIDereferencer; //导入依赖的package包/类
@Override
protected URIDereferencer getURIDereferencer() {
	return new ASiCURIDereferencer(this.tmpFile);
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:5,代码来源:AbstractASiCSignatureService.java

示例15: getURIDereferencer

import javax.xml.crypto.URIDereferencer; //导入依赖的package包/类
@Override
protected final URIDereferencer getURIDereferencer() {
	URL ooxmlUrl = getOfficeOpenXMLDocumentURL();
	return new OOXMLURIDereferencer(ooxmlUrl);
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:6,代码来源:AbstractOOXMLSignatureService.java


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