本文整理汇总了Java中com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput类的典型用法代码示例。如果您正苦于以下问题:Java XMLSignatureInput类的具体用法?Java XMLSignatureInput怎么用?Java XMLSignatureInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XMLSignatureInput类属于com.sun.org.apache.xml.internal.security.signature包,在下文中一共展示了XMLSignatureInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enginePerformTransform
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; //导入依赖的package包/类
/**
* @inheritDoc
*/
protected XMLSignatureInput enginePerformTransform(
XMLSignatureInput input, OutputStream os, Transform transformObject
) throws TransformationException {
/**
* If the actual input is an octet stream, then the application MUST
* convert the octet stream to an XPath node-set suitable for use by
* Canonical XML with Comments. (A subsequent application of the
* REQUIRED Canonical XML algorithm would strip away these comments.)
*
* ...
*
* The evaluation of this expression includes all of the document's nodes
* (including comments) in the node-set representing the octet stream.
*/
Node signatureElement = transformObject.getElement();
signatureElement = searchSignatureElement(signatureElement);
input.setExcludeNode(signatureElement);
input.addNodeFilter(new EnvelopedNodeFilter(signatureElement));
return input;
}
示例2: enginePerformTransform
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; //导入依赖的package包/类
/** @inheritDoc */
protected XMLSignatureInput enginePerformTransform(
XMLSignatureInput input, OutputStream os, Transform transformObject
) throws CanonicalizationException {
Canonicalizer20010315WithComments c14n = new Canonicalizer20010315WithComments();
if (os != null) {
c14n.setWriter(os);
}
byte[] result = null;
result = c14n.engineCanonicalize(input);
XMLSignatureInput output = new XMLSignatureInput(result);
if (os != null) {
output.setOutputStream(os);
}
return output;
}
示例3: enginePerformTransform
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; //导入依赖的package包/类
protected XMLSignatureInput enginePerformTransform(
XMLSignatureInput input, OutputStream os, Transform transform
) throws CanonicalizationException {
Canonicalizer11_WithComments c14n = new Canonicalizer11_WithComments();
if (os != null) {
c14n.setWriter(os);
}
byte[] result = null;
result = c14n.engineCanonicalize(input);
XMLSignatureInput output = new XMLSignatureInput(result);
if (os != null) {
output.setOutputStream(os);
}
return output;
}
示例4: engineResolveURI
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; //导入依赖的package包/类
/**
* @inheritDoc
*/
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
throws ResourceResolverException {
try {
// calculate new URI
URI uriNew = getNewURI(context.uriToResolve, context.baseUri);
String fileName =
ResolverLocalFilesystem.translateUriToFilename(uriNew.toString());
FileInputStream inputStream = new FileInputStream(fileName);
XMLSignatureInput result = new XMLSignatureInput(inputStream);
result.setSourceURI(uriNew.toString());
return result;
} catch (Exception e) {
throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
}
}
示例5: resolveInput
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; //导入依赖的package包/类
/**
* Resolves the input from the given retrieval method
* @return
* @throws XMLSecurityException
*/
private static XMLSignatureInput resolveInput(
RetrievalMethod rm, String baseURI, boolean secureValidation
) throws XMLSecurityException {
Attr uri = rm.getURIAttr();
// Apply the transforms
Transforms transforms = rm.getTransforms();
ResourceResolver resRes = ResourceResolver.getInstance(uri, baseURI, secureValidation);
XMLSignatureInput resource = resRes.resolve(uri, baseURI, secureValidation);
if (transforms != null) {
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "We have Transforms");
}
resource = transforms.performTransforms(resource);
}
return resource;
}
示例6: copyDerefData
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; //导入依赖的package包/类
private static Data copyDerefData(Data dereferencedData) {
if (dereferencedData instanceof ApacheData) {
// need to make a copy of the Data
ApacheData ad = (ApacheData)dereferencedData;
XMLSignatureInput xsi = ad.getXMLSignatureInput();
if (xsi.isNodeSet()) {
try {
final Set<Node> s = xsi.getNodeSet();
return new NodeSetData() {
public Iterator iterator() { return s.iterator(); }
};
} catch (Exception e) {
// log a warning
log.log(java.util.logging.Level.WARNING, "cannot cache dereferenced data: " + e);
return null;
}
} else if (xsi.isElement()) {
return new DOMSubTreeData
(xsi.getSubNode(), xsi.isExcludeComments());
} else if (xsi.isOctetStream() || xsi.isByteArray()) {
try {
return new OctetStreamData
(xsi.getOctetStream(), xsi.getSourceURI(),
xsi.getMIMEType());
} catch (IOException ioe) {
// log a warning
log.log(java.util.logging.Level.WARNING, "cannot cache dereferenced data: " + ioe);
return null;
}
}
}
return dereferencedData;
}
示例7: circumventBugIfNeeded
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; //导入依赖的package包/类
protected void circumventBugIfNeeded(XMLSignatureInput input)
throws CanonicalizationException, ParserConfigurationException,
IOException, SAXException {
if (!input.isNeedsToBeExpanded()) {
return;
}
Document doc = null;
if (input.getSubNode() != null) {
doc = XMLUtils.getOwnerDocument(input.getSubNode());
} else {
doc = XMLUtils.getOwnerDocument(input.getNodeSet());
}
XMLUtils.circumventBug2650(doc);
}
示例8: getRawCertificate
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; //导入依赖的package包/类
private static X509Certificate getRawCertificate(XMLSignatureInput resource)
throws CanonicalizationException, IOException, CertificateException {
byte inputBytes[] = resource.getBytes();
// if the resource stores a raw certificate, we have to handle it
CertificateFactory certFact =
CertificateFactory.getInstance(XMLX509Certificate.JCA_CERT_ID);
X509Certificate cert = (X509Certificate)
certFact.generateCertificate(new ByteArrayInputStream(inputBytes));
return cert;
}
示例9: enginePerformTransform
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; //导入依赖的package包/类
protected XMLSignatureInput enginePerformTransform(
XMLSignatureInput input, OutputStream os, Transform transform
) throws CanonicalizationException {
Canonicalizer11_OmitComments c14n = new Canonicalizer11_OmitComments();
if (os != null) {
c14n.setWriter(os);
}
byte[] result = null;
result = c14n.engineCanonicalize(input);
XMLSignatureInput output = new XMLSignatureInput(result);
if (os != null) {
output.setOutputStream(os);
}
return output;
}
示例10: enginePerformTransform
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; //导入依赖的package包/类
/**
* Method enginePerformTransform
*
* @param input
* @return {@link XMLSignatureInput} as the result of transformation
* @throws TransformationException
*/
protected XMLSignatureInput enginePerformTransform(
XMLSignatureInput input, OutputStream os, Transform transformObject
) throws TransformationException {
Object exArgs[] = { implementedTransformURI };
throw new TransformationException("signature.Transform.NotYetImplemented", exArgs);
}
示例11: enginePerformTransform
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; //导入依赖的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();
if (os != null) {
c14n.setWriter(os);
}
byte[] result = c14n.engineCanonicalize(input, inclusiveNamespaces);
XMLSignatureInput output = new XMLSignatureInput(result);
if (os != null) {
output.setOutputStream(os);
}
return output;
} catch (XMLSecurityException ex) {
throw new CanonicalizationException("empty", ex);
}
}
示例12: circumventBugIfNeeded
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; //导入依赖的package包/类
protected void circumventBugIfNeeded(XMLSignatureInput input)
throws CanonicalizationException, ParserConfigurationException,
IOException, SAXException {
if (!input.isNeedsToBeExpanded() || inclusiveNSSet.isEmpty() || inclusiveNSSet.isEmpty()) {
return;
}
Document doc = null;
if (input.getSubNode() != null) {
doc = XMLUtils.getOwnerDocument(input.getSubNode());
} else {
doc = XMLUtils.getOwnerDocument(input.getNodeSet());
}
XMLUtils.circumventBug2650(doc);
}
示例13: circumventBugIfNeeded
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; //导入依赖的package包/类
protected void circumventBugIfNeeded(XMLSignatureInput input)
throws CanonicalizationException, ParserConfigurationException, IOException, SAXException {
if (!input.isNeedsToBeExpanded()) {
return;
}
Document doc = null;
if (input.getSubNode() != null) {
doc = XMLUtils.getOwnerDocument(input.getSubNode());
} else {
doc = XMLUtils.getOwnerDocument(input.getNodeSet());
}
XMLUtils.circumventBug2650(doc);
}
示例14: resolveReferentKeyInfo
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; //导入依赖的package包/类
/**
* Resolve the KeyInfoReference Element's URI attribute into a KeyInfo instance.
*
* @param element
* @param baseURI
* @param storage
* @return the KeyInfo which is referred to by this KeyInfoReference, or null if can not be resolved
* @throws XMLSecurityException
*/
private KeyInfo resolveReferentKeyInfo(Element element, String baseURI, StorageResolver storage) throws XMLSecurityException {
KeyInfoReference reference = new KeyInfoReference(element, baseURI);
Attr uriAttr = reference.getURIAttr();
XMLSignatureInput resource = resolveInput(uriAttr, baseURI, secureValidation);
Element referentElement = null;
try {
referentElement = obtainReferenceElement(resource);
} catch (Exception e) {
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "XMLSecurityException", e);
}
return null;
}
if (referentElement == null) {
log.log(java.util.logging.Level.FINE, "De-reference of KeyInfoReference URI returned null: " + uriAttr.getValue());
return null;
}
validateReference(referentElement);
KeyInfo referent = new KeyInfo(referentElement, baseURI);
referent.addStorageResolver(storage);
return referent;
}
示例15: enginePerformTransform
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput; //导入依赖的package包/类
protected XMLSignatureInput enginePerformTransform(
XMLSignatureInput input, OutputStream os, Transform transformObject
) throws CanonicalizationException {
Canonicalizer20010315OmitComments c14n = new Canonicalizer20010315OmitComments();
if (os != null) {
c14n.setWriter(os);
}
byte[] result = null;
result = c14n.engineCanonicalize(input);
XMLSignatureInput output = new XMLSignatureInput(result);
if (os != null) {
output.setOutputStream(os);
}
return output;
}