envelope

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EncryptSymmetricKeySalt = []byte("encrypt_symmetric_key")

	ErrInvalidEnvelopeSignature     = errors.New("Envelope signature verification failed")
	ErrInvalidRecipientKeySignature = errors.New("Recipient key signature verification failed")
	ErrNotRecipient                 = errors.New("The private key is not a recipient of the envelope. Likely you sealed the envelope before adding the key to the lws")
)

Functions

func Dump

func Dump(r io.Reader, verbose bool, pubaf PublicKeyAnnotatorFunc) (string, error)

func EncryptSymmetricKey

func EncryptSymmetricKey(symmetricKey []byte, akey AssymmetricKey, recipient *ecdsa.PublicKey, randr io.Reader) (*pb.EncryptedSymmetricKey, error)

func Seal

func Seal(w io.Writer, plaintext []byte, akey AssymmetricKey, recipients []*ecdsa.PublicKey, randr io.Reader) error

func Unseal

func Unseal(r io.Reader, akey AssymmetricKey) ([]byte, []*ecdsa.PublicKey, error)

Types

type AssymmetricKey

type AssymmetricKey interface {
	Public() *ecdsa.PublicKey
	Sign(s256digest []byte) ([]byte, error)
	ECDH(pub *ecdsa.PublicKey) ([]byte, error)
	io.Closer
}

type LocalPrivateKey

type LocalPrivateKey struct {
	Priv *ecdsa.PrivateKey
	// contains filtered or unexported fields
}

func NewLocalPrivateKey

func NewLocalPrivateKey(priv *ecdsa.PrivateKey) *LocalPrivateKey

func (*LocalPrivateKey) Close added in v0.0.2

func (k *LocalPrivateKey) Close() error

func (*LocalPrivateKey) ECDH

func (k *LocalPrivateKey) ECDH(pub *ecdsa.PublicKey) ([]byte, error)

func (*LocalPrivateKey) Public

func (k *LocalPrivateKey) Public() *ecdsa.PublicKey

func (*LocalPrivateKey) Sign

func (k *LocalPrivateKey) Sign(s256digest []byte) ([]byte, error)

type PublicKeyAnnotatorFunc

type PublicKeyAnnotatorFunc func(*ecdsa.PublicKey) string

Jump to

Keyboard shortcuts

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