hybrid

package
v1.3.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package hybrid provides subtle implementations of the HKDF and EC primitives.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeSharedSecret

func ComputeSharedSecret(pub *ECPoint, priv *ECPrivateKey) ([]byte, error)

ComputeSharedSecret is used to compute a shared secret using given private key and peer public key.

func GetCurve

func GetCurve(c string) (elliptic.Curve, error)

GetCurve returns the elliptic.Curve for a given standard curve name.

Types

type ECIESAEADHKDFHybridDecrypt

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

ECIESAEADHKDFHybridDecrypt is an instance of ECIES decryption with HKDF-KEM (key encapsulation mechanism) and AEAD-DEM (data encapsulation mechanism).

func NewECIESAEADHKDFHybridDecrypt

func NewECIESAEADHKDFHybridDecrypt(pvt *ECPrivateKey, hkdfSalt []byte, hkdfHMACAlgo string, ptFormat string, demHelper EciesAEADHKDFDEMHelper) (*ECIESAEADHKDFHybridDecrypt, error)

NewECIESAEADHKDFHybridDecrypt returns ECIES decryption construct with HKDF-KEM (key encapsulation mechanism) and AEAD-DEM (data encapsulation mechanism).

func (*ECIESAEADHKDFHybridDecrypt) Decrypt

func (e *ECIESAEADHKDFHybridDecrypt) Decrypt(ciphertext, contextInfo []byte) ([]byte, error)

Decrypt is used to decrypt using ECIES with a HKDF-KEM and AEAD-DEM mechanisms.

type ECIESAEADHKDFHybridEncrypt

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

ECIESAEADHKDFHybridEncrypt is an instance of ECIES encryption with HKDF-KEM (key encapsulation mechanism) and AEAD-DEM (data encapsulation mechanism).

func NewECIESAEADHKDFHybridEncrypt

func NewECIESAEADHKDFHybridEncrypt(pub *ECPublicKey, hkdfSalt []byte, hkdfHMACAlgo string, ptFormat string, demHelper EciesAEADHKDFDEMHelper) (*ECIESAEADHKDFHybridEncrypt, error)

NewECIESAEADHKDFHybridEncrypt returns ECIES encryption construct with HKDF-KEM (key encapsulation mechanism) and AEAD-DEM (data encapsulation mechanism).

func (*ECIESAEADHKDFHybridEncrypt) Encrypt

func (e *ECIESAEADHKDFHybridEncrypt) Encrypt(plaintext, contextInfo []byte) ([]byte, error)

Encrypt is used to encrypt using ECIES with a HKDF-KEM and AEAD-DEM mechanisms.

type ECIESHKDFRecipientKem

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

ECIESHKDFRecipientKem represents a HKDF-based KEM (key encapsulation mechanism) for ECIES recipient.

type ECIESHKDFSenderKem

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

ECIESHKDFSenderKem represents HKDF-based ECIES-KEM (key encapsulation mechanism) for ECIES sender.

type ECPoint

type ECPoint struct {
	X, Y *big.Int
}

ECPoint represents a point on the elliptic curve.

type ECPrivateKey

type ECPrivateKey struct {
	PublicKey ECPublicKey
	D         *big.Int
}

ECPrivateKey represents a elliptic curve public key.

func GenerateECDHKeyPair

func GenerateECDHKeyPair(c elliptic.Curve) (*ECPrivateKey, error)

GenerateECDHKeyPair will create a new private key for a given curve.

func GetECPrivateKey

func GetECPrivateKey(c elliptic.Curve, b []byte) *ECPrivateKey

GetECPrivateKey converts a stored private key to ECPrivateKey.

type ECPublicKey

type ECPublicKey struct {
	elliptic.Curve
	Point ECPoint
}

ECPublicKey represents a elliptic curve public key.

type EciesAEADHKDFDEMHelper

type EciesAEADHKDFDEMHelper interface {

	// GetSymmetricKeySize gives the size of the DEM-key in bytes
	GetSymmetricKeySize() uint32

	// GetAEAD returns the newly created AEAD primitive.
	GetAEAD(symmetricKeyValue []byte) (tink.AEAD, error)
}

EciesAEADHKDFDEMHelper a helper for DEM (data encapsulation mechanism) of ECIES-AEAD-HKDF.

type KEMKey

type KEMKey struct {
	Kem, SymmetricKey []byte
}

KEMKey represents a KEM managed key.

Jump to

Keyboard shortcuts

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