本文整理了Java中javax.xml.crypto.dsig.XMLSignContext
类的一些代码示例,展示了XMLSignContext
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLSignContext
类的具体详情如下:
包路径:javax.xml.crypto.dsig.XMLSignContext
类名称:XMLSignContext
[英]Contains context information for generating XML Signatures. This interface is primarily intended for type-safety.
Note that XMLSignContext
instances can contain information and state specific to the XML signature structure it is used with. The results are unpredictable if an XMLSignContext
is used with different signature structures (for example, you should not use the same XMLSignContext
instance to sign two different XMLSignature objects).
The following properties can be set using the #setProperty method.
javax.xml.crypto.dsig.cacheReference
: value must be a Boolean. This property controls whether or not the digested Reference objects will cache the dereferenced content and pre-digested input for subsequent retrieval via the Reference#getDereferencedData and Reference#getDigestInputStreammethods. The default value if not specified is Boolean.FALSE
.XMLSignContext
实例可以包含特定于它所使用的XML签名结构的信息和状态。如果XMLSignContext
与不同的签名结构一起使用(例如,不应使用同一XMLSignContext
实例对两个不同的XMLSignature对象进行签名),则结果是不可预测的。javax.xml.crypto.dsig.cacheReference
:值必须是布尔值。此属性控制摘要引用对象是否将缓存取消引用的内容和预摘要输入,以便通过引用#GetDereferenceData和引用#getDigestInputStreammethods进行后续检索。如果未指定,则默认值为[$4$]。代码示例来源:origin: org.apache.wss4j/wss4j-ws-security-dom
signContext.putNamespacePrefix(WSConstants.SIG_NS, WSConstants.SIG_PREFIX);
if (WSConstants.C14N_EXCL_OMIT_COMMENTS.equals(canonAlgo)) {
signContext.putNamespacePrefix(
WSConstants.C14N_EXCL_OMIT_COMMENTS,
WSConstants.C14N_EXCL_OMIT_COMMENTS_PREFIX
);
signContext.setProperty(STRTransform.TRANSFORM_WS_DOC_INFO, wsDocInfo);
wsDocInfo.setCallbackLookup(callbackLookup);
代码示例来源:origin: org.apache.santuario/xmlsec
Provider p = (Provider)context.getProperty
("org.jcp.xml.dsig.internal.dom.SignatureProvider");
signature = (p == null)
代码示例来源:origin: be.fedict.eid-applet/eid-applet-service-signer
URIDereferencer uriDereferencer = getURIDereferencer();
if (null != uriDereferencer) {
xmlSignContext.setURIDereferencer(uriDereferencer);
xmlSignContext.putNamespacePrefix(javax.xml.crypto.dsig.XMLSignature.XMLNS, this.signatureNamespacePrefix);
代码示例来源:origin: be.fedict.eid-applet/eid-applet-test-model
signContext.putNamespacePrefix(javax.xml.crypto.dsig.XMLSignature.XMLNS, "ds");
代码示例来源:origin: net.shibboleth.metadata/aggregator-pipeline
/** {@inheritDoc} */
@Override protected boolean doExecute(@Nonnull final Item<Element> item) throws StageProcessingException {
Element element = item.unwrap();
XMLSignature signature = xmlSigFactory.newXMLSignature(buildSignedInfo(element), buildKeyInfo());
try {
XMLSignContext context = new DOMSignContext(privKey, element, element.getFirstChild());
// Enable caching reference values if required for debugging.
if (isDebugPreDigest() && log.isDebugEnabled()) {
context.setProperty("javax.xml.crypto.dsig.cacheReference", Boolean.TRUE);
}
// Perform the signature operation
signature.sign(context);
// Log the pre-digest data for debugging
if (isDebugPreDigest() && log.isDebugEnabled()) {
Reference ref = (Reference) signature.getSignedInfo().getReferences().get(0);
String preDigest = CharStreams.toString(new InputStreamReader(ref.getDigestInputStream(), "UTF-8"));
log.debug("pre digest: {}", preDigest);
}
} catch (Exception e) {
log.error("Unable to create signature for element", e);
throw new StageProcessingException("Unable to create signature for element", e);
}
return true;
}
代码示例来源:origin: org.apache.santuario/xmlsec
KeySelectorResult keySelectorResult = signContext.getKeySelector().select(ki,
KeySelector.Purpose.SIGN,
si.getSignatureMethod(),
代码示例来源:origin: be.fedict.eid-idp/eid-idp-common-saml2
signContext.putNamespacePrefix(
javax.xml.crypto.dsig.XMLSignature.XMLNS, "ds");
javax.xml.crypto.dsig.DigestMethod digestMethod = signatureFactory
代码示例来源:origin: com.hynnet/xws-security
try {
sm = si.getSignatureMethod();
keySelectoResult = xMLSignContext.getKeySelector().select(getKeyInfo(),KeySelector.Purpose.SIGN,sm,xMLSignContext);
signingKey = keySelectoResult.getKey();
if (signingKey == null) {
throw new XMLSignatureException("The KeySelector"+ xMLSignContext.getKeySelector()+ " did not " +
"find the key used for signing");
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j
signContext.putNamespacePrefix(WSConstants.SIG_NS, WSConstants.SIG_PREFIX);
if (WSConstants.C14N_EXCL_OMIT_COMMENTS.equals(canonAlgo)) {
signContext.putNamespacePrefix(
WSConstants.C14N_EXCL_OMIT_COMMENTS,
WSConstants.C14N_EXCL_OMIT_COMMENTS_PREFIX
);
signContext.setProperty(STRTransform.TRANSFORM_WS_DOC_INFO, wsDocInfo);
wsDocInfo.setCallbackLookup(callbackLookup);
代码示例来源:origin: org.apache.ws.security/wss4j
signContext.putNamespacePrefix(WSConstants.SIG_NS, WSConstants.SIG_PREFIX);
if (WSConstants.C14N_EXCL_OMIT_COMMENTS.equals(canonAlgo)) {
signContext.putNamespacePrefix(
WSConstants.C14N_EXCL_OMIT_COMMENTS,
WSConstants.C14N_EXCL_OMIT_COMMENTS_PREFIX
);
signContext.setProperty(STRTransform.TRANSFORM_WS_DOC_INFO, wsDocInfo);
wsDocInfo.setCallbackLookup(callbackLookup);
代码示例来源:origin: org.apache.ws.security/wss4j
signContext.putNamespacePrefix(WSConstants.SIG_NS, WSConstants.SIG_PREFIX);
if (WSConstants.C14N_EXCL_OMIT_COMMENTS.equals(canonAlgo)) {
signContext.putNamespacePrefix(
WSConstants.C14N_EXCL_OMIT_COMMENTS,
WSConstants.C14N_EXCL_OMIT_COMMENTS_PREFIX
);
signContext.setProperty(STRTransform.TRANSFORM_WS_DOC_INFO, wsDocInfo);
wsDocInfo.setCallbackLookup(callbackLookup);
代码示例来源:origin: org.apache.wss4j/wss4j-ws-security-dom
signContext.putNamespacePrefix(WSConstants.SIG_NS, WSConstants.SIG_PREFIX);
if (WSConstants.C14N_EXCL_OMIT_COMMENTS.equals(canonAlgo)) {
signContext.putNamespacePrefix(
WSConstants.C14N_EXCL_OMIT_COMMENTS,
WSConstants.C14N_EXCL_OMIT_COMMENTS_PREFIX
);
signContext.setProperty(STRTransform.TRANSFORM_WS_DOC_INFO, getWsDocInfo());
getWsDocInfo().setCallbackLookup(callbackLookup);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j
signContext.putNamespacePrefix(WSConstants.SIG_NS, WSConstants.SIG_PREFIX);
if (WSConstants.C14N_EXCL_OMIT_COMMENTS.equals(canonAlgo)) {
signContext.putNamespacePrefix(
WSConstants.C14N_EXCL_OMIT_COMMENTS,
WSConstants.C14N_EXCL_OMIT_COMMENTS_PREFIX
);
signContext.setProperty(STRTransform.TRANSFORM_WS_DOC_INFO, wsDocInfo);
wsDocInfo.setCallbackLookup(callbackLookup);
代码示例来源:origin: org.apache.wss4j/wss4j-ws-security-dom
signContext = new DOMSignContext(key, securityHeaderElement);
signContext.putNamespacePrefix(WSConstants.SIG_NS, WSConstants.SIG_PREFIX);
if (WSConstants.C14N_EXCL_OMIT_COMMENTS.equals(getSigCanonicalization())) {
signContext.putNamespacePrefix(
WSConstants.C14N_EXCL_OMIT_COMMENTS,
WSConstants.C14N_EXCL_OMIT_COMMENTS_PREFIX
);
signContext.setProperty(STRTransform.TRANSFORM_WS_DOC_INFO, getWsDocInfo());
getWsDocInfo().setCallbackLookup(callbackLookup);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j
signContext = new DOMSignContext(key, securityHeaderElement);
signContext.putNamespacePrefix(WSConstants.SIG_NS, WSConstants.SIG_PREFIX);
if (WSConstants.C14N_EXCL_OMIT_COMMENTS.equals(canonAlgo)) {
signContext.putNamespacePrefix(
WSConstants.C14N_EXCL_OMIT_COMMENTS,
WSConstants.C14N_EXCL_OMIT_COMMENTS_PREFIX
);
signContext.setProperty(STRTransform.TRANSFORM_WS_DOC_INFO, wsDocInfo);
wsDocInfo.setCallbackLookup(callbackLookup);
代码示例来源:origin: org.apache.ws.security/wss4j
signContext = new DOMSignContext(key, securityHeaderElement);
signContext.putNamespacePrefix(WSConstants.SIG_NS, WSConstants.SIG_PREFIX);
if (WSConstants.C14N_EXCL_OMIT_COMMENTS.equals(canonAlgo)) {
signContext.putNamespacePrefix(
WSConstants.C14N_EXCL_OMIT_COMMENTS,
WSConstants.C14N_EXCL_OMIT_COMMENTS_PREFIX
);
signContext.setProperty(STRTransform.TRANSFORM_WS_DOC_INFO, wsDocInfo);
wsDocInfo.setCallbackLookup(callbackLookup);
内容来源于网络,如有侵权,请联系作者删除!