Skip to content

Commit

Permalink
<fix>(config): add enableSsl config, it will cover disableSsl config. (
Browse files Browse the repository at this point in the history
  • Loading branch information
kyonRay authored Jun 18, 2024
1 parent fe07802 commit 9a2a3bb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,19 @@ public CryptoMaterialConfig(ConfigProperty configProperty) throws ConfigExceptio

Map<String, Object> cryptoMaterialProperty = configProperty.getCryptoMaterial();
String useSMCrypto = (String) cryptoMaterialProperty.get("useSMCrypto");
String disableSsl = (String) cryptoMaterialProperty.get("disableSsl");
Object disableSsl = cryptoMaterialProperty.get("disableSsl");
Object enableSsl = cryptoMaterialProperty.get("enableSsl");
String enableHsm = (String) cryptoMaterialProperty.get("enableHsm");

this.useSmCrypto = Boolean.valueOf(useSMCrypto);
this.disableSsl = Boolean.valueOf(disableSsl);
if (disableSsl != null) {
this.disableSsl = Boolean.parseBoolean((String) disableSsl);
}
if (enableSsl != null) {
// if enableSsl is set, disableSsl will be ignored
this.disableSsl = !Boolean.parseBoolean((String) enableSsl);
}

this.enableHsm = Boolean.valueOf(enableHsm);

if (this.enableHsm) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/applicationContext-sample.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<map>
<entry key="certPath" value="conf" />
<entry key="useSMCrypto" value="false" />
<entry key="disableSsl" value="false" />
<entry key="enableSsl" value="true" />
<!-- SSL certificate configuration -->
<!-- entry key="caCert" value="conf/ca.crt" /-->
<!-- entry key="sslCert" value="conf/sdk.crt" /-->
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/config-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

certPath = "conf" # The certification path
useSMCrypto = "false"
disableSsl = "false" # Communication with nodes without SSL
enableSsl = "true" # Communication with nodes without SSL

# The following configurations take the certPath by default if commented
# caCert = "conf/ca.crt" # CA cert file path
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

certPath = "conf" # The certification path
useSMCrypto = "false"
disableSsl = "false" # Communication with nodes without SSL
enableSsl = "true" # Communication with nodes without SSL

# The following configurations take the certPath by default if commented
# caCert = "conf/ca.crt" # CA cert file path
Expand Down

0 comments on commit 9a2a3bb

Please sign in to comment.