ciphersuite

package
v0.0.0-...-5e97d5f Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package ciphersuite provides TLS Ciphers as registered with the IANA https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-4

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aes128Ccm

type Aes128Ccm struct {
	AesCcm
}

Aes128Ccm is a base class used by multiple AES-CCM Ciphers

func NewTLSEcdheEcdsaWithAes128Ccm

func NewTLSEcdheEcdsaWithAes128Ccm() *Aes128Ccm

NewTLSEcdheEcdsaWithAes128Ccm constructs a TLS_ECDHE_ECDSA_WITH_AES_128_CCM Cipher

func NewTLSEcdheEcdsaWithAes128Ccm8

func NewTLSEcdheEcdsaWithAes128Ccm8() *Aes128Ccm

NewTLSEcdheEcdsaWithAes128Ccm8 creates a new TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 CipherSuite

func NewTLSPskWithAes128Ccm

func NewTLSPskWithAes128Ccm() *Aes128Ccm

NewTLSPskWithAes128Ccm returns the TLS_PSK_WITH_AES_128_CCM CipherSuite

func NewTLSPskWithAes128Ccm8

func NewTLSPskWithAes128Ccm8() *Aes128Ccm

NewTLSPskWithAes128Ccm8 returns the TLS_PSK_WITH_AES_128_CCM_8 CipherSuite

func (*Aes128Ccm) Init

func (c *Aes128Ccm) Init(masterSecret, clientRandom, serverRandom []byte, isClient bool) error

Init initializes the internal Cipher with keying material

type Aes256Ccm

type Aes256Ccm struct {
	AesCcm
}

Aes256Ccm is a base class used by multiple AES-CCM Ciphers

func NewTLSPskWithAes256Ccm8

func NewTLSPskWithAes256Ccm8() *Aes256Ccm

NewTLSPskWithAes256Ccm8 returns the TLS_PSK_WITH_AES_256_CCM_8 CipherSuite

func (*Aes256Ccm) Init

func (c *Aes256Ccm) Init(masterSecret, clientRandom, serverRandom []byte, isClient bool) error

Init initializes the internal Cipher with keying material

type AesCcm

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

AesCcm is a base class used by multiple AES-CCM Ciphers

func (*AesCcm) AuthenticationType

func (c *AesCcm) AuthenticationType() AuthenticationType

AuthenticationType controls what authentication method is using during the handshake

func (*AesCcm) CertificateType

func (c *AesCcm) CertificateType() clientcertificate.Type

CertificateType returns what type of certificate this CipherSuite exchanges

func (*AesCcm) Decrypt

func (c *AesCcm) Decrypt(raw []byte) ([]byte, error)

Decrypt decrypts a single TLS RecordLayer

func (*AesCcm) ECC

func (c *AesCcm) ECC() bool

ECC uses Elliptic Curve Cryptography

func (*AesCcm) Encrypt

func (c *AesCcm) Encrypt(pkt *recordlayer.RecordLayer, raw []byte) ([]byte, error)

Encrypt encrypts a single TLS RecordLayer

func (*AesCcm) HashFunc

func (c *AesCcm) HashFunc() func() hash.Hash

HashFunc returns the hashing func for this CipherSuite

func (*AesCcm) ID

func (c *AesCcm) ID() ID

ID returns the ID of the CipherSuite

func (*AesCcm) Init

func (c *AesCcm) Init(masterSecret, clientRandom, serverRandom []byte, isClient bool, prfKeyLen int) error

Init initializes the internal Cipher with keying material

func (*AesCcm) IsInitialized

func (c *AesCcm) IsInitialized() bool

IsInitialized returns if the CipherSuite has keying material and can encrypt/decrypt packets

func (*AesCcm) KeyExchangeAlgorithm

func (c *AesCcm) KeyExchangeAlgorithm() KeyExchangeAlgorithm

KeyExchangeAlgorithm controls what key exchange algorithm is using during the handshake

func (*AesCcm) String

func (c *AesCcm) String() string

type AuthenticationType

type AuthenticationType = types.AuthenticationType

AuthenticationType controls what authentication method is using during the handshake

