regulation

package
v0.0.0-...-ce7d804 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommonIV = []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}

Functions

func GenerateAndEncryptSymmetricKey

func GenerateAndEncryptSymmetricKey(Y *[32]byte) (k *[32]byte, C1 *[32]byte, C2 *[32]byte, symk *[32]byte, err error)

Y is regulator's public key

func GenerateRegulationKey

func GenerateRegulationKey() (privateKey *[32]byte, publicKey *[32]byte)

generate x and Y. Y = x * G

func GetSymmetricKeyWithK

func GetSymmetricKeyWithK(C2 *[32]byte, Y *[32]byte, k *[32]byte) (symk *[32]byte, err error)

func GetSymmetricKeyWithX

func GetSymmetricKeyWithX(C1 *[32]byte, C2 *[32]byte, x *[32]byte) (symk *[32]byte, err error)

x is the regulator's private key

func PKCS5Padding

func PKCS5Padding(plainText []byte, blockSize int) []byte

func PKCS5UnPadding

func PKCS5UnPadding(plainText []byte) ([]byte, error)

Types

type AesCipher

type AesCipher struct{}

func (AesCipher) Decrypt

func (a AesCipher) Decrypt(cipherText []byte, secret []byte) (plainText []byte, err error)

func (AesCipher) Encrypt

func (a AesCipher) Encrypt(plainText []byte, secret []byte) (cipherText []byte, err error)

type SymmetricCipher

type SymmetricCipher interface {
	Encrypt(plainText []byte, secret []byte) (cipherText []byte, err error)
	Decrypt(cipherText []byte, secret []byte) (plainText []byte, err error)
}

func GetSymmetricCipher

func GetSymmetricCipher() SymmetricCipher

Jump to

Keyboard shortcuts

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