CovenantSQL: Index | Files | Directories

package crypto

import ""

Package crypto implements Asymmetric, Symmetric Encryption and Hash function.


Package Files

address.go cipher.go

func AddPKCSPadding Uses

func AddPKCSPadding(src []byte) []byte

AddPKCSPadding adds padding to a block of data.

func DecryptAndCheck Uses

func DecryptAndCheck(inputPrivateKey *asymmetric.PrivateKey, inData []byte) ([]byte, error)

DecryptAndCheck (inputPrivateKey, inData) MAIN PROCEDURE:

1. Decrypt the inData
2. Verify the HMAC.

func EncryptAndSign Uses

func EncryptAndSign(inputPublicKey *asymmetric.PublicKey, inData []byte) ([]byte, error)

EncryptAndSign (inputPublicKey, inData) MAIN PROCEDURE:

1. newPrivateKey, newPubKey := genSecp256k1Keypair()
2. encKey, HMACKey := SHA512(ECDH(newPrivateKey, inputPublicKey))
3. PaddedIn := PKCSPadding(in)
4. OutBytes := IV + newPubKey + AES-256-CBC(encKey, PaddedIn) + HMAC-SHA-256(HMACKey)

func PubKeyHash Uses

func PubKeyHash(pubKey *asymmetric.PublicKey) (addr proto.AccountAddress, err error)

PubKeyHash generates the account hash address for specified public key.

func RemovePKCSPadding Uses

func RemovePKCSPadding(src []byte) ([]byte, error)

RemovePKCSPadding removes padding from data that was added with addPKCSPadding.


asymmetricPackage asymmetric implements Asymmetric Encryption methods ported from btcd, Ethereum-go etc.
etlsPackage etls implements "Enhanced Transport Layer Security", but more efficient than TLS used in https.
hashPackage hash provides abstracted hash functionality.
kmsPackage kms implements Key Management System According the best practices from "sections 3.5 and 3.6 of the PCI DSS standard" and "ANSI X9.17 - Financial Institution Key Management".
secp256k1Package secp256k1 wraps the bitcoin secp256k1 C library.
symmetricPackage symmetric implements Symmetric Encryption methods.

Package crypto imports 8 packages (graph) and is imported by 20 packages. Updated 2019-06-12. Refresh now. Tools for package owners.