Coder Social home page Coder Social logo

tlslibrary's Introduction

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.

Motivation

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.

JSEE

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("192.168.3.10", 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 { 
    setUrl("https://dl.bintray.com/s1m0nw1/SeKurity/")
}

compile("de.swirtz:sekurity:0.0.x")

Basics

You can read about TLS and Keystores here.

tlslibrary's People

Contributors

s1monw1 avatar simnd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.