Skip to content
Simple TlsLibrary written in Kotlin - Provides DSL for creating TLS connections
Kotlin Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
images removed unused stores, added classes of jsse to docu Aug 2, 2017
src modified Store DSL, type is part of constructor May 13, 2018
.travis.yml readme modified May 13, 2018
gradlew wrapper updated Nov 4, 2017
gradlew.bat first implementation of dsl for creating sslsocketfactory Jul 30, 2017

SeKurity - Kotlin powered TLS library

Build Status

This library provides an API for creating basic SSL/TLS connections with standard Java Secure Socket Extension, JSSE. The Library is implemented in Kotlin. The Kotlin API is implemented with a "type-safe builder" approach, which is quite popular in the Groovy community.

Disclaimer: The current Version is not optimized for Java yet.


If you also find it hard to use the complex JSSE structure to create your SSL sockets, which also generates lots of boilerplate when used directly, this tool is what you've been looking for.


The library provides means for creating SSLSocketFactories that can be used for most use cases where TLS/SSL connections are required. It's also supposed to provide usage examples and even sample implementations like SSL enabled servers, Apache HTTP Clients and others, which you can use directly in your application.

Demo of Kotlin DSL

In the following you can see some basic examples of using the Kotlin DSL for setting up ssl-(server)-socket-factories.

Creating a Client Socket for Mutual Authentication (Client Keystore must be provided):

val fac = createSocketFactory {
            keyManager {
                open("certsandstores/clientkeystore", "jks") withPass "123456"
            trustManager {
                open("certsandstores/myTruststore", "jks") withPass "123456"
            sockets {
                cipherSuites = listOf("TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
                        "TLS_DHE_RSA_WITH_AES_128_CBC_SHA", "TLS_DHE_RSA_WITH_AES_256_CBC_SHA")
                timeout = 10_000

val socket = fac.createSocket("", 443)

Creating a Server Socket with simple keystore (no Client Auth required)

val fac = createServerSocketFactory {
        keyManager {
            open("certsandstores/clientkeystore", "jks") withPass "123456"

    val accept = fac.createServerSocket(443).accept()

Getting Started

In your Gradle build, simply include the following repo as well as dependency:

maven { 



You can read about TLS and Keystores here.

You can’t perform that action at this time.