TLS Certificates

Using Certificates

Default Certificates

You can use the default provided certificate:

TLSCertificates certs = TLSCertificates.defaultCerts;

Which has the following values:

public static class Default implements TLSCertificates {
    public Default() {
    }

    public String keyStoreResourceName() {
        return "/certificates/client.jks";
    }

    public String trustStroreResourceName() {
        return "/certificates/trustedCerts.jks";
    }

    public String keyStorePassword() {
        return "storepass";
    }

    public String keyPassword() {
        return "keypass";
    }

    public boolean trustAllCerts() {
        return true;
    }
}

These certificates are shipped with GreenLightning by default.

Custom Certificates

To specify custom TLS certificates, use the code below. Your .jks files should be located under your applications resources folder.

TLSCertificates certs = new TLSCertificates() {
   @Override
   public String keyStoreResourceName() {
      return "/certificates/CUSTOM_CLIENT.jks";
   }

   @Override
   public String trustStroreResourceName() {
      return "/certificates/CUSTOM_TRUSTED.jks";
   }

   @Override
   public String keyStorePassword() {
      return "STOREPASSWORD";
   }

   @Override
   public String keyPassword() {
      return "KEYPASSWORD";
   }

   @Override
   public boolean trustAllCerts() {
      return true;
   }
};

Last updated