Documentation
¶
Index ¶
- func DecryptSymmetric(key []byte, cyphertext []byte) ([]byte, error)
- func EncryptSymmetric(key, plaintext []byte) ([]byte, error)
- func ExtractSignatures(signaturePairs [][2]string) ([]string, error)
- func Sign(content 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
- func (c EthereumCrypto) Decrypt(mk dr.Key, authCiphertext, ad []byte) ([]byte, error)
- func (c EthereumCrypto) Encrypt(mk dr.Key, plaintext, ad []byte) []byte
- func (c EthereumCrypto) GenerateDH() (dr.DHPair, error)
- func (c EthereumCrypto) KdfCK(ck dr.Key) (chainKey dr.Key, msgKey dr.Key)
- func (c EthereumCrypto) KdfRK(rk, dhOut dr.Key) (rootKey, chainKey, headerKey dr.Key)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncryptSymmetric ¶
func ExtractSignatures ¶
ExtractSignatures extract from tuples of signatures content a public key
func Sign ¶
func Sign(content string, identity *ecdsa.PrivateKey) (string, error)
Sign signs the hash of an arbitrary string
func VerifySignatures ¶
VerifySignatures verifys 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 ¶
func (c EthereumCrypto) Encrypt(mk dr.Key, plaintext, ad []byte) []byte
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.
Click to show internal directories.
Click to hide internal directories.