Documentation ¶
Overview ¶
Package crypto implements Asymmetric, Symmetric Encryption and Hash function.
Index ¶
- func AddPKCSPadding(src []byte) []byte
- func DecryptAndCheck(inputPrivateKey *asymmetric.PrivateKey, inData []byte) ([]byte, error)
- func EncryptAndSign(inputPublicKey *asymmetric.PublicKey, inData []byte) ([]byte, error)
- func PubKeyHash(pubKey *asymmetric.PublicKey) (addr proto.AccountAddress, err error)
- func RemovePKCSPadding(src []byte) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPKCSPadding ¶
AddPKCSPadding adds padding to a block of data.
func DecryptAndCheck ¶
func DecryptAndCheck(inputPrivateKey *asymmetric.PrivateKey, inData []byte) ([]byte, error)
DecryptAndCheck (inputPrivateKey, inData) MAIN PROCEDURE:
- Decrypt the inData
- Verify the HMAC.
func EncryptAndSign ¶
func EncryptAndSign(inputPublicKey *asymmetric.PublicKey, inData []byte) ([]byte, error)
EncryptAndSign (inputPublicKey, inData) MAIN PROCEDURE:
- newPrivateKey, newPubKey := genSecp256k1Keypair()
- encKey, HMACKey := SHA512(ECDH(newPrivateKey, inputPublicKey))
- PaddedIn := PKCSPadding(in)
- OutBytes := IV + newPubKey + AES-256-CBC(encKey, PaddedIn) + HMAC-SHA-256(HMACKey)
func PubKeyHash ¶
func PubKeyHash(pubKey *asymmetric.PublicKey) (addr proto.AccountAddress, err error)
PubKeyHash generates the account hash address for specified public key.
func RemovePKCSPadding ¶
RemovePKCSPadding removes padding from data that was added with addPKCSPadding.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package asymmetric implements Asymmetric Encryption methods ported from btcd, Ethereum-go etc.
|
Package asymmetric implements Asymmetric Encryption methods ported from btcd, Ethereum-go etc. |
Package etls implements "Enhanced Transport Layer Security", but more efficient than TLS used in https.
|
Package etls implements "Enhanced Transport Layer Security", but more efficient than TLS used in https. |
Package hash provides abstracted hash functionality.
|
Package hash provides abstracted hash functionality. |
Package 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".
|
Package 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". |
Package secp256k1 wraps the bitcoin secp256k1 C library.
|
Package secp256k1 wraps the bitcoin secp256k1 C library. |
Package symmetric implements Symmetric Encryption methods.
|
Package symmetric implements Symmetric Encryption methods. |
Click to show internal directories.
Click to hide internal directories.