keyUsage != UserCredentialManager.KEY_USAGE_NON_REPUDIATION) {
throw new IllegalArgumentException("Invalid key usage");
}
if (! algorithm.equals(UserCredentialManager.ALGORITHM_RSA)) {
throw new UserCredentialManagerException(
UserCredentialManagerException.SE_NO_KEYS);
}
int slotCount = APDUManager.getSlotCount();
while (true) {
for (int i = 0; i < slotCount; i++) {
WIMApplication w = WIMApplication.getInstance(
classSecurityToken, i, securityElementID, false);
if (w == null) {
continue;
}
try {
Vector CSRs = loadCSRList();
byte[] CSR = w.generateCSR(nameInfo, keyLen,
keyUsage, forceKeyGen, CSRs);
storeCSRList(CSRs);
return CSR;
} finally {
w.done();
}
}
// WIM application is not found
if (securityElementPrompt != null) {
try {
if (MessageDialog.showMessage(classSecurityToken,
Resource.getString(ResourceConstants
.JSR177_WIM_NOT_FOUND),
securityElementPrompt,
true) != -1) {
continue;
}
} catch (InterruptedException e) {}
}
throw new UserCredentialManagerException(
UserCredentialManagerException.SE_NOT_FOUND);
}
}