diff --git a/modules/core/src/com/haulmont/addon/imap/crypto/DefaultEncryptor.java b/modules/core/src/com/haulmont/addon/imap/crypto/DefaultEncryptor.java index e952672..7805ab8 100644 --- a/modules/core/src/com/haulmont/addon/imap/crypto/DefaultEncryptor.java +++ b/modules/core/src/com/haulmont/addon/imap/crypto/DefaultEncryptor.java @@ -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");