const (
	AuthenticationTypeCertificate  AuthenticationType = types.AuthenticationTypeCertificate
	AuthenticationTypePreSharedKey AuthenticationType = types.AuthenticationTypePreSharedKey
	AuthenticationTypeAnonymous    AuthenticationType = types.AuthenticationTypeAnonymous
)

AuthenticationType Enums

type ID

type ID uint16

ID is an ID for our supported CipherSuites

const (
	// AES-128-CCM
	TLS_ECDHE_ECDSA_WITH_AES_128_CCM   ID = 0xc0ac //nolint:revive,stylecheck
	TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 ID = 0xc0ae //nolint:revive,stylecheck

	// AES-128-GCM-SHA256
	TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 ID = 0xc02b //nolint:revive,stylecheck
	TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256   ID = 0xc02f //nolint:revive,stylecheck

	TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 ID = 0xc02c //nolint:revive,stylecheck
	TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384   ID = 0xc030 //nolint:revive,stylecheck
	// AES-256-CBC-SHA
	TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA ID = 0xc00a //nolint:revive,stylecheck
	TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA   ID = 0xc014 //nolint:revive,stylecheck

	TLS_PSK_WITH_AES_128_CCM        ID = 0xc0a4 //nolint:revive,stylecheck
	TLS_PSK_WITH_AES_128_CCM_8      ID = 0xc0a8 //nolint:revive,stylecheck
	TLS_PSK_WITH_AES_256_CCM_8      ID = 0xc0a9 //nolint:revive,stylecheck
	TLS_PSK_WITH_AES_128_GCM_SHA256 ID = 0x00a8 //nolint:revive,stylecheck
	TLS_PSK_WITH_AES_128_CBC_SHA256 ID = 0x00ae //nolint:revive,stylecheck

	TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 ID = 0xC037 //nolint:revive,stylecheck
)

Supported Cipher Suites

func (ID) String

func (i ID) String() string

type KeyExchangeAlgorithm

type KeyExchangeAlgorithm = types.KeyExchangeAlgorithm

KeyExchangeAlgorithm controls what exchange algorithm was chosen.

const (
	KeyExchangeAlgorithmNone  KeyExchangeAlgorithm = types.KeyExchangeAlgorithmNone
	KeyExchangeAlgorithmPsk   KeyExchangeAlgorithm = types.KeyExchangeAlgorithmPsk
	KeyExchangeAlgorithmEcdhe KeyExchangeAlgorithm = types.KeyExchangeAlgorithmEcdhe
)

KeyExchangeAlgorithm Bitmask

type TLSEcdheEcdsaWithAes128GcmSha256

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

TLSEcdheEcdsaWithAes128GcmSha256 represents a TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 CipherSuite

func (*TLSEcdheEcdsaWithAes128GcmSha256) AuthenticationType

func (c *TLSEcdheEcdsaWithAes128GcmSha256) AuthenticationType() AuthenticationType

AuthenticationType controls what authentication method is using during the handshake

func (*TLSEcdheEcdsaWithAes128GcmSha256) CertificateType

CertificateType returns what type of certficate this CipherSuite exchanges

func (*TLSEcdheEcdsaWithAes128GcmSha256) Decrypt

func (c *TLSEcdheEcdsaWithAes128GcmSha256) Decrypt(raw []byte) ([]byte, error)

Decrypt decrypts a single TLS RecordLayer

func (*TLSEcdheEcdsaWithAes128GcmSha256) ECC

ECC uses Elliptic Curve Cryptography

func (*TLSEcdheEcdsaWithAes128GcmSha256) Encrypt

Encrypt encrypts a single TLS RecordLayer

func (*TLSEcdheEcdsaWithAes128GcmSha256) HashFunc

func (c *TLSEcdheEcdsaWithAes128GcmSha256) HashFunc() func() hash.Hash

HashFunc returns the hashing func for this CipherSuite

func (*TLSEcdheEcdsaWithAes128GcmSha256) ID

ID returns the ID of the CipherSuite

func (*TLSEcdheEcdsaWithAes128GcmSha256) Init

func (c *TLSEcdheEcdsaWithAes128GcmSha256) Init(masterSecret, clientRandom, serverRandom []byte, isClient bool) error

Init initializes the internal Cipher with keying material

