Skip to content

more convenient package to create tls.Config

Notifications You must be signed in to change notification settings

x-mod/tlsconfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

tlsconfig

Create tls.Config with Options.

中文说明

Mutual TLS Authentication

** Server **

import "github.com/x-mod/tlsconfig"

cf := tlsconfig.New(
    //服务端 TLS 证书
    tlsconfig.CertKeyPair("out/server.crt", "out/server.key"), 
    //客户端 TLS 证书签名 CA
    tlsconfig.ClientCA("out/exampleCA.crt"), 
    //验证客户端证书
    tlsconfig.ClientAuthVerified(),
)

** Client **

import "github.com/x-mod/tlsconfig"

cf := tlsconfig.New(
    //服务端 TLS 证书签名 CA
    tlsconfig.CA("out/exampleCA.crt"), 
    //客户端证书 TLS 证书
    tlsconfig.CertKeyPair("out/client.crt", "out/client.key"), 
)

About

more convenient package to create tls.Config

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages