Documentation ¶
Index ¶
- Variables
- func AESDecryptCBC(src []byte, key []byte, iv []byte) (dst []byte, err error)
- func AESDecryptCTR(src []byte, key []byte, iv []byte) (dst []byte, err error)
- func AESDecryptGCM(cipherText []byte, key [32]byte) (plaintext []byte, err error)
- func AESEncryptCBC(src []byte, key []byte, iv []byte) (dst []byte, err error)
- func AESEncryptCTR(src []byte, key []byte, iv []byte) (dst []byte, err error)
- func AESEncryptGCM(data []byte, key [32]byte) ([]byte, error)
- func DesDecrypt(cipherText, key []byte) ([]byte, error)
- func DesEncrypt(data []byte, key []byte) ([]byte, error)
- func GetSha1Hash(s string) string
- func GetSha256Hash(s string) string
- func GetSha384Hash(s string) string
- func HmacSha1(source, secret string) string
- func NewKey(salt, password []byte) [32]byte
- func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error)
- func ParseRSAPublicKey(key []byte) (*rsa.PublicKey, error)
- func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error)
- func Pkcs5Padding(src []byte, blockSize int) []byte
- func Pkcs5UnPadding(src []byte) []byte
- func Pkcs7Padding(data []byte, blocklen int) ([]byte, error)
- func Pkcs7UnPadding(data []byte, blocklen int) ([]byte, error)
- func RSA256Sign(privateKey *rsa.PrivateKey, data []byte) (string, error)
- func RSA256Verify(pubKey *rsa.PublicKey, data []byte, sign string) error
- func RSADecrypt(privateKey *rsa.PrivateKey, data []byte) ([]byte, error)
- func RSAEncrypt(pubKey *rsa.PublicKey, data []byte) ([]byte, error)
- func RSASign(privateKey *rsa.PrivateKey, data []byte) (string, error)
- func RSAVerify(pubKey *rsa.PublicKey, data []byte, sign string) error
- type Data
- type String
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrKeyMustBePEMEncoded = errors.New("Invalid Key: Key must be PEM encoded PKCS1 or PKCS8 private key") ErrNotRSAPrivateKey = errors.New("Key is not a valid RSA private key") )
View Source
var (
EmptyAESIV = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
)
View Source
var (
EmptyDesIV = []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}
)
Functions ¶
func AESDecryptGCM ¶
func DesDecrypt ¶
func DesEncrypt ¶
encrypt string to base64 crypto using des
func GetSha1Hash ¶
func GetSha256Hash ¶
func GetSha384Hash ¶
func ParseRSAPrivateKeyFromPEM ¶
func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error)
func Pkcs5Padding ¶
func Pkcs5UnPadding ¶
func RSA256Sign ¶
func RSA256Sign(privateKey *rsa.PrivateKey, data []byte) (string, error)
func RSADecrypt ¶
func RSADecrypt(privateKey *rsa.PrivateKey, data []byte) ([]byte, error)
Types ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.