ece

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

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

Go to latest
Published: Jul 23, 2017 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDHContext

func BuildDHContext(clientPublic []byte, serverPublic []byte) []byte

BuildDHContext builds the context from the Diffie-Hellman keys that is needed to derive the encryption key and nonce. https://tools.ietf.org/html/draft-ietf-httpbis-encryption-encoding-00#section-4.2

func CreateRequest

func CreateRequest(client http.Client, url string, data []byte, cryptoKey *CryptoKeyHeader, encryption *EncryptionHeader, ttl int) *http.Request

CreateRequest creates a new http.Request with the ECE headers set correctly based on the |cryptoKey| and |encryption| parameters.

func Encrypt

func Encrypt(plaintext []byte, keys *EncryptionKeys, paddingLength int) ([]byte, error)

Encrypt encrypts |plaintext| using AEAD_AES_GCM_128 with the keys in |keys| adding |paddingLength| bytes of padding.

Types

type CryptoKeyHeader

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

CryptoKeyHeader is a small struct that can be used to define the values in the "Crypto-Key" header. https://tools.ietf.org/html/draft-ietf-httpbis-encryption-encoding-00#section-4

func (*CryptoKeyHeader) SetDHKey

func (ckh *CryptoKeyHeader) SetDHKey(publicKey []byte)

SetDHKey sets the Diffie-Hellman (public) key. https://tools.ietf.org/html/draft-ietf-httpbis-encryption-encoding-00#section-4.2

func (*CryptoKeyHeader) SetExplicitKey

func (ckh *CryptoKeyHeader) SetExplicitKey(key []byte)

SetExplicitKey sets the explicit encryption key. https://tools.ietf.org/html/draft-ietf-httpbis-encryption-encoding-00#section-4.1

func (*CryptoKeyHeader) SetKeyID

func (ckh *CryptoKeyHeader) SetKeyID(keyID string)

SetKeyID sets the keyid. https://tools.ietf.org/html/draft-ietf-httpbis-encryption-encoding-00#section-4.3

type EncryptionHeader

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

EncryptionHeader is a small struct that can be used to define the values in the "Encryption" header. https://tools.ietf.org/html/draft-ietf-httpbis-encryption-encoding-00#section-3

func (*EncryptionHeader) SetKeyID

func (eh *EncryptionHeader) SetKeyID(keyID string)

SetKeyID set the keyid.

func (*EncryptionHeader) SetRecordSize

func (eh *EncryptionHeader) SetRecordSize(size int)

SetRecordSize sets the record size for the message. https://tools.ietf.org/html/draft-ietf-httpbis-encryption-encoding-00#section-3.1

func (*EncryptionHeader) SetSalt

func (eh *EncryptionHeader) SetSalt(salt []byte)

SetSalt sets the encryption salt that should be used for key derivation. https://tools.ietf.org/html/draft-ietf-httpbis-encryption-encoding-00#section-3.1

type EncryptionKeys

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

EncryptionKeys contains the salt, (optional) auth, encryption key, and nonce.

func (*EncryptionKeys) CreateEncryptionKeys

func (ek *EncryptionKeys) CreateEncryptionKeys(secret []byte, context []byte)

CreateEncryptionKeys derives the encryption key and nonce from the input keying material.

func (*EncryptionKeys) GetSalt

func (ek *EncryptionKeys) GetSalt() []byte

GetSalt returns the generated salt.

func (*EncryptionKeys) SetPreSharedAuthSecret

func (ek *EncryptionKeys) SetPreSharedAuthSecret(preSharedAuthSecret []byte)

SetPreSharedAuthSecret sets the (optional) pre-shared authentication secret that is to be used during key derivation.

Jump to

Keyboard shortcuts

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