Version: v0.14.0 Latest Latest

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

Go to latest
Published: Dec 21, 2021 License: Apache-2.0 Imports: 4 Imported by: 2




This section is empty.


View Source
var (
	ErrEncryptMessage    = errors.New("failed to encrypt message")
	ErrDecryptMessage    = errors.New("failed to decrypt message")
	ErrSignMessage       = errors.New("failed to sign message")
	ErrVerifyMessage     = errors.New("failed to verify message")
	ErrProcessMessage    = errors.New("failed to process message")
	ErrGetOutputSize     = errors.New("failed to get output size")
	ErrMissingMessage    = errors.NewWithCode(errors.InvalidParameter, "empty message for Secure Cell")
	ErrMissingPublicKey  = errors.NewWithCode(errors.InvalidParameter, "empty peer public key for Secure Message")
	ErrMissingPrivateKey = errors.NewWithCode(errors.InvalidParameter, "empty private key for Secure Message")
	ErrOutOfMemory       = errors.NewWithCode(errors.NoMemory, "Secure Message cannot allocate enough memory")
	// Deprecated: Since 0.14. Use ErrOutOfMemory instead.
	ErrOverflow = ErrOutOfMemory

Errors returned by Secure Message.


This section is empty.


type SecureMessage

type SecureMessage struct {
	// contains filtered or unexported fields

SecureMessage provides a sequence-independent, stateless, contextless messaging system.

func New

func New(private *keys.PrivateKey, peerPublic *keys.PublicKey) *SecureMessage

New makes a new Secure Message context. You need to specify both keys for encrypt-decrypt mode. Private key is required for signing messages. Public key is required for verifying messages

func (*SecureMessage) Sign

func (sm *SecureMessage) Sign(message []byte) ([]byte, error)

Sign signs the provided message and returns it signed.

func (*SecureMessage) Unwrap

func (sm *SecureMessage) Unwrap(message []byte) ([]byte, error)

Unwrap decrypts the encrypted message.

func (*SecureMessage) Verify

func (sm *SecureMessage) Verify(message []byte) ([]byte, error)

Verify checks the signature on the message and returns the original message.

func (*SecureMessage) Wrap

func (sm *SecureMessage) Wrap(message []byte) ([]byte, error)

Wrap encrypts the provided message.

Source Files

Jump to

Keyboard shortcuts

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