Documentation ¶
Overview ¶
Package crypto - wrapper for encryption libraries required by service
Index ¶
- Constants
- func AESCBCDecrypt(k []byte, iv []byte, c []byte) (p []byte)
- func AESCBCEncrypt(k []byte, iv []byte, p []byte) (c []byte)
- func BLSAddG1(R1 []byte, R2 []byte) (rc int, R []byte)
- func BLSAddG2(R1 []byte, R2 []byte) (rc int, R []byte)
- func BLSKeys(seed []byte, ski []byte) (rc int, pk []byte, sko []byte)
- func BLSMakeShares(k int, n int, seed []byte, ski []byte) (rc int, x []byte, y []byte, sko []byte)
- func BLSRecoverSecret(k int, x []byte, y []byte) (rc int, sk []byte)
- func BLSRecoverSignature(k int, x []byte, y []byte) (rc int, sig []byte)
- func BLSSign(m []byte, sk []byte) (rc int, s []byte)
- func BLSVerify(m []byte, pk []byte, s []byte) (rc int)
- func DecapsulateDecrypt(c []byte, iv []byte, sikeSK []byte, ek []byte) (rc int, p []byte)
- func EncapsulateEncrypt(p []byte, iv []byte, sikePK []byte) (rc int, c []byte, ek []byte)
- func SIKEKeys(seed []byte) (rc int, sikePK []byte, sikeSK []byte)
- func Secp256k1Decrypt(C, V, T, sK string) (message string, err error)
- func Secp256k1Encrypt(message, publicKey string) (C, V, T string, err error)
- type Octet
- type Rand
Constants ¶
const BFSBLS381 int = int(C.BFS_BLS381)
BFSBLS381 Field size
const BGSBLS381 int = int(C.BGS_BLS381)
BGSBLS381 Group size
const G2Len int = 4 * BFSBLS381
G2Len G2 point size
const SIGLen int = BFSBLS381 + 1
SIGLen Signature length
Variables ¶
This section is empty.
Functions ¶
func AESCBCDecrypt ¶
AESCBCDecrypt AES-CBC Decryption
AES decryption using CBC mode @param K Key @param IV Initialization vector IV (16 bytes) @param C Ciphertext @param P Plaintext
func AESCBCEncrypt ¶
AESCBCEncrypt AES-CBC Encryption
AES encryption using CBC mode @param K Key @param IV Initialization vector IV (16 bytes) @param P Plaintext @param C Ciphertext
func BLSAddG1 ¶
BLSAddG1 Add two members from the group G1
Add two members from the group G1 @param R1 member of G1 @param R2 member of G1 @param R member of G1. r = r1+r2 @param rc Return code. Zero for success or else an error code
func BLSAddG2 ¶
BLSAddG2 Add two members from the group G2
Add two members from the group G2 @param R1 member of G2 @param R2 member of G2 @param R member of G2. r = r1+r2 @param rc Return code. Zero for success or else an error code
func BLSKeys ¶
BLSKeys Generate BLS keys
Generate public and private key pair. If the seed value is nil then generate the public key using the input secret key.
@param seed seed value for CSPRNG. @param ski input secret key @param pk public key @param sko output secret key @param rc Return code. Zero for success or else an error code
func BLSMakeShares ¶
BLSMakeShares Use Shamir's secret sharing to distribute BLS secret keys
Use Shamir's secret sharing to distribute BLS secret keys ¶
@param k Threshold @param n Number of shares @param seed seed value for CSPRNG @param ski Secret key to be shared. @param x x values @param y y values. Valid BLS secret keys @param rc Zero for success or else an error code
func BLSRecoverSecret ¶
BLSRecoverSecret Use Shamir's secret sharing to recover a BLS secret key
Use Shamir's secret sharing to recover a BLS secret key ¶
@param k Threshold @param x x values @param y y values. Valid BLS secret keys @param sk Secret key that is recovered @param rc Zero for success or else an error code
func BLSRecoverSignature ¶
BLSRecoverSignature Use Shamir's secret sharing to recover a BLS signature
Use Shamir's secret sharing to recover a BLS signature ¶
@param k Threshold @param x x values @param y y values. Valid BLS signatures @param sig Signature that is recovered @param rc Zero for success or else an error code
func BLSSign ¶
BLSSign Sign a message
The message is signed using the BLS algorithm @param M Message to be signed @param sk secret key @param S Signature @param rc Return code. Zero for success or else an error code
func BLSVerify ¶
BLSVerify Verify a signature
Verify a signature using the BLS algorithm @param M Message that was signed @param pk public key @param S Signature @param rc Return code. Zero for success or else an error code
func DecapsulateDecrypt ¶
DecapsulateDecrypt Decapsulate the AES Key and decrypt the message
Decapsulate the AES key and use it to decrypt the ciphertext. The plaintext is returned using the C parameter.
@param C Ciphertext to be decrypted @param IV Initialization vector IV @param sikeSK SIKE secret key @param EK Encapsulated key @param P Plaintext @param rc Return code. Zero for success or else an error code
func EncapsulateEncrypt ¶
EncapsulateEncrypt Encrypt a message and encapsulate the AES Key for a recipient.
The message is encrypted using AES-256. The key is generated inside this function as an output from the encapsulation function. The ciphertext is returned using the P paramter. @param P Plaintext to be encrypted @param IV Initialization vector IV (16 bytes) @param sikePK SIKE public key @param C Ciphertext @param EK Encapsulated key @param rc Return code. Zero for success or else an error code
func SIKEKeys ¶
SIKEKeys Generate SIKE keys
Generate SIKE public and private key pair ¶
@param seed seed value for CSPRNG @param sikePK SIKE public key @param sikeSK SIKE secret key @param rc Return code. Zero for success or else an error code
func Secp256k1Decrypt ¶
Secp256k1Decrypt decrypts an encrypoted message using ECP_SECP256K1_ECIES
func Secp256k1Encrypt ¶
Secp256k1Encrypt encrypts a message using ECP_SECP256K1_ECIES