Documentation ¶
Index ¶
- Constants
- Variables
- type CipherKind
- type ClientHello
- type ClientMasterKey
- type Config
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) Handshake() (err error)
- func (c *Conn) HandshakeLog() *HandshakeData
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Read(b []byte) (n int, err error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) Write(b []byte) (n int, err error)
- type HandshakeData
- type Header
- type ServerCertificate
- type ServerHello
- type ServerVerify
Constants ¶
const ( MAX_TWO_BYTE_RECORD_BYTES = 32767 MAX_THREE_BYTE_RECORD_BYTES = 16383 MAX_RECORD_BYTES = MAX_TWO_BYTE_RECORD_BYTES )
Record sizes for two- and three-byte issues
const ( MSG_TYPE_CLIENT_HELLO byte = 1 MSG_TYPE_SERVER_HELLO byte = 4 MSG_TYPE_CLIENT_MASTER_KEY byte = 2 )
Protocol message codes
const (
SSL_VERSION_2 uint16 = 0x0002
)
Version codes
Variables ¶
var AllCiphers = []CipherKind{ SSL_CK_RC4_128_WITH_MD5, SSL_CK_RC4_128_EXPORT40_WITH_MD5, SSL_CK_RC2_128_CBC_WITH_MD5, SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5, SSL_CK_IDEA_128_CBC_WITH_MD5, SSL_CK_DES_64_CBC_WITH_MD5, SSL_CK_DES_192_EDE3_CBC_WITH_MD5, }
var ErrInvalidLength = errors.New("Invalid SSLv2 packet length")
ErrInvalidLength is returned when a byte slice to be Unmarshaled is too short, or when a single record length is greater than the max length of 32512 bytes.
var ErrUnexpectedMessage = errors.New("Unexpected message type")
var ExportCiphers = []CipherKind{ SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5, SSL_CK_RC4_128_EXPORT40_WITH_MD5, }
Functions ¶
This section is empty.
Types ¶
type CipherKind ¶
type CipherKind uint32
CipherKind holds a 3-byte ID for a cipher spec. It is invalid for a CipherKind to be greater than 0x00FFFFFF
const ( SSL_CK_RC4_128_WITH_MD5 CipherKind = 0x010080 SSL_CK_RC4_128_EXPORT40_WITH_MD5 CipherKind = 0x020080 SSL_CK_RC2_128_CBC_WITH_MD5 CipherKind = 0x030080 SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5 CipherKind = 0x040080 SSL_CK_IDEA_128_CBC_WITH_MD5 CipherKind = 0x050080 SSL_CK_DES_64_CBC_WITH_MD5 CipherKind = 0x060040 SSL_CK_DES_192_EDE3_CBC_WITH_MD5 CipherKind = 0x0700C0 )
Standard SSLv3 CipherKinds
func SSLv2CipherFromTLS ¶
func SSLv2CipherFromTLS(newCipher uint32) CipherKind
SSLv2CipherFromTLS returns an SSLv2 object representing a cipher from SSLv3 or newer.
func (*CipherKind) MarshalJSON ¶
func (ck *CipherKind) MarshalJSON() ([]byte, error)
func (*CipherKind) MarshalSSLv2 ¶
func (ck *CipherKind) MarshalSSLv2() ([]byte, error)
MarshalBinary implements the binary marshaler interface
func (*CipherKind) UnmarshalBinary ¶
func (ck *CipherKind) UnmarshalBinary(b []byte) error
UnmarshalBinary implements the BinaryUnmarshler interface
type ClientHello ¶
type ClientHello struct { Version uint16 `json:"version"` Ciphers []CipherKind `json:"ciphers,omitempty"` SessionID []byte `json:"session_id,omitempty"` Challenge []byte `json:"challenge,omitempty"` }
func (*ClientHello) MarshalBinary ¶
func (h *ClientHello) MarshalBinary() (b []byte, err error)
MarshalBinary implements the BinaryMarshaler interface
type ClientMasterKey ¶
type ClientMasterKey struct { CipherKind CipherKind ClearKey []byte EncryptedKey []byte KeyArg []byte }
The ClientMasterKey struct represents the client-master-key message in the SSLv2 handshake protocol. The structure of the message is:
client-master-key { char MSG-CLIENT-MASTER-KEY char CIPHER-KIND[3] char CLEAR-KEY-LENGTH-MSB char CLEAR-KEY-LENGTH-LSB char ENCRYPTED-KEY-LENGTH-MSB char ENCRYPTED-KEY-LENGTH-LSB char KEY-ARG-LENGTH-MSB char KEY-ARG-LENGTH-LSB char CLEAR-KEY-DATA[MSB<<8|LSB] char ENCRYPTED-KEY-DATA[MSB<<8|LSB] char KEY-ARG-DATA[MSB<<8|LSB] }
See http://www-archive.mozilla.org/projects/security/pki/nss/ssl/draft02.html
func (*ClientMasterKey) MarshalSSLv2 ¶
func (cmk *ClientMasterKey) MarshalSSLv2() (b []byte, err error)
MarshalSSLv2 implments the marshaler interface
type Config ¶
type Config struct { Ciphers []CipherKind ExtraClear bool }
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) Close ¶
Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.
func (*Conn) HandshakeLog ¶
func (c *Conn) HandshakeLog() *HandshakeData
func (*Conn) Read ¶
Read reads data from the connection. Read can be made to time out and return a Error with Timeout() == true after a fixed time limit; see SetDeadline and SetReadDeadline.
func (*Conn) RemoteAddr ¶
RemoteAddr returns the remote network address.
func (*Conn) SetDeadline ¶
SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.
A deadline is an absolute time after which I/O operations fail with a timeout (see type Error) instead of blocking. The deadline applies to all future I/O, not just the immediately following call to Read or Write.
An idle timeout can be implemented by repeatedly extending the deadline after successful Read or Write calls.
A zero value for t means I/O operations will not time out.
func (*Conn) SetReadDeadline ¶
SetReadDeadline sets the deadline for future Read calls. A zero value for t means Read will not time out.
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline sets the deadline for future Write calls. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means Write will not time out.
type HandshakeData ¶
type HandshakeData struct { ClientHello *ClientHello `json:"client_hello,omitempty"` ServerHello *ServerHello `json:"server_hello,omitempty"` ServerVerify *ServerVerify `json:"server_verify,omitempty"` }
type Header ¶
func (*Header) MarshalBinary ¶
MarshalBinary implements the BinaryMarshaler interface
func (*Header) UnmarshalBinary ¶
UnmarshalBinary implements the BinaryUnmarshaler interface
type ServerCertificate ¶
type ServerCertificate struct { Raw []byte `json:"raw,omitempty"` Certificate *x509.Certificate `json:"parsed,omitempty"` }
type ServerHello ¶
type ServerHello struct { SessionIDHit byte `json:"session_id_hit"` CertificateType byte `json:"certificate_type"` Version uint16 `json:"version"` Certificate *ServerCertificate `json:"certificate,omitempty"` Ciphers []CipherKind `json:"ciphers,omitempty"` ConnectionID []byte `json:"connection_id,omitempty"` // contains filtered or unexported fields }
func (*ServerHello) MarshalBinary ¶
func (h *ServerHello) MarshalBinary() (b []byte, err error)
MarshalBinary implements the BinaryMarshaler interface
func (*ServerHello) UnmarshalBinary ¶
func (h *ServerHello) UnmarshalBinary(b []byte) (err error)
UnmarshalBinary implements the BinaryUnmarshaler interface
Directories ¶
Path | Synopsis |
---|---|
Package x509 parses X.509-encoded keys and certificates.
|
Package x509 parses X.509-encoded keys and certificates. |
pkix
Package pkix contains shared, low level structures used for ASN.1 parsing and serialization of X.509 certificates, CRL and OCSP.
|
Package pkix contains shared, low level structures used for ASN.1 parsing and serialization of X.509 certificates, CRL and OCSP. |