本文整理汇总了Java中org.apache.xml.security.keys.keyresolver.KeyResolverException类的典型用法代码示例。如果您正苦于以下问题:Java KeyResolverException类的具体用法?Java KeyResolverException怎么用?Java KeyResolverException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KeyResolverException类属于org.apache.xml.security.keys.keyresolver包,在下文中一共展示了KeyResolverException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: engineLookupAndResolvePublicKey
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/**
* Method engineLookupAndResolvePublicKey
*
* @param element
* @param baseURI
* @param storage
* @return null if no {@link PublicKey} could be obtained
* @throws KeyResolverException
*/
public PublicKey engineLookupAndResolvePublicKey(
Element element, String baseURI, StorageResolver storage
) throws KeyResolverException {
if (log.isDebugEnabled()) {
log.debug("Can I resolve " + element.getTagName() + "?");
}
if (publicKey != null
&& XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYNAME)) {
String name = element.getFirstChild().getNodeValue();
if (keyName.equals(name)) {
return publicKey;
}
}
log.debug("I can't");
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:28,代码来源:SingleKeyResolver.java
示例2: engineResolveSecretKey
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/**
* Method engineResolveSecretKey
*
* @param element
* @param baseURI
* @param storage
* @return resolved SecretKey key or null if no {@link SecretKey} could be obtained
*
* @throws KeyResolverException
*/
public SecretKey engineResolveSecretKey(
Element element, String baseURI, StorageResolver storage
) throws KeyResolverException {
if (log.isDebugEnabled()) {
log.debug("Can I resolve " + element.getTagName() + "?");
}
if (secretKey != null
&& XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYNAME)) {
String name = element.getFirstChild().getNodeValue();
if (keyName.equals(name)) {
return secretKey;
}
}
log.debug("I can't");
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:29,代码来源:SingleKeyResolver.java
示例3: engineLookupAndResolvePrivateKey
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/**
* Method engineResolvePrivateKey
* @inheritDoc
* @param element
* @param baseURI
* @param storage
* @return resolved PrivateKey key or null if no {@link PrivateKey} could be obtained
* @throws KeyResolverException
*/
public PrivateKey engineLookupAndResolvePrivateKey(
Element element, String baseURI, StorageResolver storage
) throws KeyResolverException {
if (log.isDebugEnabled()) {
log.debug("Can I resolve " + element.getTagName() + "?");
}
if (privateKey != null
&& XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYNAME)) {
String name = element.getFirstChild().getNodeValue();
if (keyName.equals(name)) {
return privateKey;
}
}
log.debug("I can't");
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:28,代码来源:SingleKeyResolver.java
示例4: engineLookupAndResolvePublicKey
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/** {@inheritDoc}. */
public PublicKey engineLookupAndResolvePublicKey(Element element, String baseURI, StorageResolver storage)
throws KeyResolverException {
if (log.isDebugEnabled()) {
log.debug("Can I resolve " + element.getTagName());
}
if (!engineCanResolve(element, baseURI, storage)) {
return null;
}
try {
KeyInfo referent = resolveReferentKeyInfo(element, baseURI, storage);
if (referent != null) {
return referent.getPublicKey();
}
} catch (XMLSecurityException e) {
if (log.isDebugEnabled()) {
log.debug("XMLSecurityException", e);
}
}
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:26,代码来源:KeyInfoReferenceResolver.java
示例5: engineLookupResolveX509Certificate
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/** {@inheritDoc}. */
public X509Certificate engineLookupResolveX509Certificate(Element element, String baseURI, StorageResolver storage)
throws KeyResolverException {
if (log.isDebugEnabled()) {
log.debug("Can I resolve " + element.getTagName());
}
if (!engineCanResolve(element, baseURI, storage)) {
return null;
}
try {
KeyInfo referent = resolveReferentKeyInfo(element, baseURI, storage);
if (referent != null) {
return referent.getX509Certificate();
}
} catch (XMLSecurityException e) {
if (log.isDebugEnabled()) {
log.debug("XMLSecurityException", e);
}
}
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:26,代码来源:KeyInfoReferenceResolver.java
示例6: engineLookupAndResolveSecretKey
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/** {@inheritDoc}. */
public SecretKey engineLookupAndResolveSecretKey(Element element, String baseURI, StorageResolver storage)
throws KeyResolverException {
if (log.isDebugEnabled()) {
log.debug("Can I resolve " + element.getTagName());
}
if (!engineCanResolve(element, baseURI, storage)) {
return null;
}
try {
KeyInfo referent = resolveReferentKeyInfo(element, baseURI, storage);
if (referent != null) {
return referent.getSecretKey();
}
} catch (XMLSecurityException e) {
if (log.isDebugEnabled()) {
log.debug("XMLSecurityException", e);
}
}
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:26,代码来源:KeyInfoReferenceResolver.java
示例7: engineLookupAndResolvePrivateKey
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/** {@inheritDoc}. */
public PrivateKey engineLookupAndResolvePrivateKey(Element element, String baseURI, StorageResolver storage)
throws KeyResolverException {
if (log.isDebugEnabled()) {
log.debug("Can I resolve " + element.getTagName());
}
if (!engineCanResolve(element, baseURI, storage)) {
return null;
}
try {
KeyInfo referent = resolveReferentKeyInfo(element, baseURI, storage);
if (referent != null) {
return referent.getPrivateKey();
}
} catch (XMLSecurityException e) {
if (log.isDebugEnabled()) {
log.debug("XMLSecurityException", e);
}
}
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:26,代码来源:KeyInfoReferenceResolver.java
示例8: obtainReferenceElement
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/**
* Resolve the Element effectively represented by the XML signature input source.
*
* @param resource
* @return the Element effectively represented by the XML signature input source.
* @throws CanonicalizationException
* @throws ParserConfigurationException
* @throws IOException
* @throws SAXException
* @throws KeyResolverException
*/
private Element obtainReferenceElement(XMLSignatureInput resource)
throws CanonicalizationException, ParserConfigurationException,
IOException, SAXException, KeyResolverException {
Element e;
if (resource.isElement()){
e = (Element) resource.getSubNode();
} else if (resource.isNodeSet()) {
log.debug("De-reference of KeyInfoReference returned an unsupported NodeSet");
return null;
} else {
// Retrieved resource is a byte stream
byte inputBytes[] = resource.getBytes();
e = getDocFromBytes(inputBytes, this.secureValidation);
}
return e;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:29,代码来源:KeyInfoReferenceResolver.java
示例9: engineResolveSecretKey
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/**
* Method engineResolveSecretKey
*
* @param element
* @param baseURI
* @param storage
* @return resolved SecretKey key or null if no {@link SecretKey} could be obtained
*
* @throws KeyResolverException
*/
public SecretKey engineResolveSecretKey(
Element element, String baseURI, StorageResolver storage
) throws KeyResolverException {
if (log.isDebugEnabled()) {
log.debug("Can I resolve " + element.getTagName() + "?");
}
if (XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYNAME)) {
String keyName = element.getFirstChild().getNodeValue();
try {
Key key = keyStore.getKey(keyName, password);
if (key instanceof SecretKey) {
return (SecretKey) key;
}
} catch (Exception e) {
log.debug("Cannot recover the key", e);
}
}
log.debug("I can't");
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:33,代码来源:SecretKeyResolver.java
示例10: obtainReferenceElement
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
private static Element obtainReferenceElement(XMLSignatureInput resource, boolean secureValidation)
throws CanonicalizationException, ParserConfigurationException,
IOException, SAXException, KeyResolverException {
Element e;
if (resource.isElement()){
e = (Element) resource.getSubNode();
} else if (resource.isNodeSet()) {
// Retrieved resource is a nodeSet
e = getDocumentElement(resource.getNodeSet());
} else {
// Retrieved resource is an inputStream
byte inputBytes[] = resource.getBytes();
e = getDocFromBytes(inputBytes, secureValidation);
// otherwise, we parse the resource, create an Element and delegate
if (log.isDebugEnabled()) {
log.debug("we have to parse " + inputBytes.length + " bytes");
}
}
return e;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:21,代码来源:RetrievalMethodResolver.java
示例11: engineLookupAndResolvePublicKey
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/** {@inheritDoc}. */
public PublicKey engineLookupAndResolvePublicKey(Element element, String baseURI, StorageResolver storage)
throws KeyResolverException {
if (log.isDebugEnabled()) {
log.debug("Can I resolve " + element.getTagName());
}
if (!engineCanResolve(element, baseURI, storage)) {
return null;
}
try {
DEREncodedKeyValue derKeyValue = new DEREncodedKeyValue(element, baseURI);
return derKeyValue.getPublicKey();
} catch (XMLSecurityException e) {
if (log.isDebugEnabled()) {
log.debug("XMLSecurityException", e);
}
}
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:24,代码来源:DEREncodedKeyValueResolver.java
示例12: engineLookupResolveX509Certificate
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/** {@inheritDoc}. */
public X509Certificate engineLookupResolveX509Certificate(Element element, String baseURI, StorageResolver storage)
throws KeyResolverException {
if (log.isDebugEnabled()) {
log.debug("Can I resolve " + element.getTagName());
}
if (!engineCanResolve(element, baseURI, storage)) {
return null;
}
try {
return resolveCertificate(element, baseURI, storage);
} catch (XMLSecurityException e) {
if (log.isDebugEnabled()) {
log.debug("XMLSecurityException", e);
}
}
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:23,代码来源:X509DigestResolver.java
示例13: getPublicKeyFromStaticResolvers
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/**
* Searches the library wide KeyResolvers for public keys
*
* @return The public key contained in this Node.
* @throws KeyResolverException
*/
PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException {
Iterator<KeyResolverSpi> it = KeyResolver.iterator();
while (it.hasNext()) {
KeyResolverSpi keyResolver = it.next();
keyResolver.setSecureValidation(secureValidation);
Node currentChild = getFirstChild();
String uri = this.getBaseURI();
while (currentChild != null) {
if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
for (StorageResolver storage : storageResolvers) {
PublicKey pk =
keyResolver.engineLookupAndResolvePublicKey(
(Element) currentChild, uri, storage
);
if (pk != null) {
return pk;
}
}
}
currentChild = currentChild.getNextSibling();
}
}
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:32,代码来源:KeyInfo.java
示例14: getX509CertificateFromStaticResolvers
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/**
* This method uses each System-wide {@link KeyResolver} to search the
* child elements. Each combination of {@link KeyResolver} and child element
* is checked against all {@link StorageResolver}s.
*
* @return The certificate contained in this KeyInfo
* @throws KeyResolverException
*/
X509Certificate getX509CertificateFromStaticResolvers()
throws KeyResolverException {
if (log.isDebugEnabled()) {
log.debug(
"Start getX509CertificateFromStaticResolvers() with " + KeyResolver.length()
+ " resolvers"
);
}
String uri = this.getBaseURI();
Iterator<KeyResolverSpi> it = KeyResolver.iterator();
while (it.hasNext()) {
KeyResolverSpi keyResolver = it.next();
keyResolver.setSecureValidation(secureValidation);
X509Certificate cert = applyCurrentResolver(uri, keyResolver);
if (cert != null) {
return cert;
}
}
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:29,代码来源:KeyInfo.java
示例15: applyCurrentResolver
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
private X509Certificate applyCurrentResolver(
String uri, KeyResolverSpi keyResolver
) throws KeyResolverException {
Node currentChild = getFirstChild();
while (currentChild != null) {
if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
for (StorageResolver storage : storageResolvers) {
X509Certificate cert =
keyResolver.engineLookupResolveX509Certificate(
(Element) currentChild, uri, storage
);
if (cert != null) {
return cert;
}
}
}
currentChild = currentChild.getNextSibling();
}
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:22,代码来源:KeyInfo.java
示例16: getX509CertificateFromInternalResolvers
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/**
* Method getX509CertificateFromInternalResolvers
*
* @return The certificate contained in this KeyInfo
* @throws KeyResolverException
*/
X509Certificate getX509CertificateFromInternalResolvers()
throws KeyResolverException {
if (log.isDebugEnabled()) {
log.debug(
"Start getX509CertificateFromInternalResolvers() with "
+ this.lengthInternalKeyResolver() + " resolvers"
);
}
String uri = this.getBaseURI();
for (KeyResolverSpi keyResolver : internalKeyResolvers) {
if (log.isDebugEnabled()) {
log.debug("Try " + keyResolver.getClass().getName());
}
keyResolver.setSecureValidation(secureValidation);
X509Certificate cert = applyCurrentResolver(uri, keyResolver);
if (cert != null) {
return cert;
}
}
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:29,代码来源:KeyInfo.java
示例17: engineLookupAndResolveSecretKey
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/**
* Method engineResolveSecretKey
*
* @param element
* @param BaseURI
* @param storage
*
* @throws KeyResolverException
*/
public SecretKey engineLookupAndResolveSecretKey(
Element element, String BaseURI, StorageResolver storage
) throws KeyResolverException {
if (engineCanResolve(element, BaseURI, storage)) {
try {
DESedeKeySpec keySpec =
new DESedeKeySpec("abcdefghijklmnopqrstuvwx".getBytes("ASCII"));
SecretKeyFactory keyFactory =
SecretKeyFactory.getInstance("DESede");
SecretKey key = keyFactory.generateSecret(keySpec);
return key;
}
catch (Exception e) {
throw new KeyResolverException("Something badly wrong in creation of bob's key");
}
}
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:30,代码来源:BobKeyResolver.java
示例18: parseSigGetCertOnly
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
private static X509Certificate parseSigGetCertOnly(Element sigElement)
throws XMLSignatureException, XMLSecurityException, Exception,
KeyResolverException {
org.apache.xml.security.signature.XMLSignature signature = new org.apache.xml.security.signature.XMLSignature(
sigElement, "");
KeyInfo ki = signature.getKeyInfo();
if (ki == null) {
throw new Exception("Did not find KeyInfo");
}
X509Certificate cert = signature.getKeyInfo().getX509Certificate();
System.out.println(cert);
// boolean valid = signature.checkSignatureValue(cert);
return cert;
}
开发者ID:y12studio,项目名称:bkbc-premature,代码行数:18,代码来源:HelloOdfSign.java
示例19: engineLookupAndResolvePublicKey
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/**
* Method engineResolvePublicKey
*
* @param element
* @param baseURI
* @param storage
* @return null if no {@link PublicKey} could be obtained
* @throws KeyResolverException
*/
public PublicKey engineLookupAndResolvePublicKey(
Element element, String baseURI, StorageResolver storage
) throws KeyResolverException {
X509Certificate cert =
this.engineLookupResolveX509Certificate(element, baseURI, storage);
if (cert != null) {
return cert.getPublicKey();
}
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:23,代码来源:X509SKIResolver.java
示例20: engineLookupAndResolvePublicKey
import org.apache.xml.security.keys.keyresolver.KeyResolverException; //导入依赖的package包/类
/** @inheritDoc */
public PublicKey engineLookupAndResolvePublicKey(
Element element, String baseURI, StorageResolver storage
) throws KeyResolverException {
X509Certificate cert =
this.engineLookupResolveX509Certificate(element, baseURI, storage);
if (cert != null) {
return cert.getPublicKey();
}
return null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:15,代码来源:X509IssuerSerialResolver.java
注:本文中的org.apache.xml.security.keys.keyresolver.KeyResolverException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论