Skip to content

Commit

Permalink
#74 Not existing IMAP init config leads to NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
shmelev-haulmont committed Oct 28, 2018
1 parent 14138bc commit 4dbf131
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ public DefaultEncryptor(ImapEncryptionConfig imapConfig) {

@PostConstruct
void initKey() {
if (StringUtils.isBlank(imapConfig.getEncryptionKey())) {
throw new IllegalStateException(String.format(
"Cannot configure encryptor %s, property \"imap.encryption.key\" is not set",
getClass().getName()
));
}
byte[] encryptionKey = Base64.getDecoder().decode(imapConfig.getEncryptionKey());
secretKey = new SecretKeySpec(encryptionKey, "AES");

Expand Down

0 comments on commit 4dbf131

Please sign in to comment.