func (*TLSEcdheEcdsaWithAes128GcmSha256) IsInitialized

func (c *TLSEcdheEcdsaWithAes128GcmSha256) IsInitialized() bool

IsInitialized returns if the CipherSuite has keying material and can encrypt/decrypt packets

func (*TLSEcdheEcdsaWithAes128GcmSha256) KeyExchangeAlgorithm

func (c *TLSEcdheEcdsaWithAes128GcmSha256) KeyExchangeAlgorithm() KeyExchangeAlgorithm

KeyExchangeAlgorithm controls what key exchange algorithm is using during the handshake

func (*TLSEcdheEcdsaWithAes128GcmSha256) String

type TLSEcdheEcdsaWithAes256CbcSha

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

TLSEcdheEcdsaWithAes256CbcSha represents a TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA CipherSuite

func (*TLSEcdheEcdsaWithAes256CbcSha) AuthenticationType

func (c *TLSEcdheEcdsaWithAes256CbcSha) AuthenticationType() AuthenticationType

AuthenticationType controls what authentication method is using during the handshake

func (*TLSEcdheEcdsaWithAes256CbcSha) CertificateType

CertificateType returns what type of certficate this CipherSuite exchanges

func (*TLSEcdheEcdsaWithAes256CbcSha) Decrypt

func (c *TLSEcdheEcdsaWithAes256CbcSha) Decrypt(raw []byte) ([]byte, error)

Decrypt decrypts a single TLS RecordLayer

func (*TLSEcdheEcdsaWithAes256CbcSha) ECC

ECC uses Elliptic Curve Cryptography

func (*TLSEcdheEcdsaWithAes256CbcSha) Encrypt

func (c *TLSEcdheEcdsaWithAes256CbcSha) Encrypt(pkt *recordlayer.RecordLayer, raw []byte) ([]byte, error)

Encrypt encrypts a single TLS RecordLayer

func (*TLSEcdheEcdsaWithAes256CbcSha) HashFunc

func (c *TLSEcdheEcdsaWithAes256CbcSha) HashFunc() func() hash.Hash

HashFunc returns the hashing func for this CipherSuite

func (*TLSEcdheEcdsaWithAes256CbcSha) ID

ID returns the ID of the CipherSuite

func (*TLSEcdheEcdsaWithAes256CbcSha) Init

func (c *TLSEcdheEcdsaWithAes256CbcSha) Init(masterSecret, clientRandom, serverRandom []byte, isClient bool) error

Init initializes the internal Cipher with keying material

func (*TLSEcdheEcdsaWithAes256CbcSha) IsInitialized

func (c *TLSEcdheEcdsaWithAes256CbcSha) IsInitialized() bool

IsInitialized returns if the CipherSuite has keying material and can encrypt/decrypt packets

func (*TLSEcdheEcdsaWithAes256CbcSha) KeyExchangeAlgorithm

func (c *TLSEcdheEcdsaWithAes256CbcSha) KeyExchangeAlgorithm() KeyExchangeAlgorithm

KeyExchangeAlgorithm controls what key exchange algorithm is using during the handshake

func (*TLSEcdheEcdsaWithAes256CbcSha) String

type TLSEcdheEcdsaWithAes256GcmSha384

type TLSEcdheEcdsaWithAes256GcmSha384 struct {
	TLSEcdheEcdsaWithAes128GcmSha256
}

TLSEcdheEcdsaWithAes256GcmSha384 represents a TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 CipherSuite

func (*TLSEcdheEcdsaWithAes256GcmSha384) HashFunc

func (c *TLSEcdheEcdsaWithAes256GcmSha384) HashFunc() func() hash.Hash

HashFunc returns the hashing func for this CipherSuite

func (*TLSEcdheEcdsaWithAes256GcmSha384) ID

ID returns the ID of the CipherSuite

func (*TLSEcdheEcdsaWithAes256GcmSha384) Init

func (c *TLSEcdheEcdsaWithAes256GcmSha384) Init(masterSecret, clientRandom, serverRandom []byte, isClient bool) error

Init initializes the internal Cipher with keying material

func (*TLSEcdheEcdsaWithAes256GcmSha384) String

