Documentation ¶
Index ¶
Constants ¶
const ( // Zlib is the default Zlib Wrapper. This wrapper uses the default compression level. Use the 'NewZlib' // function to create a wrapper with a different level. Zlib = ZlibWrap(zlib.DefaultCompression) // Gzip is the default Gzip Wrapper. This wrapper uses the default compression level. Use the 'NewGzip' // function to create a wrapper with a different level. Gzip = GzipWrap(zlib.DefaultCompression) )
const ( // Hex is the Hex encoding Wrapper. This wraps the binary data as hex values. Hex = Simple(0x1) // Base64 is the Base64 Wrapper. This wraps the binary data as a Base64 byte string. This may be // combined with the Base64 transfrom. Base64 = Simple(0x2) )
Variables ¶
var ErrInvalid = xerr.New("provided crypto arguments cannot be nil")
ErrInvalid is returned when the arguments provided to any of the New* functions when the arguments are nil or empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
Block is a struct that contains an IV and Block-based Cipher that can be used to Wrap/Unwrap with the specified encryption algorithm.
func (*Block) Unwrap ¶
func (b *Block) Unwrap(r io.ReadCloser) (io.ReadCloser, error)
Unwrap satisfies the Wrapper interface.
func (*Block) Wrap ¶
func (b *Block) Wrap(w io.WriteCloser) (io.WriteCloser, error)
Wrap satisfies the Wrapper interface.
type GzipWrap ¶
type GzipWrap int8
GzipWrap is a alias for a Gzip compression level that implements the 'c2.Wrapper' interface.
func NewGzip ¶
NewGzip returns a Gzip compreession wrapper. This function will return and error if the commpression level is invalid.
func (GzipWrap) Unwrap ¶
func (GzipWrap) Unwrap(r io.ReadCloser) (io.ReadCloser, error)
Unwrap satisfies the Wrapper interface.
func (GzipWrap) Wrap ¶
func (g GzipWrap) Wrap(w io.WriteCloser) (io.WriteCloser, error)
Wrap satisfies the Wrapper interface.
type Simple ¶
type Simple uint8
Simple is an alias that allows for wrapping multiple types of simple mathematic-based Wrappers. This alias implements the 'c2.Wrapper' interface.
func (Simple) Unwrap ¶
func (s Simple) Unwrap(r io.ReadCloser) (io.ReadCloser, error)
Unwrap satisfies the Wrapper interface.
func (Simple) Wrap ¶
func (s Simple) Wrap(w io.WriteCloser) (io.WriteCloser, error)
Wrap satisfies the Wrapper interface.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream is a struct that contains a XMT Crypto Reader/Writer that can be used to Wrap/Unwrap using the specified streaming Reader and/or Writer types.
func NewCrypto ¶
NewCrypto returns a Wrapper based on the crypto.Writer and crypto.Reader interfaces, such as XOR and CBK.
func (*Stream) Unwrap ¶
func (s *Stream) Unwrap(r io.ReadCloser) (io.ReadCloser, error)
Unwrap satisfies the Wrapper interface.
func (*Stream) Wrap ¶
func (s *Stream) Wrap(w io.WriteCloser) (io.WriteCloser, error)
Wrap satisfies the Wrapper interface.
type ZlibWrap ¶
type ZlibWrap int8
ZlibWrap is a alias for a Zlib compression level that implements the 'c2.Wrapper' interface.
func NewZlib ¶
NewZlib returns a Zlib compreession wrapper. This function will return and error if the commpression level is invalid.
func (ZlibWrap) Unwrap ¶
func (ZlibWrap) Unwrap(r io.ReadCloser) (io.ReadCloser, error)
Unwrap satisfies the Wrapper interface.
func (ZlibWrap) Wrap ¶
func (z ZlibWrap) Wrap(w io.WriteCloser) (io.WriteCloser, error)
Wrap satisfies the Wrapper interface.