use of com.sun.org.apache.xml.internal.security.keys.content.keyvalues.DSAKeyValue in project jdk8u_jdk by JetBrains.
the class KeyValue method getPublicKey.
/**
* Method getPublicKey
*
* @return the public key
* @throws XMLSecurityException
*/
public PublicKey getPublicKey() throws XMLSecurityException {
Element rsa = XMLUtils.selectDsNode(this.constructionElement.getFirstChild(), Constants._TAG_RSAKEYVALUE, 0);
if (rsa != null) {
RSAKeyValue kv = new RSAKeyValue(rsa, this.baseURI);
return kv.getPublicKey();
}
Element dsa = XMLUtils.selectDsNode(this.constructionElement.getFirstChild(), Constants._TAG_DSAKEYVALUE, 0);
if (dsa != null) {
DSAKeyValue kv = new DSAKeyValue(dsa, this.baseURI);
return kv.getPublicKey();
}
return null;
}
use of com.sun.org.apache.xml.internal.security.keys.content.keyvalues.DSAKeyValue in project jdk8u_jdk by JetBrains.
the class DSAKeyValueResolver method engineLookupAndResolvePublicKey.
/**
* Method engineResolvePublicKey
*
* @param element
* @param BaseURI
* @param storage
* @return null if no {@link PublicKey} could be obtained
*/
public PublicKey engineLookupAndResolvePublicKey(Element element, String BaseURI, StorageResolver storage) {
if (element == null) {
return null;
}
Element dsaKeyElement = null;
boolean isKeyValue = XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYVALUE);
if (isKeyValue) {
dsaKeyElement = XMLUtils.selectDsNode(element.getFirstChild(), Constants._TAG_DSAKEYVALUE, 0);
} else if (XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_DSAKEYVALUE)) {
// this trick is needed to allow the RetrievalMethodResolver to eat a
// ds:DSAKeyValue directly (without KeyValue)
dsaKeyElement = element;
}
if (dsaKeyElement == null) {
return null;
}
try {
DSAKeyValue dsaKeyValue = new DSAKeyValue(dsaKeyElement, BaseURI);
PublicKey pk = dsaKeyValue.getPublicKey();
return pk;
} catch (XMLSecurityException ex) {
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, ex.getMessage(), ex);
}
//do nothing
}
return null;
}
Aggregations