crypto

package
v0.99999.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package crypto describes interfaces for the various encryption and hmac algorithms that might be used to encrypt and sign transaction envelopes being passed securely in the TRISA network. Subpackages implement specific algorithms such as aesgcm for symmetric encryption or rsa for asymmetric encryption. Note that not all encryption mechanisms are legal in different countries, these interfaces allow the use of different algorithms and methodologies in the protocol without specifying what must be used.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Random

func Random(n int) (b []byte, err error)

Random generates a secure random sequence of bytes, this helper function is used to easily create keys, salts, and secrets in the crypto subpackages.

Types

type Cipher

type Cipher interface {
	Encrypt(plaintext []byte) (ciphertext []byte, err error)
	Decrypt(ciphertext []byte) (plaintext []byte, err error)
	EncryptionAlgorithm() string
}

Cipher is a device that can perform encryption and decryption, This interface wraps different encryption algorithms that must be identified in the TRISA protocol.

type Crypto

type Crypto interface {
	Cipher
	Signer
	KeyHandler
}

Crypto handler for TRISA transaction envelopes must be both a Cipher and a Signer.

type KeyHandler added in v0.3.3

type KeyHandler interface {
	EncryptionKey() (key []byte)
	HMACSecret() (secret []byte)
}

KeyHandler can return its internal encryption key and hmac secret

type KeyIdentifier added in v0.3.3

type KeyIdentifier interface {
	PublicKeySignature() (string, error)
}

KeyIdentifier can return a hash value or some other identifying material for a public key

type Signer

type Signer interface {
	Sign(data []byte) (signature []byte, err error)
	Verify(data, signature []byte) (err error)
	SignatureAlgorithm() string
}

Signer creates or verifies HMAC signatures. This interface wraps multiple hmac algorithms that must be identified in the TRISA protocol.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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