Skip to content

Commit

Permalink
Merge pull request #785 from soul2zimate/JBEAP-10476
Browse files Browse the repository at this point in the history
[JBEAP-10476] [ELY-1097] Different message if keyAlias does not exist.
  • Loading branch information
darranl committed Apr 28, 2017
2 parents 84621d1 + e1279af commit 0bdd85d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1885,4 +1885,7 @@ public interface ElytronMessages extends BasicLogger {

@Message(id = 11005, value = "Invalid unicode endoding, offending sequence: %s.")
IOException invalidUnicodeSequence(String s, @Cause NoSuchElementException nsee);

@Message(id = 11006, value = "External storage key under alias \"%s\" does not exist")
CredentialStoreException externalStorageKeyDoesNotExist(String keyAlias);
}
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,9 @@ void init(String cryptographicAlgorithm, String keyAlias, KeyStore keyStore, cha
private void fetchStorageSecretKey(String keyAlias, char[] keyPassword) throws CertificateException, NoSuchAlgorithmException, IOException, CredentialStoreException, UnrecoverableEntryException, KeyStoreException {
storageSecretKeyStore.load(null, keyPassword);
KeyStore.Entry entry = storageSecretKeyStore.getEntry(keyAlias, new KeyStore.PasswordProtection(keyPassword));
if (entry == null) {
throw log.externalStorageKeyDoesNotExist(keyAlias);
}
if (! (entry instanceof KeyStore.SecretKeyEntry)) {
throw log.wrongTypeOfExternalStorageKey(keyAlias);
}
Expand Down

0 comments on commit 0bdd85d

Please sign in to comment.