Versions in this module Expand all Collapse all v1 v1.0.0 May 20, 2020 Changes in this version + const TripleDESKeyingOption1 + const TripleDESKeyingOption2 + const TripleDESKeyingOption3 + var ErrDivisionByZero = errors.New("division by zero") + var ErrHashTypeNotAllowed = errors.New("Hash algorithm must be one of md5, sha1, sha256, sha512") + var ErrKeyLength = errors.New("key length error, must be 16 or 24") + var ErrNotPEMEncoded = errors.New("Not PEM-encoded") + var ErrNotRSAPublicKey = errors.New("Not an RSA public format") + var ErrUnkownKeyType = errors.New("Unknown key type") + func AESCbcPkcs7PaddingDecrypt(crypted, key []byte) ([]byte, error) + func AESCbcPkcs7PaddingEncrypt(origData, key []byte) ([]byte, error) + func AESCfbDecrypt(ciphertext, key []byte) (plaintext []byte, err error) + func AESCfbEncrypt(text, key []byte) (ciphertext []byte, err error) + func AESEcbPkcs7PaddingDecrypt(src, key []byte) ([]byte, error) + func AESEcbPkcs7PaddingEncrypt(src, key []byte) ([]byte, error) + func AESPKCS5Padding(ciphertext []byte, blockSize int) []byte + func AESPKCS5UnPadding(origData []byte) []byte + func BlowfishDecrypt(dataToDecrypt, key []byte) []byte + func BlowfishEncrypt(dataToEncrypt, key []byte) []byte + func CaesarDecrypt(n int, data []byte) ([]byte, error) + func CaesarEncrypt(n int, data []byte) ([]byte, error) + func DESDecrypt(crypted, key []byte) ([]byte, error) + func DESEncrypt(src, key []byte) ([]byte, error) + func DESPKCS5Padding(ciphertext []byte, blockSize int) []byte + func DESPKCS5UnPadding(origData []byte) []byte + func GenerateAES256RandomBase64String() (string, error) + func GenerateAES256RandomBytes() ([]byte, error) + func GenerateRSAKeyPairToFile(privateKeyFilepath, publicKeyFilepath string, keySize int) error + func KeyTo24Padding(key []byte) ([]byte, error) + func NewECBDecrypter(b cipher.Block) cipher.BlockMode + func NewECBEncrypter(b cipher.Block) cipher.BlockMode + func PKCS5Padding(data []byte, blockSize int) ([]byte, error) + func PKCS5UnPadding(data []byte) ([]byte, error) + func PKCS7Padding(b []byte, blocksize int) ([]byte, error) + func PKCS7UnPadding(b []byte) ([]byte, error) + func ReadRSAPrivateKeyFromByte(privateKey []byte) (*rsa.PrivateKey, error) + func ReadRSAPrivateKeyFromFile(privateKeyFilepath string) (*rsa.PrivateKey, error) + func ReadRSAPublicKeyFromByte(publicKey []byte) (*rsa.PublicKey, error) + func ReadRSAPublicKeyFromFile(publicKeyFilepath string) (*rsa.PublicKey, error) + func Sha256HexEecode(s string) string + func TripleDesEcbDecrypt(src, key []byte) ([]byte, error) + func TripleDesEcbEncrypt(src, key []byte) ([]byte, error) + func ZerosPadding(src []byte, blockSize int) []byte + func ZerosUnPadding(src []byte) []byte + type RSA struct + func NewRSA(hashType string) (*RSA, error) + func (r *RSA) Decrypt(privateKey *rsa.PrivateKey, ciphertext []byte) ([]byte, error) + func (r *RSA) DecryptByReadRSAPrivateKeyFromFile(privateKeyFilepath string, ciphertext []byte) ([]byte, error) + func (r *RSA) Encrypt(publicKey *rsa.PublicKey, plaintext []byte) ([]byte, error)