本文整理匯總了Java中java.security.KeyException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java KeyException.getMessage方法的具體用法?Java KeyException.getMessage怎麽用?Java KeyException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.security.KeyException
的用法示例。
在下文中一共展示了KeyException.getMessage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import java.security.KeyException; //導入方法依賴的package包/類
@Override
public void init(ConnectionInfo connectionInfo) throws SchedulerException, LoginException {
this.connectionInfo = connectionInfo;
if (connectionInfo.getCredentialFile() != null) {
try {
Credentials credentials = Credentials.getCredentials(connectionInfo.getCredentialFile()
.getAbsolutePath());
init(connectionInfo.getUrl(), credentials);
} catch (KeyException e) {
throw new LoginException(e.getMessage());
}
} else {
CredData cred = new CredData(CredData.parseLogin(connectionInfo.getLogin()),
CredData.parseDomain(connectionInfo.getLogin()),
connectionInfo.getPassword());
init(connectionInfo.getUrl(), cred);
}
}
示例2: select
import java.security.KeyException; //導入方法依賴的package包/類
public KeySelectorResult select(KeyInfo keyInfo, KeySelector.Purpose purpose,
AlgorithmMethod method, XMLCryptoContext context) throws KeySelectorException {
if (keyInfo == null)
throw new KeySelectorException("Null KeyInfo");
List<?> list = keyInfo.getContent();
PublicKey pk = null;
for (int i = 0; i < list.size(); i++) {
XMLStructure xmlStructure = (XMLStructure) list.get(i);
if (xmlStructure instanceof KeyValue) {
try {
pk = ((KeyValue)xmlStructure).getPublicKey();
} catch(KeyException ke) {
throw new KeySelectorException(ke.getMessage());
}
break;
} else if (xmlStructure instanceof X509Data) {
X509Data x509data = (X509Data)xmlStructure;
List<?> x509datalist = x509data.getContent();
for (int j = 0; j < x509datalist.size(); j++) {
if (x509datalist.get(j) instanceof X509Certificate) {
X509Certificate cert = (X509Certificate)x509datalist.get(j);
pk = cert.getPublicKey();
break;
}
}
}
}
if (pk != null) {
final PublicKey retpk = pk;
logger.debug("PublicKey from XML=" + pk);
return new KeySelectorResult() {public Key getKey(){return retpk;}};
}
throw new KeySelectorException("Missing KeyValue");
}