Documentation ¶
Overview ¶
Package crypto provides interface for cipher method providers. Clients can using those cipher methods via io.ReadWriter interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStream ¶
func NewStream(cipherName string, keyGen KeyGenerator, rw io.ReadWriter) (io.ReadWriter, error)
NewStream wraps rw through stream cipher provided by cipherName. On Read, first few bytes will be interpreted as iv used for decryption. On Write, plaintext iv will be prepended in first call for read end decryption.
Types ¶
type Cipher ¶
type Cipher interface { KeyLen() int IVLen() int NewEncrypter(key, iv []byte) (cipher.Stream, error) NewDecrypter(key, iv []byte) (cipher.Stream, error) }
Cipher is the interface that implemented by cipher provider.
type DuplicatedCipherMethodError ¶
type DuplicatedCipherMethodError string
func (DuplicatedCipherMethodError) Error ¶
func (name DuplicatedCipherMethodError) Error() string
type KeyGenerator ¶
KeyGenerator is cipher key generator. For given generator, it must generate the same key for the same input.
type UnsupportedCipherMethodError ¶
type UnsupportedCipherMethodError string
func (UnsupportedCipherMethodError) Error ¶
func (name UnsupportedCipherMethodError) Error() string
Click to show internal directories.
Click to hide internal directories.