mailchain: github.com/mailchain/mailchain/crypto/cipher Index | Files | Directories

package cipher

import "github.com/mailchain/mailchain/crypto/cipher"

Package cipher collects common cryptographic constants and interfaces.

Index

Package Files

cipher.go

Constants

const (
    // NoOperation identified for Encrypt and Decrypter in noop package.
    NoOperation byte = 0x20
    // NACL identified for Encrypt and Decrypter in nacl package.
    NACL byte = 0x2a
    // AES256CBC identified for Encrypt and Decrypter in aes256cbc package.
    AES256CBC byte = 0x2e
)

type Decrypter Uses

type Decrypter interface {
    Decrypt(EncryptedContent) (PlainContent, error)
}

A Decrypter uses the PrivateKey to decrypt the supplied data.

The decryption method used is dependant on the implementation and must check that the data can be decrypted before continuing. Returned data should be the plain bytes that were supplied originally to the Encrypter.

type EncryptedContent Uses

type EncryptedContent []byte

EncryptedContent typed version of byte array that holds encrypted data.

Encrypt method returns the encrypted contents as EncryptedContent. Decrypt method accepts EncryptedContent as the encrypted contents to decrypt.

type Encrypter Uses

type Encrypter interface {
    Encrypt(pubKey crypto.PublicKey, plain PlainContent) (EncryptedContent, error)
}

An Encrypter uses the PublicKey to encrypt the supplied data.

The encryption method used is dependant on the implementation and must be included in the response. Returned encrypted data must include what encryption method was used as the first byte. The data can be decrypted using the corresponding PrivateKey and Decrypter method.

type PlainContent Uses

type PlainContent []byte

PlainContent typed version of byte array that holds plain data.

Encrypt method returns the encrypted contents as EncryptedContent. Decrypt method accepts EncryptedContent as the encrypted contents to decrypt.

Directories

PathSynopsis
aes256cbcpackage aes256cbc Advanced Encryption Standard, with a 256 bit key length, operating in the Chain Block Cipher mode (AES-256-CBC).
ciphertestPackage ciphertest is a generated GoMock package.
nacl
noop

Package cipher imports 1 packages (graph) and is imported by 10 packages. Updated 2019-11-19. Refresh now. Tools for package owners.