Skip to content

Commit

Permalink
#498: Start by adding support for the relevant properties for configu…
Browse files Browse the repository at this point in the history
…rable S/MIME algorithms
  • Loading branch information
bbottema committed Mar 22, 2024
1 parent 13302cd commit e2ec9a7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
* <li>simplejavamail.smime.signing.key_alias</li>
* <li>simplejavamail.smime.signing.key_password</li>
* <li>simplejavamail.smime.encryption.certificate</li>
* <li>simplejavamail.smime.signing.algorithm</li>
* <li>simplejavamail.smime.encryption.key_encapsulation_algorithm</li>
* <li>simplejavamail.smime.encryption.cipher</li>
* <li>simplejavamail.dkim.signing.private_key_file_or_data</li>
* <li>simplejavamail.dkim.signing.selector</li>
* <li>simplejavamail.dkim.signing.signing_domain</li>
Expand Down Expand Up @@ -175,6 +178,9 @@ public enum Property {
SMIME_SIGNING_KEYSTORE_PASSWORD("simplejavamail.smime.signing.keystore_password"),
SMIME_SIGNING_KEY_ALIAS("simplejavamail.smime.signing.key_alias"),
SMIME_SIGNING_KEY_PASSWORD("simplejavamail.smime.signing.key_password"),
SMIME_SIGNING_ALGORITHM("simplejavamail.smime.signing.algorithm"),
SMIME_ENCRYPTION_KEY_ENCAPSULATION_ALGORITHM("simplejavamail.smime.encryption.key_encapsulation_algorithm"),
SMIME_ENCRYPTION_CIPHER("simplejavamail.smime.encryption.cipher"),
DKIM_PRIVATE_KEY_FILE_OR_DATA("simplejavamail.dkim.signing.private_key_file_or_data"),
DKIM_SELECTOR("simplejavamail.dkim.signing.selector"),
DKIM_SIGNING_DOMAIN("simplejavamail.dkim.signing.signing_domain"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ simplejavamail.smime.signing.keystore_password=letmein
simplejavamail.smime.signing.key_alias=smime_test_user_alias
simplejavamail.smime.signing.key_password=letmein
simplejavamail.smime.encryption.certificate=src/test/resources/pkcs12/smime_test_user.pem.standard.crt
simplejavamail.smime.signing.algorithm=
simplejavamail.smime.encryption.key_encapsulation_algorithm=
simplejavamail.smime.encryption.cipher=
simplejavamail.dkim.signing.private_key_file_or_data=
simplejavamail.dkim.signing.selector=
simplejavamail.dkim.signing.signing_domain=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
* <li>simplejavamail.smime.signing.key_password</li>
* <li>simplejavamail.smime.signing.key-password</li>
* <li>simplejavamail.smime.encryption.certificate</li>
* <li>simplejavamail.smime.signing.algorithm</li>
* <li>simplejavamail.smime.encryption.key_encapsulation_algorithm</li>
* <li>simplejavamail.smime.encryption.cipher</li>
* <li>simplejavamail.dkim.signing.private_key_file_or_data</li>
* <li>simplejavamail.dkim.signing.private-key-file-or-data</li>
* <li>simplejavamail.dkim.signing.selector</li>
Expand Down Expand Up @@ -158,6 +161,9 @@ public MailerGenericBuilder<?> loadGlobalConfigAndCreateDefaultMailer(
@Nullable @Value("${simplejavamail.smime.signing.key_password:#{null}}") final String smimeSigningKeyPassword,
@Nullable @Value("${simplejavamail.smime.signing.key-password:#{null}}") final String smimeSigningKeyPasswordSpringBoot,
@Nullable @Value("${simplejavamail.smime.encryption.certificate:#{null}}") final String smimeEncryptionCertificate,
@Nullable @Value("${simplejavamail.smime.signing.algorithm:#{null}}") final String smimeSigningAlgorithm,
@Nullable @Value("${simplejavamail.smime.encryption.key_encapsulation_algorithm:#{null}}") final String smimeEncryptionKeyEncapsulationAlgorithm,
@Nullable @Value("${simplejavamail.smime.encryption.cipher:#{null}}") final String smimeEncryptionCipher,
@Nullable @Value("${simplejavamail.dkim.signing.private_key_file_or_data:#{null}}") final String dkimSigningPrivateKeyFileOrData,
@Nullable @Value("${simplejavamail.dkim.signing.private-key-file-or-data:#{null}}") final String dkimSigningPrivateKeyFileOrDataSpringBoot,
@Nullable @Value("${simplejavamail.dkim.signing.selector:#{null}}") final String dkimSigningSelector,
Expand Down Expand Up @@ -241,6 +247,15 @@ public MailerGenericBuilder<?> loadGlobalConfigAndCreateDefaultMailer(
} else {
setNullableProperty(emailProperties, Property.SMIME_SIGNING_KEY_PASSWORD.key(), smimeSigningKeyPasswordSpringBoot);
}
if (smimeSigningAlgorithm != null) {
setNullableProperty(emailProperties, Property.SMIME_SIGNING_ALGORITHM.key(), smimeSigningAlgorithm);
}
if (smimeEncryptionKeyEncapsulationAlgorithm != null) {
setNullableProperty(emailProperties, Property.SMIME_ENCRYPTION_KEY_ENCAPSULATION_ALGORITHM.key(), smimeEncryptionKeyEncapsulationAlgorithm);
}
if (smimeEncryptionCipher != null) {
setNullableProperty(emailProperties, Property.SMIME_ENCRYPTION_CIPHER.key(), smimeEncryptionCipher);
}
setNullableProperty(emailProperties, Property.SMIME_ENCRYPTION_CERTIFICATE.key(), smimeEncryptionCertificate);
if (dkimSigningPrivateKeyFileOrData != null) {
setNullableProperty(emailProperties, Property.DKIM_PRIVATE_KEY_FILE_OR_DATA.key(), dkimSigningPrivateKeyFileOrData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ simplejavamail.smime.signing.keystore_password=letmein
simplejavamail.smime.signing.key_alias=smime_test_user_alias
simplejavamail.smime.signing.key_password=letmein
simplejavamail.smime.encryption.certificate=
simplejavamail.smime.signing.algorithm=
simplejavamail.smime.encryption.key_encapsulation_algorithm=
simplejavamail.smime.encryption.cipher=
simplejavamail.dkim.signing.private_key_file_or_data=
simplejavamail.dkim.signing.selector=
simplejavamail.dkim.signing.signing_domain=
Expand Down

0 comments on commit e2ec9a7

Please sign in to comment.