PrivateKey key = (PrivateKey) keystore.getKey(alias, (char[])keyPasswords.get(alias));
// generate csr
String csr = generateCSR(cert, key);
return csr;
} catch (KeyStoreException e) {
throw new KeystoreException("Unable to generate CSR in keystore '" + keystoreName + "' for alias '" + alias + "'", e);
} catch (NoSuchAlgorithmException e) {
throw new KeystoreException("Unable to generate CSR in keystore '" + keystoreName + "' for alias '" + alias + "'", e);
} catch (UnrecoverableKeyException e) {
throw new KeystoreException("Unable to generate CSR in keystore '" + keystoreName + "' for alias '" + alias + "'", e);
} catch (InvalidKeyException e) {
throw new KeystoreException("Unable to generate CSR in keystore '" + keystoreName + "' for alias '" + alias + "'", e);
} catch (NoSuchProviderException e) {
throw new KeystoreException("Unable to generate CSR in keystore '" + keystoreName + "' for alias '" + alias + "'", e);
} catch (SignatureException e) {
throw new KeystoreException("Unable to generate CSR in keystore '" + keystoreName + "' for alias '" + alias + "'", e);
} catch (IOException e) {
throw new KeystoreException("Unable to generate CSR in keystore '" + keystoreName + "' for alias '" + alias + "'", e);
}
}