Documentation
¶
Overview ¶
Package utils defines some crypto/signature utilities
Package utils file implements the Elliptic Curve Digital Signature Algorithm, as defined in FIPS 186-3.
This implementation derives the nonce from an AES-CTR CSPRNG keyed by ChopMD(256, SHA2-512(priv.D || entropy || hash)). The CSPRNG key is IRO by a result of Coron; the AES-CTR stream is IRO under standard assumptions.
Index ¶
- func AESDecrypt(ct, key []byte) ([]byte, error)
- func AESDecryptHex(ctHex string, key []byte) ([]byte, error)
- func AESEncrypt(pt, key []byte) ([]byte, error)
- func AESEncryptHex(pt, key []byte) (string, error)
- func GenerateKeyBySeed(c elliptic.Curve, seed []byte) (*ecdsa.PrivateKey, error)
- func MarshalECDSASignature(r, s *big.Int) ([]byte, error)
- func MarshalPublicKey(publicKey *ecdsa.PublicKey) []byte
- func UnmarshalECDSASignature(rawSig []byte) (*big.Int, *big.Int, error)
- type ECDSASignature
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AESDecrypt ¶
AESDecrypt decrypt encrypted text to plaint text using key
func AESDecryptHex ¶
AESDecryptHex decrypt base64-encoded encrypted text to plaint text using key
func AESEncrypt ¶
AESEncrypt encrypt plaint text to encrypted text using key
func AESEncryptHex ¶
AESEncryptHex encrypt plaint text to base64-encoded encrypted text using key
func GenerateKeyBySeed ¶
GenerateKeyBySeed generates a public and private key pair.
func MarshalECDSASignature ¶
MarshalECDSASignature use DER-encoded ASN.1 octet standard to represent the signature 与比特币算法一样,基于DER-encoded ASN.1 octet标准,来表达使用椭圆曲线签名算法返回的结果
func MarshalPublicKey ¶
MarshalPublicKey 将公钥序列化成byte数组
Types ¶
type ECDSASignature ¶
ECDSASignature is the structure for marshall signature