Skip to content

Commit 230f151

Browse files
committed
<fix>(config): add enableSsl config, it will cover disableSsl config.
1 parent fe07802 commit 230f151

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

src/main/java/org/fisco/bcos/sdk/v3/config/model/CryptoMaterialConfig.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,19 @@ public CryptoMaterialConfig(ConfigProperty configProperty) throws ConfigExceptio
5252

5353
Map<String, Object> cryptoMaterialProperty = configProperty.getCryptoMaterial();
5454
String useSMCrypto = (String) cryptoMaterialProperty.get("useSMCrypto");
55-
String disableSsl = (String) cryptoMaterialProperty.get("disableSsl");
55+
Object disableSsl = cryptoMaterialProperty.get("disableSsl");
56+
Object enableSsl = cryptoMaterialProperty.get("enableSsl");
5657
String enableHsm = (String) cryptoMaterialProperty.get("enableHsm");
5758

5859
this.useSmCrypto = Boolean.valueOf(useSMCrypto);
59-
this.disableSsl = Boolean.valueOf(disableSsl);
60+
if (disableSsl != null) {
61+
this.disableSsl = Boolean.parseBoolean((String) disableSsl);
62+
}
63+
if (enableSsl != null) {
64+
// if enableSsl is set, disableSsl will be ignored
65+
this.disableSsl = !Boolean.parseBoolean((String) enableSsl);
66+
}
67+
6068
this.enableHsm = Boolean.valueOf(enableHsm);
6169

6270
if (this.enableHsm) {

src/test/resources/applicationContext-sample.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<map>
1010
<entry key="certPath" value="conf" />
1111
<entry key="useSMCrypto" value="false" />
12-
<entry key="disableSsl" value="false" />
12+
<entry key="enableSsl" value="true" />
1313
<!-- SSL certificate configuration -->
1414
<!-- entry key="caCert" value="conf/ca.crt" /-->
1515
<!-- entry key="sslCert" value="conf/sdk.crt" /-->

src/test/resources/config-example.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
certPath = "conf" # The certification path
44
useSMCrypto = "false"
5-
disableSsl = "false" # Communication with nodes without SSL
5+
enableSsl = "true" # Communication with nodes without SSL
66

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

src/test/resources/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
certPath = "conf" # The certification path
44
useSMCrypto = "false"
5-
disableSsl = "false" # Communication with nodes without SSL
5+
enableSsl = "true" # Communication with nodes without SSL
66

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

0 commit comments

Comments
 (0)