type TLSEcdhePskWithAes128CbcSha256

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

TLSEcdhePskWithAes128CbcSha256 implements the TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 CipherSuite

func NewTLSEcdhePskWithAes128CbcSha256

func NewTLSEcdhePskWithAes128CbcSha256() *TLSEcdhePskWithAes128CbcSha256

NewTLSEcdhePskWithAes128CbcSha256 creates TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 cipher.

func (*TLSEcdhePskWithAes128CbcSha256) AuthenticationType

func (c *TLSEcdhePskWithAes128CbcSha256) AuthenticationType() AuthenticationType

AuthenticationType controls what authentication method is using during the handshake

func (*TLSEcdhePskWithAes128CbcSha256) CertificateType

CertificateType returns what type of certificate this CipherSuite exchanges

func (*TLSEcdhePskWithAes128CbcSha256) Decrypt

func (c *TLSEcdhePskWithAes128CbcSha256) Decrypt(raw []byte) ([]byte, error)

Decrypt decrypts a single TLS RecordLayer

func (*TLSEcdhePskWithAes128CbcSha256) ECC

ECC uses Elliptic Curve Cryptography

func (*TLSEcdhePskWithAes128CbcSha256) Encrypt

Encrypt encrypts a single TLS RecordLayer

func (*TLSEcdhePskWithAes128CbcSha256) HashFunc

func (c *TLSEcdhePskWithAes128CbcSha256) HashFunc() func() hash.Hash

HashFunc returns the hashing func for this CipherSuite

func (*TLSEcdhePskWithAes128CbcSha256) ID

ID returns the ID of the CipherSuite

func (*TLSEcdhePskWithAes128CbcSha256) Init

func (c *TLSEcdhePskWithAes128CbcSha256) Init(masterSecret, clientRandom, serverRandom []byte, isClient bool) error

Init initializes the internal Cipher with keying material

func (*TLSEcdhePskWithAes128CbcSha256) IsInitialized

func (c *TLSEcdhePskWithAes128CbcSha256) IsInitialized() bool

IsInitialized returns if the CipherSuite has keying material and can encrypt/decrypt packets

func (*TLSEcdhePskWithAes128CbcSha256) KeyExchangeAlgorithm

func (c *TLSEcdhePskWithAes128CbcSha256) KeyExchangeAlgorithm() KeyExchangeAlgorithm

KeyExchangeAlgorithm controls what key exchange algorithm is using during the handshake

func (*TLSEcdhePskWithAes128CbcSha256) String

type TLSEcdheRsaWithAes128GcmSha256

type TLSEcdheRsaWithAes128GcmSha256 struct {
	TLSEcdheEcdsaWithAes128GcmSha256
}

TLSEcdheRsaWithAes128GcmSha256 implements the TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 CipherSuite

func (*TLSEcdheRsaWithAes128GcmSha256) CertificateType

CertificateType returns what type of certificate this CipherSuite exchanges

func (*TLSEcdheRsaWithAes128GcmSha256) ID

ID returns the ID of the CipherSuite

func (*TLSEcdheRsaWithAes128GcmSha256) String

type TLSEcdheRsaWithAes256CbcSha

type TLSEcdheRsaWithAes256CbcSha struct {
	TLSEcdheEcdsaWithAes256CbcSha
}

TLSEcdheRsaWithAes256CbcSha implements the TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA CipherSuite

func (*TLSEcdheRsaWithAes256CbcSha) CertificateType

func (c *TLSEcdheRsaWithAes256CbcSha) CertificateType() clientcertificate.Type

CertificateType returns what type of certificate this CipherSuite exchanges

func (*TLSEcdheRsaWithAes256CbcSha) ID

ID returns the ID of the CipherSuite

func (*TLSEcdheRsaWithAes256CbcSha) String

func (c *TLSEcdheRsaWithAes256CbcSha) String() string

type TLSEcdheRsaWithAes256GcmSha384

type TLSEcdheRsaWithAes256GcmSha384 struct {
	TLSEcdheEcdsaWithAes256GcmSha384
}

TLSEcdheRsaWithAes256GcmSha384 implements the TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 CipherSuite

func (*TLSEcdheRsaWithAes256GcmSha384) CertificateType

