ecjson

package
v0.17.2 Latest Latest
Warning

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

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

Documentation

Overview

Package ecjson represents encrypted and compressed content using JSON-based

Index

Constants

This section is empty.

Variables

View Source
var ErrMessageTooLarge = errors.New("ecjson: message too large")

ErrMessageTooLarge is returned if the data is too large to be processed.

Functions

func New

New takes a base64 encoded secret key and returns a new XChacha20poly1305 cipher.

Types

type EncryptedCompressedJSON

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

EncryptedCompressedJSON implements SecureEncoder for JSON using an AEAD cipher.

See https://en.wikipedia.org/wiki/Authenticated_encryption

func (*EncryptedCompressedJSON) Marshal

func (c *EncryptedCompressedJSON) Marshal(s interface{}) ([]byte, error)

Marshal marshals the interface state as JSON, encrypts the JSON using the cipher and base64 encodes the binary value as a string and returns the result

can panic if source of random entropy is exhausted generating a nonce.

func (*EncryptedCompressedJSON) Unmarshal

func (c *EncryptedCompressedJSON) Unmarshal(data []byte, s interface{}) error

Unmarshal takes the marshaled string, base64-decodes into a byte slice, decrypts the byte slice the passed cipher, and unmarshals the resulting JSON into the struct pointer passed

Jump to

Keyboard shortcuts

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