项目作者: 123hurray

项目描述 :
TLSLog is a golang library which stores SSL/TLS (Key-Exchange method must be ECDHE) master key and client random in NSS key log format that can be used for aplication data decryption using Wireshark
高级语言: Go
项目地址: git://github.com/123hurray/tlslog.git
创建时间: 2015-12-01T01:40:39Z
项目社区:https://github.com/123hurray/tlslog

开源协议:BSD 3-Clause "New" or "Revised" License

下载


TLSLog

license

Introduction

TLSLog is a Golang library used to debug SSL application data for Wireshark.

If ECDHE is used in Key-Exchange, Wireshark cannot decrypt the application data only by set the server private key.
But Wireshark supports NSS key log format that store all information
needed in application data decryption process.

NSS key log format is supported by Chrome and Firefox but not Golang.
When using Golang crypto/tls library, it’s difficult to debug encrypted data sent and received by SSL.

But Golang crypto/tls library does store these information internally.
Thus, TLSLog hooks config.Rand and uses reflection to get master secret from crypto/tls library.

CAUTION:Only client side function is implemented, which means that TLSLog can not be used to build a SSL server.

Usage

Install

  1. go get github.com/123hurray/tlslog/tlslog.go

Dial

Dial is the most commonly way to build an SSL client.

  1. config := tls.Config{InsecureSkipVerify: true}
  2. // Get a TLSLog
  3. tlsLog, err := NewTLSLog("log.txt")
  4. if err != nil {
  5. fmt.Println("Unable to create TlsLog:", err.Error())
  6. }
  7. // Use TLSLog.Dial instead of tls.Dial
  8. conn, err := tlsLog.Dial("tcp", "127.0.0.1:32123", &config)
  9. // conn is tls.Conn, just used as is documented in tls library

Client

Client is another way to build an SSL client.

  1. config := tls.Config{InsecureSkipVerify: true}
  2. tlsLog, err := NewTLSLog("log.txt")
  3. // Make net.conn
  4. c, s := net.Pipe()
  5. // use TLSLog.Client instead of tls.Client
  6. logCli := tlsLog.Client(c, &config)
  7. // Do handshake
  8. conn, err = logCli.Handshake()
  9. // conn is tls.Conn, just used as is documented in tls library

Decrypt application data using Wireshark

See the articles below:

TODO

  • Server side key log