handler

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Seal

func Seal(id string, payload *protocol.Payload, cipher crypto.Crypto, key interface{}) (*protocol.SecureEnvelope, error)

Seal a payload using the specified symmetric key cipher and public signing key. This is a convienience method for users who do not want to directly Seal an Envelope.

Types

type Envelope

type Envelope struct {
	ID      string
	Payload *protocol.Payload
	Cipher  crypto.Crypto
}

Envelope wraps a SecureEnvelope containing all of the information necessary to access the payload data. The envelope can be edited and resealed to simplify TRISA exchanges.

func New

func New(id string, payload *protocol.Payload, cipher crypto.Crypto) *Envelope

New creates a new envelope, generating an ID if the ID is empty and creating a new AES-GCM cipher if the cipher is nil.

func Open

func Open(in *protocol.SecureEnvelope, key interface{}) (_ *Envelope, err error)

Open a secure envelope using the private signing key paired with the public key that was used to encrypt the symmetric payload encryption key. The open method decrypts the payload key, then decrypts and verifies the payload data using the algorithm information stored in the envelope. It returns a data structure with discovered cipher and decrypted Payload for access. On error returns *protocol.Error so that the error can be directly returned to the client.

func (*Envelope) Seal

func (e *Envelope) Seal(key interface{}) (out *protocol.SecureEnvelope, err error)

Seal an envelope using the public signing key of the TRISA peer. The envelope uses the internal Cipher to encrypt the Payload then encrypts the keys in the Cipher with the public key. On error returns *protocol.Error so that the error can be directly returned to the client.

Jump to

Keyboard shortcuts

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