Documentation ¶
Index ¶
- Variables
- func GenerateAndEncryptSymmetricKey(Y *[32]byte) (k *[32]byte, C1 *[32]byte, C2 *[32]byte, symk *[32]byte, err error)
- func GenerateRegulationKey() (privateKey *[32]byte, publicKey *[32]byte)
- func GetSymmetricKeyWithK(C2 *[32]byte, Y *[32]byte, k *[32]byte) (symk *[32]byte, err error)
- func GetSymmetricKeyWithX(C1 *[32]byte, C2 *[32]byte, x *[32]byte) (symk *[32]byte, err error)
- func PKCS5Padding(plainText []byte, blockSize int) []byte
- func PKCS5UnPadding(plainText []byte) ([]byte, error)
- type AesCipher
- type SymmetricCipher
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 ¶
generate x and Y. Y = x * G
func GetSymmetricKeyWithK ¶
func GetSymmetricKeyWithX ¶
x is the regulator's private key
func PKCS5Padding ¶
func PKCS5UnPadding ¶
Types ¶
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
Click to show internal directories.
Click to hide internal directories.