Documentation ¶
Index ¶
- func DecryptSymmetric(key []byte, cyphertext []byte) ([]byte, error)
- func EncryptSymmetric(key, plaintext []byte) ([]byte, error)
- func ExtractSignature(data, signature []byte) (*ecdsa.PublicKey, error)
- func ExtractSignatures(signaturePairs [][2]string) ([]string, error)
- func Sign(data string, identity *ecdsa.PrivateKey) (string, error)
- func SignBytes(data []byte, identity *ecdsa.PrivateKey) ([]byte, error)
- func SignBytesAsHex(data []byte, identity *ecdsa.PrivateKey) (string, error)
- func SignStringAsHex(data string, identity *ecdsa.PrivateKey) (string, error)
- func VerifySignatures(signaturePairs [][3]string) error
- type DHPair
- type EthereumCrypto
- func (c EthereumCrypto) DH(dhPair dr.DHPair, dhPub dr.Key) (dr.Key, error)
- func (c EthereumCrypto) Decrypt(mk dr.Key, authCiphertext, ad []byte) ([]byte, error)
- func (c EthereumCrypto) Encrypt(mk dr.Key, plaintext, ad []byte) ([]byte, error)
- func (c EthereumCrypto) GenerateDH() (dr.DHPair, error)
- func (c EthereumCrypto) KdfCK(ck dr.Key) (dr.Key, dr.Key)
- func (c EthereumCrypto) KdfRK(rk, dhOut dr.Key) (dr.Key, dr.Key, dr.Key)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncryptSymmetric ¶
func ExtractSignature ¶ added in v0.4.0
ExtractSignature returns a public key for a given data and signature.
func ExtractSignatures ¶
ExtractSignatures extract from tuples of signatures content a public key DEPRECATED: use ExtractSignature
func Sign ¶
func Sign(data string, identity *ecdsa.PrivateKey) (string, error)
Sign signs the hash of arbitrary data. DEPRECATED: use SignStringAsHex instead.
func SignBytes ¶ added in v0.3.0
func SignBytes(data []byte, identity *ecdsa.PrivateKey) ([]byte, error)
SignBytes signs the hash of arbitrary data.
func SignBytesAsHex ¶ added in v0.3.0
func SignBytesAsHex(data []byte, identity *ecdsa.PrivateKey) (string, error)
SignStringAsHex signs the Keccak256 hash of arbitrary data and returns its hex representation.
func SignStringAsHex ¶ added in v0.3.0
func SignStringAsHex(data string, identity *ecdsa.PrivateKey) (string, error)
SignStringAsHex signs the Keccak256 hash of arbitrary string and returns its hex representation.
func VerifySignatures ¶
VerifySignatures verifies tuples of signatures content/hash/public key
Types ¶
type DHPair ¶
func (DHPair) PrivateKey ¶
type EthereumCrypto ¶
type EthereumCrypto struct{}
EthereumCrypto is an implementation of Crypto with cryptographic primitives recommended by the Double Ratchet Algorithm specification. However, some details are different, see function comments for details.
func (EthereumCrypto) Encrypt ¶
Encrypt uses a slightly different approach than in the algorithm specification: it uses AES-256-CTR instead of AES-256-CBC for security, ciphertext length and implementation complexity considerations.
func (EthereumCrypto) GenerateDH ¶
func (c EthereumCrypto) GenerateDH() (dr.DHPair, error)
See the Crypto interface.