KeyInfo keyInfo = new KeyInfo(keyInfoElem, null);
if (keyInfo.containsKeyValue()) {
return keyInfo.itemKeyValue(0).getPublicKey();
} else if (keyInfo.containsX509Data()) {
return resolveX509Data(keyInfo.itemX509Data(0), callbackHandler);
} else if(keyInfo.length(EncryptionConstants.EncryptionSpecNS, EncryptionConstants._TAG_ENCRYPTEDKEY) > 0){
return resolveEncryptedKey(keyInfo.itemEncryptedKey(0), callbackHandler);
}
else {
throw new XWSSecurityException("Unsupported Key Information");