本文整理匯總了Java中java.security.KeyStore.LoadStoreParameter方法的典型用法代碼示例。如果您正苦於以下問題:Java KeyStore.LoadStoreParameter方法的具體用法?Java KeyStore.LoadStoreParameter怎麽用?Java KeyStore.LoadStoreParameter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.security.KeyStore
的用法示例。
在下文中一共展示了KeyStore.LoadStoreParameter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: engineLoad
import java.security.KeyStore; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public void engineLoad(final KeyStore.LoadStoreParameter param) throws IOException {
if (param != null) {
final ProtectionParameter pp = param.getProtectionParameter();
if (pp instanceof KeyStore.CallbackHandlerProtection) {
if (((KeyStore.CallbackHandlerProtection) pp).getCallbackHandler() == null) {
throw new IllegalArgumentException("El CallbackHandler no puede ser nulo"); //$NON-NLS-1$
}
this.cryptoCard = new Ceres(
CeresProvider.getDefaultApduConnection(),
new JseCryptoHelper()
);
this.cryptoCard.setCallbackHandler(((KeyStore.CallbackHandlerProtection) pp).getCallbackHandler());
}
else if (pp instanceof KeyStore.PasswordProtection) {
final PasswordCallback pwc = new CeresPasswordCallback((PasswordProtection) pp);
this.cryptoCard = new Ceres(
CeresProvider.getDefaultApduConnection(),
new JseCryptoHelper()
);
this.cryptoCard.setPasswordCallback(pwc);
}
else {
Logger.getLogger("es.gob.jmulticard").warning( //$NON-NLS-1$
"Se ha proporcionado un LoadStoreParameter de tipo no soportado, se ignorara: " + (pp != null ? pp.getClass().getName() : "NULO") //$NON-NLS-1$ //$NON-NLS-2$
);
}
}
else {
this.cryptoCard = new Ceres(
CeresProvider.getDefaultApduConnection(),
new JseCryptoHelper()
);
}
userCertAliases = Arrays.asList(this.cryptoCard.getAliases());
}
示例2: engineLoad
import java.security.KeyStore; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public void engineLoad(final KeyStore.LoadStoreParameter param) throws IOException {
if (param != null) {
final ProtectionParameter pp = param.getProtectionParameter();
if (pp instanceof KeyStore.CallbackHandlerProtection) {
if (((KeyStore.CallbackHandlerProtection) pp).getCallbackHandler() == null) {
throw new IllegalArgumentException("El CallbackHandler no puede ser nulo"); //$NON-NLS-1$
}
this.cryptoCard = DnieFactory.getDnie(
DnieProvider.getDefaultApduConnection(),
null,
new JseCryptoHelper(),
((KeyStore.CallbackHandlerProtection) pp).getCallbackHandler()
);
}
else if (pp instanceof KeyStore.PasswordProtection) {
final PasswordCallback pwc = new DniePasswordCallback((PasswordProtection) pp);
this.cryptoCard = DnieFactory.getDnie(
DnieProvider.getDefaultApduConnection(),
pwc,
new JseCryptoHelper(),
null
);
}
else {
LOGGER.warning(
"Se ha proporcionado un LoadStoreParameter de tipo no soportado, se ignorara: " + (pp != null ? pp.getClass().getName() : "NULO") //$NON-NLS-1$ //$NON-NLS-2$
);
}
}
else {
this.cryptoCard = DnieFactory.getDnie(
DnieProvider.getDefaultApduConnection(),
null,
new JseCryptoHelper(),
null
);
}
this.aliases = Arrays.asList(this.cryptoCard.getAliases());
}