本文整理汇总了Java中org.apache.xml.security.transforms.params.InclusiveNamespaces类的典型用法代码示例。如果您正苦于以下问题:Java InclusiveNamespaces类的具体用法?Java InclusiveNamespaces怎么用?Java InclusiveNamespaces使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InclusiveNamespaces类属于org.apache.xml.security.transforms.params包,在下文中一共展示了InclusiveNamespaces类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getInclusiveNamespaces
import org.apache.xml.security.transforms.params.InclusiveNamespaces; //导入依赖的package包/类
public String getInclusiveNamespaces() {
String c14nMethodURI = getCanonicalizationMethodURI();
if (!(c14nMethodURI.equals("http://www.w3.org/2001/10/xml-exc-c14n#") ||
c14nMethodURI.equals("http://www.w3.org/2001/10/xml-exc-c14n#WithComments"))) {
return null;
}
Element inclusiveElement = XMLUtils.getNextElement(c14nMethod.getFirstChild());
if (inclusiveElement != null) {
try {
String inclusiveNamespaces =
new InclusiveNamespaces(
inclusiveElement,
InclusiveNamespaces.ExclusiveCanonicalizationNamespace
).getInclusiveNamespaces();
return inclusiveNamespaces;
} catch (XMLSecurityException e) {
return null;
}
}
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:24,代码来源:SignedInfo.java
示例2: processExclusiveTransform
import org.apache.xml.security.transforms.params.InclusiveNamespaces; //导入依赖的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
示例3: enginePerformTransform
import org.apache.xml.security.transforms.params.InclusiveNamespaces; //导入依赖的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
示例4: doMarshal
import org.apache.xml.security.transforms.params.InclusiveNamespaces; //导入依赖的package包/类
protected List<Node> doMarshal(ExclusiveCanonicalXML alg, Document doc)
{
if (alg.getInclusiveNamespacePrefixes() == null || alg.getInclusiveNamespacePrefixes().isEmpty())
{
return null;
}else
{
InclusiveNamespaces inclusive = new InclusiveNamespaces(doc, alg.getInclusiveNamespacePrefixes());
return Collections.singletonList((Node) inclusive.getElement());
}
}
开发者ID:luisgoncalves,项目名称:xades4j,代码行数:12,代码来源:ExclusiveCanonicalXMLParamsMarshaller.java
示例5: processExclusiveTransform
import org.apache.xml.security.transforms.params.InclusiveNamespaces; //导入依赖的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
示例6: enginePerformTransform
import org.apache.xml.security.transforms.params.InclusiveNamespaces; //导入依赖的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();
}
Canonicalizer20010315ExclOmitComments c14n =
new Canonicalizer20010315ExclOmitComments();
c14n.setSecureValidation(secureValidation);
if (os != null) {
c14n.setWriter(os);
}
byte[] result = c14n.engineCanonicalize(input, inclusiveNamespaces);
XMLSignatureInput output = new XMLSignatureInput(result);
output.setSecureValidation(secureValidation);
if (os != null) {
output.setOutputStream(os);
}
return output;
} catch (XMLSecurityException ex) {
throw new CanonicalizationException(ex);
}
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:42,代码来源:TransformC14NExclusive.java
示例7: sign
import org.apache.xml.security.transforms.params.InclusiveNamespaces; //导入依赖的package包/类
public void sign(List<X509Certificate> certs, PrivateKey key, String sigalg, String digalg) throws Exception {
try {
unsign();
// Build the empty signature.
sig = new XMLSignature(this.doc, "", sigalg, Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
// Have the object place it in the proper place.
root.appendChild(sig.getElement());
Transforms transforms = new Transforms(sig.getDocument());
transforms.addTransform(Transforms.TRANSFORM_ENVELOPED_SIGNATURE);
transforms.addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
transforms.item(1).getElement().appendChild(
new InclusiveNamespaces(this.doc, PolicyConstants.INCLUSIVE_NAMESPACES).getElement());
sig.addDocument("", transforms, (digalg != null) ? digalg : MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1);
// Add any X.509 certificates provided.
X509Data x509 = new X509Data(root.getOwnerDocument());
if (certs != null) {
int count = 0;
for (int i = 0; i < certs.size(); i++) {
X509Certificate cert = certs.get(i);
if (((i + 1) < certs.size()) && count > 0) {
// Last (but not only) cert in chain. Only add if
// it's not self-signed.
if (((X509Certificate) cert).getSubjectDN().equals(((X509Certificate) cert).getIssuerDN()))
break;
}
x509.addCertificate((X509Certificate) cert);
count++;
}
}
if (x509.lengthCertificate() > 0) {
KeyInfo keyinfo = new KeyInfo(root.getOwnerDocument());
keyinfo.add(x509);
sig.getElement().appendChild(keyinfo.getElement());
}
// Finally, sign the thing.
sig.sign(key);
} catch (XMLSecurityException e) {
unsign();
throw new Exception("XML security exception: " + e.getMessage(), e);
}
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:47,代码来源:HostAgreement.java
示例8: sign
import org.apache.xml.security.transforms.params.InclusiveNamespaces; //导入依赖的package包/类
/**
* Sign the SAML object according to the input parameters
*
* @param sigalg The XML signature algorithm to apply
* @param digalg The digest algorithm to apply
* @param k The secret or private key to sign the resulting digest
* @param certs The public key certificate(s) to embed in the object, if any
* @throws SAMLException Thrown if an error occurs while constructing the signature
*/
public void sign(String sigalg, String digalg, Key k, Collection certs)
throws SAMLException
{
unsign();
// Generate the DOM if not already built, and anchor the DOM in the document.
toDOM();
plantRoot();
try
{
// Build the empty signature.
sig=new XMLSignature(root.getOwnerDocument(),"",sigalg,Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
// Have the object place it in the proper place.
insertSignature();
Transforms transforms = new Transforms(sig.getDocument());
transforms.addTransform(Transforms.TRANSFORM_ENVELOPED_SIGNATURE);
transforms.addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
transforms.item(1).getElement().appendChild(
new InclusiveNamespaces(root.getOwnerDocument(),config.getProperty("gov.nih.nci.cagrid.opensaml.inclusive-namespace-prefixes")).getElement()
);
if (config.getBooleanProperty("gov.nih.nci.cagrid.opensaml.compatibility-mode"))
sig.addDocument("",transforms,(digalg!=null) ? digalg : MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1);
else
sig.addDocument("#" + getId(),transforms,(digalg!=null) ? digalg : MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1);
// Add any X.509 certificates provided.
X509Data x509 = new X509Data(root.getOwnerDocument());
if (certs!=null)
{
int count = 0;
Iterator i=certs.iterator();
while (i.hasNext())
{
Object cert=i.next();
if (cert instanceof X509Certificate) {
if (!i.hasNext() && count > 0) {
// Last (but not only) cert in chain. Only add if it's not self-signed.
if (((X509Certificate)cert).getSubjectDN().equals(((X509Certificate)cert).getIssuerDN()))
break;
}
x509.addCertificate((X509Certificate)cert);
}
count++;
}
}
if (x509.lengthCertificate()>0)
{
KeyInfo keyinfo = new KeyInfo(root.getOwnerDocument());
keyinfo.add(x509);
sig.getElement().appendChild(keyinfo.getElement());
}
// Finally, sign the thing.
sig.sign(k);
}
catch (XMLSecurityException e)
{
unsign();
throw new InvalidCryptoException("SAMLSignedObject.sign() detected an XML security exception: " + e.getMessage(),e);
}
}
开发者ID:NCIP,项目名称:cagrid-core,代码行数:74,代码来源:SAMLSignedObject.java
示例9: engineCanonicalizeSubTree
import org.apache.xml.security.transforms.params.InclusiveNamespaces; //导入依赖的package包/类
/**
* Method engineCanonicalizeSubTree
* @param rootNode
* @param inclusiveNamespaces
* @param excl A element to exclude from the c14n process.
* @return the rootNode c14n.
* @throws CanonicalizationException
*/
public byte[] engineCanonicalizeSubTree(
Node rootNode, String inclusiveNamespaces, Node excl
) throws CanonicalizationException{
inclusiveNSSet = InclusiveNamespaces.prefixStr2Set(inclusiveNamespaces);
return super.engineCanonicalizeSubTree(rootNode, excl);
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:15,代码来源:Canonicalizer20010315Excl.java
示例10: engineCanonicalize
import org.apache.xml.security.transforms.params.InclusiveNamespaces; //导入依赖的package包/类
/**
*
* @param rootNode
* @param inclusiveNamespaces
* @return the rootNode c14n.
* @throws CanonicalizationException
*/
public byte[] engineCanonicalize(
XMLSignatureInput rootNode, String inclusiveNamespaces
) throws CanonicalizationException {
inclusiveNSSet = InclusiveNamespaces.prefixStr2Set(inclusiveNamespaces);
return super.engineCanonicalize(rootNode);
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:14,代码来源:Canonicalizer20010315Excl.java
示例11: engineCanonicalizeXPathNodeSet
import org.apache.xml.security.transforms.params.InclusiveNamespaces; //导入依赖的package包/类
/**
* Method engineCanonicalizeXPathNodeSet
* @inheritDoc
* @param xpathNodeSet
* @param inclusiveNamespaces
* @throws CanonicalizationException
*/
public byte[] engineCanonicalizeXPathNodeSet(
Set<Node> xpathNodeSet, String inclusiveNamespaces
) throws CanonicalizationException {
inclusiveNSSet = InclusiveNamespaces.prefixStr2Set(inclusiveNamespaces);
return super.engineCanonicalizeXPathNodeSet(xpathNodeSet);
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:14,代码来源:Canonicalizer20010315Excl.java
注:本文中的org.apache.xml.security.transforms.params.InclusiveNamespaces类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论