本文整理汇总了Java中javax.xml.crypto.dsig.XMLValidateContext类的典型用法代码示例。如果您正苦于以下问题:Java XMLValidateContext类的具体用法?Java XMLValidateContext怎么用?Java XMLValidateContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XMLValidateContext类属于javax.xml.crypto.dsig包,在下文中一共展示了XMLValidateContext类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getXMLValidateContext
import javax.xml.crypto.dsig.XMLValidateContext; //导入依赖的package包/类
public static XMLValidateContext getXMLValidateContext(String type,
File input,
String tag)
throws Exception {
if (type.equalsIgnoreCase("dom")) {
DocumentBuilder docBuilder = XMLUtils.createDocumentBuilder(false, false);
Document doc = docBuilder.parse(input);
if (tag == null) {
return new DOMValidateContext
(TestUtils.getPublicKey("RSA", 512),
doc.getDocumentElement());
} else {
NodeList list = doc.getElementsByTagName(tag);
return new DOMValidateContext
(TestUtils.getPublicKey("RSA", 512), list.item(0));
}
} else {
throw new Exception("Unsupported XMLValidateContext type: " + type);
}
}
示例2: validate
import javax.xml.crypto.dsig.XMLValidateContext; //导入依赖的package包/类
public boolean validate(XMLValidateContext vCtx)
throws XMLSignatureException {
this.dis = new ByteArrayInputStream(id.getBytes());
this.derefData = new OctetStreamData(this.dis);
return status;
}
示例3: unmarshalXMLSignature
import javax.xml.crypto.dsig.XMLValidateContext; //导入依赖的package包/类
public XMLSignature unmarshalXMLSignature(XMLValidateContext context) throws MarshalException {
throw new UnsupportedOperationException();
}
示例4: verify
import javax.xml.crypto.dsig.XMLValidateContext; //导入依赖的package包/类
/**
* Verifies the passed-in signature with the specified key, using the
* underlying Signature or Mac algorithm.
*
* @param key the verification key
* @param si the SignedInfo
* @param sig the signature bytes to be verified
* @param context the XMLValidateContext
* @return <code>true</code> if the signature verified successfully,
* <code>false</code> if not
* @throws NullPointerException if <code>key</code>, <code>si</code> or
* <code>sig</code> are <code>null</code>
* @throws InvalidKeyException if the key is improperly encoded, of
* the wrong type, or parameters are missing, etc
* @throws SignatureException if an unexpected error occurs, such
* as the passed in signature is improperly encoded
* @throws XMLSignatureException if an unexpected error occurs
*/
abstract boolean verify(Key key, SignedInfo si, byte[] sig,
XMLValidateContext context)
throws InvalidKeyException, SignatureException, XMLSignatureException;
示例5: verify
import javax.xml.crypto.dsig.XMLValidateContext; //导入依赖的package包/类
/**
* Verifies the passed-in signature with the specified key, using the
* underlying Signature or Mac algorithm.
*
* @param key the verification key
* @param si the SignedInfo
* @param sig the signature bytes to be verified
* @param context the XMLValidateContext
* @return <code>true</code> if the signature verified successfully,
* <code>false</code> if not
* @throws NullPointerException if <code>key</code>, <code>si</code> or
* <code>sig</code> are <code>null</code>
* @throws InvalidKeyException if the key is improperly encoded, of
* the wrong type, or parameters are missing, etc
* @throws SignatureException if an unexpected error occurs, such
* as the passed in signature is improperly encoded
* @throws XMLSignatureException if an unexpected error occurs
*/
abstract boolean verify(Key key, DOMSignedInfo si, byte[] sig,
XMLValidateContext context)
throws InvalidKeyException, SignatureException, XMLSignatureException;