# Enable SSL/TLS in my custom module

**URL:** <https://forum.inductiveautomation.com/t/enable-ssl-tls-in-my-custom-module/102403>\
**Category:** Module Development\
**Created:** [February 16, 2025, 6:32pm UTC](https://forum.inductiveautomation.com/t/enable-ssl-tls-in-my-custom-module/102403 "2025-02-16T18:32:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Isaac\_Apodaca](https://avatars.discourse-cdn.com/v4/letter/i/bcef8e/32.png) [@Isaac\_Apodaca](https://forum.inductiveautomation.com/u/Isaac_Apodaca)\
**Post date:** [February 16, 2025, 6:32pm UTC](https://forum.inductiveautomation.com/t/enable-ssl-tls-in-my-custom-module/102403/1 "2025-02-16T18:32:50Z")

</div>

Hi everyone,

I'm creating a module that creates a service and binds to a configurable port (similar to the mqtt distributor module that enables an mqtt service). I want to allow customers to enable ssl/tls if they want. I would like to reuse the tls certificate being used by the websever if possible. So my questions are,

1. Is there a way to programmtically check if ssl/tls has been enabled on the gateway?

2. If yes, How can i programmtically access the key and certificate?

Any info or guidance is appreciated! Thank you in advance!

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 16, 2025, 7:24pm UTC](https://forum.inductiveautomation.com/t/enable-ssl-tls-in-my-custom-module/102403/2 "2025-02-16T19:24:15Z")

</div>

I don't see any public API to support this, but you could certainly access the KeyStore file yourself.

Use these functions to determine the alias and passwords:

```java

public static Optional<String> getSslKeyStoreAlias() {
  String alias = System.getProperty("ignition.ssl.keystore.alias", "ignition");
  return Optional.of(alias);
}

public static Optional<String> getSslKeyStorePassword() {
  String password = System.getProperty("ignition.ssl.keystore.password", "ignition");
  return Optional.of(password);
}

public static Optional<String> getSslPrivateKeyPassword() {
  String password = System.getProperty("ignition.ssl.privatekey.password");
  return Optional.ofNullable(password).or(() -> getSslKeyStorePassword());
}

```

The KeyStore file is at `$IGNITION/webserver/ssl.pfx`. If it doesn't exist I would assume SSL/TLS is not enabled.

---

<div class="post-metadata">

**Author:** ![Isaac\_Apodaca](https://avatars.discourse-cdn.com/v4/letter/i/bcef8e/32.png) [@Isaac\_Apodaca](https://forum.inductiveautomation.com/u/Isaac_Apodaca)\
**Post date:** [February 19, 2025, 8:05pm UTC](https://forum.inductiveautomation.com/t/enable-ssl-tls-in-my-custom-module/102403/3 "2025-02-19T20:05:06Z")

</div>

This is working perfectly. Thank you! And just so I'm 100% clear, I'll use getSslKeyStorePassword to load the keystore and getSslPrivateKeyPassword when i go to get the private key from the keystore? I'm guessing ignition.ssl.privatekey.password will be set if the customer loads a private key that requires a password?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 19, 2025, 8:16pm UTC](https://forum.inductiveautomation.com/t/enable-ssl-tls-in-my-custom-module/102403/4 "2025-02-19T20:16:37Z")

</div>

The private key entry always has a password, but it might be different than the KeyStore password, in which case this system property will be set.

All of these system properties are only set if non-default alias and/or passwords are being used.
