omcrypto

package
v0.0.0-...-63b02d4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package omcrypto is responsible for Message Encrypt, Decrypt, DecryptWithNode

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetClusterName

func SetClusterName(s string)

func SetClusterSecret

func SetClusterSecret(s string)

Types

type Message

type Message struct {
	ClusterName string
	NodeName    string
	Key         string
	Data        []byte
}

Message is the message to encrypt

func NewMessage

func NewMessage(b []byte) *Message

NewMessage allocates a new Message configured for the local node and cluster context

func (*Message) Decrypt

func (m *Message) Decrypt() (b []byte, err error)

Decrypt decrypts the message, if the nodename found in the message is a cluster node.

func (*Message) DecryptWithNode

func (m *Message) DecryptWithNode() ([]byte, string, error)

DecryptWithNode Decrypt the message

returns decodedMsg []byte, encryptorNodename string, error

func (*Message) Encrypt

func (m *Message) Encrypt() ([]byte, error)

Encrypt encrypts the message and returns a json with head keys describing the sender, and embedding the AES-encypted + Base64-encoded data.

Jump to

Keyboard shortcuts

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