encrypt

package
v0.0.0-...-87adcba Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NONCE_LEN = 12

	RECEIVE_MTU = 2048
	ADDED_BYTES = 16 /* final OCB block */
)

Variables

This section is empty.

Functions

func DisableDumpingCore

func DisableDumpingCore() error

Disable dumping core, as a precaution to avoid saving sensitive data to disk.

func PrngFill

func PrngFill(size int) (dst []byte)

use sys call to generate random number

func PrngUint8

func PrngUint8() uint8

func ReenableDumpingCore

func ReenableDumpingCore() error

restore the dumping core to saved value

func Unique

func Unique() uint64

Types

type Base64Key

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

func NewBase64Key

func NewBase64Key() *Base64Key

random key 128bit

func NewBase64Key2

func NewBase64Key2(printableKey string) *Base64Key

func (*Base64Key) String

func (b *Base64Key) String() string

type Message

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

func NewMessage

func NewMessage(seqNonce uint64, payload []byte) (m *Message)

func (*Message) GetPayload

func (m *Message) GetPayload() (payload []byte)

func (*Message) GetTimestamp

func (m *Message) GetTimestamp() uint16

the first two bytes is timestamp in text field

func (*Message) GetTimestampReply

func (m *Message) GetTimestampReply() uint16

the [2:4] bytes is timestampReply in text field

func (*Message) NonceVal

func (m *Message) NonceVal() uint64

type Session

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

func NewSession

func NewSession(key Base64Key) (*Session, error)

func (*Session) Decrypt

func (s *Session) Decrypt(text []byte) (*Message, error)

Decrypt with AES-128 GCM

func (*Session) Encrypt

func (s *Session) Encrypt(plainText *Message) []byte

Encrypt with AES-128 GCM

Jump to

Keyboard shortcuts

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