Documentation ¶
Index ¶
- Constants
- Variables
- func HmacSha256(data []byte, key string) string
- func HmacSha256String(data string, key string) string
- func MD5(data []byte) *encodex.Encode
- func NotAesValidKeySize(k KeySize) bool
- func PadZeroKey(key []byte, size int) []byte
- func RSADecrypt(src, priKey []byte) ([]byte, error)
- func RSAEncrypt(src, pubKey []byte) ([]byte, error)
- func RSAGenerateKey(bits int, out io.Writer) error
- func RSAGeneratePublicKey(priKey []byte, out io.Writer) error
- func RSASign(src []byte, priKey []byte, hash ...crypto.Hash) ([]byte, error)
- func RSAVerify(src, sign, pubKey []byte, hash ...crypto.Hash) error
- func SHA1(data []byte) *encodex.Encode
- func SHA224(data []byte) *encodex.Encode
- func SHA256(data []byte) *encodex.Encode
- func SHA384(data []byte) *encodex.Encode
- func SHA512(data []byte) *encodex.Encode
- type Crypto
- type KeySize
- type Method
- type OptionFn
- type RC4
Constants ¶
View Source
const ( AES = "AES" DES = "DES" DES3 = "DES3" )
Variables ¶
View Source
var ( ErrAesKeySize = errors.New("key size must be 16, 24, or 32 bytes") ErrDesKeySize = errors.New("key size must be 8") ErrAesNotSupportedGcm = errors.New("aes-gcm not supported") ErrDesNotSupportedGcm = errors.New("des-gcm not supported") ErrDes3NotSupportedGcm = errors.New("des3-gcm not supported") )
Functions ¶
func HmacSha256 ¶
func HmacSha256String ¶
func NotAesValidKeySize ¶
func PadZeroKey ¶
func RSADecrypt ¶
RSADecrypt decrypts data.tmpl using RSA private key.
func RSAEncrypt ¶
RSAEncrypt encrypts data.tmpl with rsa public key
func RSAGenerateKey ¶
RSAGenerateKey generates a new RSA key pair.
func RSAGeneratePublicKey ¶
RSAGeneratePublicKey generates a public key from a private key
func RSASign ¶
RSASign signs the given data.tmpl using the given private key. The hash defaults to crypto.SHA256
Types ¶
type Crypto ¶
type OptionFn ¶
type OptionFn func(*options)
func WithKeySize ¶
func WithMethod ¶
func WithPadding ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.