Documentation ¶
Index ¶
- func BuildDHContext(clientPublic []byte, serverPublic []byte) []byte
- func CreateRequest(client http.Client, url string, data []byte, cryptoKey *CryptoKeyHeader, ...) *http.Request
- func Encrypt(plaintext []byte, keys *EncryptionKeys, paddingLength int) ([]byte, error)
- type CryptoKeyHeader
- type EncryptionHeader
- type EncryptionKeys
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDHContext ¶
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.
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.