mailchain: Index | Files | Directories

package crypto

import ""


Package Files

hash.go keys.go private.go public.go


const (
    // SECP256K1 value.
    SECP256K1 = "secp256k1"
    // ED25519 value.
    ED25519 = "ed25519"

func CreateIntegrityHash Uses

func CreateIntegrityHash(encryptedData []byte) multihash.Multihash

CreateIntegrityHash returns a hash of the encrypted `[]byte` to allow easy checking it has not been tampered with.

func CreateMessageHash Uses

func CreateMessageHash(encodedData []byte) multihash.Multihash

CreateMessageHash used to verify if the contents of the message match the hash.

func KeyTypes Uses

func KeyTypes() map[string]bool

KeyTypes available key types.

type PrivateKey Uses

type PrivateKey interface {
    // Bytes returns the byte representation of the private key
    Bytes() []byte
    // PublicKey from the PrivateKey
    PublicKey() PublicKey
    // Kind returns the type of the key
    Kind() string
    // Sign signs the message with the key and returns the signature.
    Sign(message []byte) ([]byte, error)

PrivateKey definition usable in all mailchain crypto operations

type PublicKey Uses

type PublicKey interface {
    // Bytes returns the raw bytes representation of the public key.
    // The returned bytes are used for encrypting, verifying a signature, and locating an address.
    Bytes() []byte
    // Kind returns the type of the key.
    Kind() string
    // Verify verifies whether sig is a valid signature of message.
    Verify(message, sig []byte) bool

PublicKey definition usable in all mailchain crypto operations


cipherPackage cipher collects common cryptographic constants and interfaces.
cipher/aes256cbcPackage aes256cbc implements Advanced Encryption Standard with a 256 bit key length, using Chain Block Cipher mode (AES-256-CBC).
cipher/ciphertestPackage ciphertest is a generated GoMock package.

Package crypto imports 1 packages (graph) and is imported by 18 packages. Updated 2019-12-08. Refresh now. Tools for package owners.