本文整理汇总了Java中javax.xml.crypto.dsig.TransformService类的典型用法代码示例。如果您正苦于以下问题:Java TransformService类的具体用法?Java TransformService怎么用?Java TransformService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TransformService类属于javax.xml.crypto.dsig包,在下文中一共展示了TransformService类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import javax.xml.crypto.dsig.TransformService; //导入依赖的package包/类
public static void main(String[] args) throws NoSuchAlgorithmException {
try {
TransformService ts = TransformService.getInstance(
Transform.BASE64, "DOM", "SomeProviderThatDoesNotExist");
}
catch(NoSuchProviderException e) {
// this is expected
}
}
示例2: DOMTransform
import javax.xml.crypto.dsig.TransformService; //导入依赖的package包/类
/**
* Creates a <code>DOMTransform</code> from an element. It unmarshals any
* algorithm-specific input parameters.
*
* @param transElem a Transform element
*/
public DOMTransform(Element transElem, XMLCryptoContext context,
Provider provider)
throws MarshalException
{
String algorithm = DOMUtils.getAttributeValue(transElem, "Algorithm");
if (provider == null) {
try {
spi = TransformService.getInstance(algorithm, "DOM");
} catch (NoSuchAlgorithmException e1) {
throw new MarshalException(e1);
}
} else {
try {
spi = TransformService.getInstance(algorithm, "DOM", provider);
} catch (NoSuchAlgorithmException nsae) {
try {
spi = TransformService.getInstance(algorithm, "DOM");
} catch (NoSuchAlgorithmException e2) {
throw new MarshalException(e2);
}
}
}
try {
spi.init(new javax.xml.crypto.dom.DOMStructure(transElem), context);
} catch (InvalidAlgorithmParameterException iape) {
throw new MarshalException(iape);
}
}
示例3: newTransform
import javax.xml.crypto.dsig.TransformService; //导入依赖的package包/类
public Transform newTransform(String algorithm, XMLStructure params) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
TransformService spi;
try {
spi = TransformService.getInstance(algorithm, "DOM");
} catch (NoSuchAlgorithmException nsae) {
spi = TransformService.getInstance(algorithm, "DOM", getProvider());
}
if (params == null) {
spi.init(null);
} else {
spi.init(params, null);
}
return new DOMTransform(spi);
}
示例4: dsig
import javax.xml.crypto.dsig.TransformService; //导入依赖的package包/类
public void dsig() throws Exception {
Provider p = Security.getProvider("ApacheXMLDSig");
TransformService.getInstance(Transform.XPATH, "DOM", p);
}