Viewing this question on SO this question on SO, you should convert the String parameter to a char[]
parameter
Viewing this question on SO, you should convert the String parameter to a char[]
parameter
Viewing this question on SO, you should convert the String parameter to a char[]
parameter
I think this is far better readable, making it easier to understand and/or improve you algorythm.
EDIT
Viewing this question on SO , you should convert the String parameter to a char[]
parameter
I think this is far better readable.
I think this is far better readable, making it easier to understand and/or improve you algorythm.
EDIT
Viewing this question on SO , you should convert the String parameter to a char[]
parameter
I am not quite sure, if it is a good idea, but I personally would insert log entries, that tell you at what point your application crashed and insert a single, but large try-multi catch block at the end of you class. For example:
try {
keyStore = KeyStore.getInstance("JCEKS");
} catch (KeyStoreException ex) {
throw new CryptoException("Error saveKey | KeyStore.getInstance", ex);
}
try {
keyStore.load(null, null);
} catch (IOException | NoSuchAlgorithmException | CertificateException ex) {
throw new CryptoException("Error saveKey | keyStore.load", ex);
}
try {
keyStore.setKeyEntry(userName, key, password.toCharArray(), null);
} catch (KeyStoreException ex) {
throw new CryptoException("Error saveKey | keyStore.setKeyEntry", ex);
}
try {
keyStore.store(new FileOutputStream(userName + ".jceks"), password.toCharArray());
} catch (KeyStoreException | IOException | NoSuchAlgorithmException | CertificateException ex) {
throw new CryptoException("Error saveKey | keyStore.store", ex);
}
would convert to
try {
log.info ("Get an instance of the keyStore");
keyStore = KeyStore.getInstance("JCEKS");
log.info ("load (null,null)");
keyStore.load(null, null);
log.infor ("Set the key entry for the user");
keyStore.setKeyEntry(userName, key, password.toCharArray(), null);
log.info("store in the keystore");
keyStore.store(new FileOutputStream(userName + ".jceks"), password.toCharArray());
} catch (Exception e) {
throw new CryptoException ("Execution failed! See logfile for more info", e);
}
I think this is far better readable.