我需要对转换http://www.w3.org/2001/10/xml-exc-c14n#使用以下算法,但是Java Digital Signature API不支持该算法。转换界面只有:
package javax.xml.crypto.dsig;
import java.io.OutputStream;
import java.security.spec.AlgorithmParameterSpec;
import javax.xml.crypto.AlgorithmMethod;
import javax.xml.crypto.Data;
import javax.xml.crypto.XMLCryptoContext;
import javax.xml.crypto.XMLStructure;
public interface Transform extends XMLStructure, AlgorithmMethod {
String BASE64 = "http://www.w3.org/2000/09/xmldsig#base64";
String ENVELOPED = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
String XPATH = "http://www.w3.org/TR/1999/REC-xpath-19991116";
String XPATH2 = "http://www.w3.org/2002/06/xmldsig-filter2";
String XSLT = "http://www.w3.org/TR/1999/REC-xslt-19991116";
AlgorithmParameterSpec getParameterSpec();
Data transform(Data var1, XMLCryptoContext var2) throws TransformException;
Data transform(Data var1, XMLCryptoContext var2, OutputStream var3) throws TransformException;
}
我看错地方了吗?还是不支持?
我有以下代码:
Reference ref = fac.newReference
("", fac.newDigestMethod(DigestMethod.SHA1, null), //TODO: use different algo
Collections.singletonList
(fac.newTransform(Transform.ENVELOPED,
(TransformParameterSpec) null)), null, null);
我可以使用CanonicalizationMethod.EXCLUSIVE代替Transform.ENVELOPED?这是否意味着我的转换因为没有列出的算法而无法使用?拜托,我需要建议。