本文整理汇总了Java中javax.xml.crypto.dom.DOMCryptoContext类的典型用法代码示例。如果您正苦于以下问题:Java DOMCryptoContext类的具体用法?Java DOMCryptoContext怎么用?Java DOMCryptoContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DOMCryptoContext类属于javax.xml.crypto.dom包,在下文中一共展示了DOMCryptoContext类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: marshal
import javax.xml.crypto.dom.DOMCryptoContext; //导入依赖的package包/类
/**
* This method invokes the {@link #marshalParams marshalParams}
* method to marshal any algorithm-specific parameters.
*/
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
throws MarshalException
{
Document ownerDoc = DOMUtils.getOwnerDocument(parent);
Element smElem = DOMUtils.createElement(ownerDoc, "SignatureMethod",
XMLSignature.XMLNS, dsPrefix);
DOMUtils.setAttribute(smElem, "Algorithm", getAlgorithm());
if (getParameterSpec() != null) {
marshalParams(smElem, dsPrefix);
}
parent.appendChild(smElem);
}
示例2: marshal
import javax.xml.crypto.dom.DOMCryptoContext; //导入依赖的package包/类
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
throws MarshalException
{
ownerDoc = DOMUtils.getOwnerDocument(parent);
Element siElem = DOMUtils.createElement(ownerDoc, "SignedInfo",
XMLSignature.XMLNS, dsPrefix);
// create and append CanonicalizationMethod element
DOMCanonicalizationMethod dcm =
(DOMCanonicalizationMethod)canonicalizationMethod;
dcm.marshal(siElem, dsPrefix, context);
// create and append SignatureMethod element
((DOMStructure)signatureMethod).marshal(siElem, dsPrefix, context);
// create and append Reference elements
for (Reference reference : references) {
((DOMReference)reference).marshal(siElem, dsPrefix, context);
}
// append Id attribute
DOMUtils.setAttributeID(siElem, "Id", id);
parent.appendChild(siElem);
localSiElem = siElem;
}
示例3: init
import javax.xml.crypto.dom.DOMCryptoContext; //导入依赖的package包/类
public void init(XMLStructure parent, XMLCryptoContext context)
throws InvalidAlgorithmParameterException
{
if (context != null && !(context instanceof DOMCryptoContext)) {
throw new ClassCastException
("context must be of type DOMCryptoContext");
}
if (parent == null) {
throw new NullPointerException();
}
if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
throw new ClassCastException("parent must be of type DOMStructure");
}
transformElem = (Element)
((javax.xml.crypto.dom.DOMStructure) parent).getNode();
ownerDoc = DOMUtils.getOwnerDocument(transformElem);
}
示例4: marshalParams
import javax.xml.crypto.dom.DOMCryptoContext; //导入依赖的package包/类
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
throws MarshalException
{
if (context != null && !(context instanceof DOMCryptoContext)) {
throw new ClassCastException
("context must be of type DOMCryptoContext");
}
if (parent == null) {
throw new NullPointerException();
}
if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
throw new ClassCastException("parent must be of type DOMStructure");
}
transformElem = (Element)
((javax.xml.crypto.dom.DOMStructure) parent).getNode();
ownerDoc = DOMUtils.getOwnerDocument(transformElem);
}
示例5: marshal
import javax.xml.crypto.dom.DOMCryptoContext; //导入依赖的package包/类
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
throws MarshalException
{
Document ownerDoc = DOMUtils.getOwnerDocument(parent);
Element propElem = DOMUtils.createElement(ownerDoc, "SignatureProperty",
XMLSignature.XMLNS, dsPrefix);
// set attributes
DOMUtils.setAttributeID(propElem, "Id", id);
DOMUtils.setAttribute(propElem, "Target", target);
// create and append any elements and mixed content
for (XMLStructure property : content) {
DOMUtils.appendChild(propElem,
((javax.xml.crypto.dom.DOMStructure)property).getNode());
}
parent.appendChild(propElem);
}
示例6: marshal
import javax.xml.crypto.dom.DOMCryptoContext; //导入依赖的package包/类
/**
* This method invokes the abstract {@link #marshalParams marshalParams}
* method to marshal any algorithm-specific parameters.
*/
public void marshal(Node parent, String prefix, DOMCryptoContext context)
throws MarshalException
{
Document ownerDoc = DOMUtils.getOwnerDocument(parent);
Element dmElem = DOMUtils.createElement(ownerDoc, "DigestMethod",
XMLSignature.XMLNS, prefix);
DOMUtils.setAttribute(dmElem, "Algorithm", getAlgorithm());
if (params != null) {
marshalParams(dmElem, prefix);
}
parent.appendChild(dmElem);
}
示例7: marshal
import javax.xml.crypto.dom.DOMCryptoContext; //导入依赖的package包/类
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
throws MarshalException
{
Document ownerDoc = DOMUtils.getOwnerDocument(parent);
Element propsElem = DOMUtils.createElement(ownerDoc,
"SignatureProperties",
XMLSignature.XMLNS,
dsPrefix);
// set attributes
DOMUtils.setAttributeID(propsElem, "Id", id);
// create and append any properties
for (SignatureProperty property : properties) {
((DOMSignatureProperty)property).marshal(propsElem, dsPrefix,
context);
}
parent.appendChild(propsElem);
}
示例8: init
import javax.xml.crypto.dom.DOMCryptoContext; //导入依赖的package包/类
public void init(XMLStructure parent, XMLCryptoContext context)
throws InvalidAlgorithmParameterException
{
if (context != null && !(context instanceof DOMCryptoContext)) {
throw new ClassCastException
("context must be of type DOMCryptoContext");
}
if (parent == null) {
throw new NullPointerException();
}
if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
throw new ClassCastException("parent must be of type DOMStructure");
}
transformElem = (Element)
((javax.xml.crypto.dom.DOMStructure)parent).getNode();
ownerDoc = DOMUtils.getOwnerDocument(transformElem);
}
示例9: marshalParams
import javax.xml.crypto.dom.DOMCryptoContext; //导入依赖的package包/类
public void marshalParams(XMLStructure parent, XMLCryptoContext context)
throws MarshalException
{
if (context != null && !(context instanceof DOMCryptoContext)) {
throw new ClassCastException
("context must be of type DOMCryptoContext");
}
if (parent == null) {
throw new NullPointerException();
}
if (!(parent instanceof javax.xml.crypto.dom.DOMStructure)) {
throw new ClassCastException("parent must be of type DOMStructure");
}
transformElem = (Element)
((javax.xml.crypto.dom.DOMStructure)parent).getNode();
ownerDoc = DOMUtils.getOwnerDocument(transformElem);
}
示例10: marshal
import javax.xml.crypto.dom.DOMCryptoContext; //导入依赖的package包/类
/**
* This method invokes the abstract {@link #marshalParams marshalParams}
* method to marshal any algorithm-specific parameters.
*/
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
throws MarshalException
{
Document ownerDoc = DOMUtils.getOwnerDocument(parent);
Element transformElem = null;
if (parent.getLocalName().equals("Transforms")) {
transformElem = DOMUtils.createElement(ownerDoc, "Transform",
XMLSignature.XMLNS,
dsPrefix);
} else {
transformElem = DOMUtils.createElement(ownerDoc,
"CanonicalizationMethod",
XMLSignature.XMLNS,
dsPrefix);
}
DOMUtils.setAttribute(transformElem, "Algorithm", getAlgorithm());
spi.marshalParams(new javax.xml.crypto.dom.DOMStructure(transformElem),
context);
parent.appendChild(transformElem);
}
示例11: marshal
import javax.xml.crypto.dom.DOMCryptoContext; //导入依赖的package包/类
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
throws MarshalException
{
Document ownerDoc = DOMUtils.getOwnerDocument(parent);
Element isElem = DOMUtils.createElement(ownerDoc, "X509IssuerSerial",
XMLSignature.XMLNS, dsPrefix);
Element inElem = DOMUtils.createElement(ownerDoc, "X509IssuerName",
XMLSignature.XMLNS, dsPrefix);
Element snElem = DOMUtils.createElement(ownerDoc, "X509SerialNumber",
XMLSignature.XMLNS, dsPrefix);
inElem.appendChild(ownerDoc.createTextNode(issuerName));
snElem.appendChild(ownerDoc.createTextNode(serialNumber.toString()));
isElem.appendChild(inElem);
isElem.appendChild(snElem);
parent.appendChild(isElem);
}
示例12: marshalPublicKey
import javax.xml.crypto.dom.DOMCryptoContext; //导入依赖的package包/类
void marshalPublicKey(Node parent, Document doc, String dsPrefix,
DOMCryptoContext context) throws MarshalException {
Element rsaElem = DOMUtils.createElement(doc, "RSAKeyValue",
XMLSignature.XMLNS,
dsPrefix);
Element modulusElem = DOMUtils.createElement(doc, "Modulus",
XMLSignature.XMLNS,
dsPrefix);
Element exponentElem = DOMUtils.createElement(doc, "Exponent",
XMLSignature.XMLNS,
dsPrefix);
modulus.marshal(modulusElem, dsPrefix, context);
exponent.marshal(exponentElem, dsPrefix, context);
rsaElem.appendChild(modulusElem);
rsaElem.appendChild(exponentElem);
parent.appendChild(rsaElem);
}