tls

package
v0.0.0-...-90c9d3a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2010 License: BSD-3-Clause, GooglePatentClause Imports: 16 Imported by: 0

Documentation

Overview

This package partially implements the TLS 1.1 protocol, as specified in RFC 4346.

Index

Constants

This section is empty.

Variables

View Source
var (
	TLS_RSA_WITH_RC4_128_SHA uint16 = 5
)

TLS cipher suites.

Functions

This section is empty.

Types

type CASet

type CASet struct {
	// contains filtered or unexported fields
}

A CASet is a set of certificates.

func NewCASet

func NewCASet() *CASet

func (*CASet) FindParent

func (s *CASet) FindParent(cert *x509.Certificate) (parent *x509.Certificate)

FindParent attempts to find the certificate in s which signs the given certificate. If no such certificate can be found, it returns nil.

func (*CASet) SetFromPEM

func (s *CASet) SetFromPEM(pemCerts []byte) (ok bool)

SetFromPEM attempts to parse a series of PEM encoded root certificates. It appends any certificates found to s and returns true if any certificates were successfully parsed. On many Linux systems, /etc/ssl/cert.pem will contains the system wide set of root CAs in a format suitable for this function.

type Certificate

type Certificate struct {
	Certificate [][]byte
	PrivateKey  *rsa.PrivateKey
}

type Config

type Config struct {
	// Rand provides the source of entropy for nonces and RSA blinding.
	Rand io.Reader
	// Time returns the current time as the number of seconds since the epoch.
	Time         func() int64
	Certificates []Certificate
	RootCAs      *CASet
	// NextProtos is a list of supported, application level protocols.
	// Currently only server-side handling is supported.
	NextProtos []string
}

A Config structure is used to configure a TLS client or server. After one has been passed to a TLS function it must not be modified.

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

A Conn represents a secure connection.

func Client

func Client(conn net.Conn, config *Config) *Conn

func Server

func Server(conn net.Conn, config *Config) *Conn

func (*Conn) Close

func (tls *Conn) Close() os.Error

func (*Conn) GetConnectionState

func (tls *Conn) GetConnectionState() ConnectionState

func (*Conn) Read

func (tls *Conn) Read(p []byte) (int, os.Error)

func (*Conn) SetReadTimeout

func (tls *Conn) SetReadTimeout(nsec int64) os.Error

func (*Conn) SetTimeout

func (tls *Conn) SetTimeout(nsec int64) os.Error

func (*Conn) SetWriteTimeout

func (tls *Conn) SetWriteTimeout(nsec int64) os.Error

func (*Conn) WaitConnectionState

func (tls *Conn) WaitConnectionState() ConnectionState

func (*Conn) Write

func (tls *Conn) Write(p []byte) (int, os.Error)

type ConnectionState

type ConnectionState struct {
	HandshakeComplete  bool
	CipherSuite        string
	Error              alertType
	NegotiatedProtocol string
}

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

func NewListener

func NewListener(listener net.Listener, config *Config) (l *Listener)

NewListener creates a Listener which accepts connections from an inner Listener and wraps each connection with Server.

func (*Listener) Accept

func (l *Listener) Accept() (c net.Conn, err os.Error)

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

func (*Listener) Close

func (l *Listener) Close() os.Error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL