cryptography

package
v0.0.6-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AESKeySize - Always use 256 bit keys
	AESKeySize = 16

	// GCMNonceSize - 96 bit nonces for GCM
	GCMNonceSize = 12
)

Variables

This section is empty.

Functions

func GCMDecrypt

func GCMDecrypt(key AESKey, ciphertext []byte) ([]byte, error)

GCMDecrypt - Decrypt GCM ciphertext

func GCMEncrypt

func GCMEncrypt(key AESKey, plaintext []byte) ([]byte, error)

GCMEncrypt - Encrypt using AES GCM

func RSADecrypt

func RSADecrypt(ciphertext []byte, privateKey *rsa.PrivateKey) ([]byte, error)

RSADecrypt - Decrypt ciphertext with rsa private key

func RSAEncrypt

func RSAEncrypt(msg []byte, pub *rsa.PublicKey) ([]byte, error)

RSAEncrypt - Encrypt a msg with a public rsa key

Types

type AESIV

type AESIV [aes.BlockSize]byte

AESIV - 128 bit IV

func RandomAESIV

func RandomAESIV() AESIV

RandomAESIV - 128 bit Random IV

type AESKey

type AESKey [AESKeySize]byte

AESKey - 128 bit key

func AESKeyFromBytes

func AESKeyFromBytes(data []byte) (AESKey, error)

AESKeyFromBytes - Convert byte slice to AESKey

func RandomAESKey

func RandomAESKey() AESKey

RandomAESKey - Generate random ID of randomIDSize bytes

Jump to

Keyboard shortcuts

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