CertificateType returns what type of certificate this CipherSuite exchanges

func (*TLSEcdheRsaWithAes256GcmSha384) ID

ID returns the ID of the CipherSuite

func (*TLSEcdheRsaWithAes256GcmSha384) String

type TLSPskWithAes128CbcSha256

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

TLSPskWithAes128CbcSha256 implements the TLS_PSK_WITH_AES_128_CBC_SHA256 CipherSuite

func (*TLSPskWithAes128CbcSha256) AuthenticationType

func (c *TLSPskWithAes128CbcSha256) AuthenticationType() AuthenticationType

AuthenticationType controls what authentication method is using during the handshake

func (*TLSPskWithAes128CbcSha256) CertificateType

func (c *TLSPskWithAes128CbcSha256) CertificateType() clientcertificate.Type

CertificateType returns what type of certificate this CipherSuite exchanges

func (*TLSPskWithAes128CbcSha256) Decrypt

func (c *TLSPskWithAes128CbcSha256) Decrypt(raw []byte) ([]byte, error)

Decrypt decrypts a single TLS RecordLayer

func (*TLSPskWithAes128CbcSha256) ECC

ECC uses Elliptic Curve Cryptography

func (*TLSPskWithAes128CbcSha256) Encrypt

func (c *TLSPskWithAes128CbcSha256) Encrypt(pkt *recordlayer.RecordLayer, raw []byte) ([]byte, error)

Encrypt encrypts a single TLS RecordLayer

func (*TLSPskWithAes128CbcSha256) HashFunc

func (c *TLSPskWithAes128CbcSha256) HashFunc() func() hash.Hash

HashFunc returns the hashing func for this CipherSuite

func (*TLSPskWithAes128CbcSha256) ID

func (c *TLSPskWithAes128CbcSha256) ID() ID

ID returns the ID of the CipherSuite

func (*TLSPskWithAes128CbcSha256) Init

func (c *TLSPskWithAes128CbcSha256) Init(masterSecret, clientRandom, serverRandom []byte, isClient bool) error

Init initializes the internal Cipher with keying material

func (*TLSPskWithAes128CbcSha256) IsInitialized

func (c *TLSPskWithAes128CbcSha256) IsInitialized() bool

IsInitialized returns if the CipherSuite has keying material and can encrypt/decrypt packets

func (*TLSPskWithAes128CbcSha256) KeyExchangeAlgorithm

func (c *TLSPskWithAes128CbcSha256) KeyExchangeAlgorithm() KeyExchangeAlgorithm

KeyExchangeAlgorithm controls what key exchange algorithm is using during the handshake

func (*TLSPskWithAes128CbcSha256) String

func (c *TLSPskWithAes128CbcSha256) String() string

type TLSPskWithAes128GcmSha256

type TLSPskWithAes128GcmSha256 struct {
	TLSEcdheEcdsaWithAes128GcmSha256
}

TLSPskWithAes128GcmSha256 implements the TLS_PSK_WITH_AES_128_GCM_SHA256 CipherSuite

func (*TLSPskWithAes128GcmSha256) AuthenticationType

func (c *TLSPskWithAes128GcmSha256) AuthenticationType() AuthenticationType

AuthenticationType controls what authentication method is using during the handshake

func (*TLSPskWithAes128GcmSha256) CertificateType

func (c *TLSPskWithAes128GcmSha256) CertificateType() clientcertificate.Type

CertificateType returns what type of certificate this CipherSuite exchanges

func (*TLSPskWithAes128GcmSha256) ID

func (c *TLSPskWithAes128GcmSha256) ID() ID

ID returns the ID of the CipherSuite

func (*TLSPskWithAes128GcmSha256) KeyExchangeAlgorithm

func (c *TLSPskWithAes128GcmSha256) KeyExchangeAlgorithm() KeyExchangeAlgorithm

KeyExchangeAlgorithm controls what key exchange algorithm is using during the handshake

func (*TLSPskWithAes128GcmSha256) String

func (c *TLSPskWithAes128GcmSha256) String() string

Directories

Path Synopsis
Package types provides types for TLS Ciphers
Package types provides types for TLS Ciphers

Jump to

Keyboard shortcuts

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