crypto

package
v0.0.0-...-d9af017 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateNonce

func GenerateNonce(size int) []byte

func Sha1Digest

func Sha1Digest(data []byte) []byte

func Sha256Digest

func Sha256Digest(data []byte) []byte

Types

type AES256IGECryptor

type AES256IGECryptor struct {
	// contains filtered or unexported fields
}

func NewAES256IGECryptor

func NewAES256IGECryptor(aesKey, aesIV []byte) *AES256IGECryptor

func (*AES256IGECryptor) Decrypt

func (c *AES256IGECryptor) Decrypt(data []byte) ([]byte, error)

func (*AES256IGECryptor) Encrypt

func (c *AES256IGECryptor) Encrypt(data []byte) ([]byte, error)

data长度必须是aes.BlockSize(16)的倍数,如果不是请调用者补齐

type AesCTR128Encrypt

type AesCTR128Encrypt struct {
	// contains filtered or unexported fields
}

func NewAesCTR128Encrypt

func NewAesCTR128Encrypt(key []byte, iv []byte) (*AesCTR128Encrypt, error)

key长度必须为16、24或32

func (*AesCTR128Encrypt) Encrypt

func (this *AesCTR128Encrypt) Encrypt(plaintext []byte) []byte

type AesCTR128KeySizeError

type AesCTR128KeySizeError int

func (AesCTR128KeySizeError) Error

func (k AesCTR128KeySizeError) Error() string

type RSACryptor

type RSACryptor struct {
	// contains filtered or unexported fields
}

func NewRSACryptor

func NewRSACryptor() *RSACryptor

TODO(@benqi): 这里写死了pkcs1PemPrivateKey

func (*RSACryptor) Decrypt

func (m *RSACryptor) Decrypt(b []byte) []byte

func (*RSACryptor) Encrypt

func (m *RSACryptor) Encrypt(b []byte) []byte

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL