Documentation
¶
Index ¶
- Constants
- Variables
- func AESDecrypt(src []byte, key []byte, padding paddingMode) ([]byte, error)
- func AESEncrypt(src []byte, key []byte, padding paddingMode) ([]byte, error)
- func Base64DecodeSTD(src []byte) ([]byte, error)
- func Base64DecodeURL(src []byte) ([]byte, error)
- func Base64EncodeSTD(src []byte) []byte
- func Base64EncodeURL(src []byte) []byte
- func CalculateExchangeKey(comm *DHPulbic, private *DHKey, public *DHKey) (*big.Int, error)
- func DESDecrypt(src []byte, key []byte, padding paddingMode) ([]byte, error)
- func DESEncrypt(src []byte, key []byte, padding paddingMode) ([]byte, error)
- func GenerateRSAKey(size int) ([]byte, []byte, error)
- func GetPadding(mode paddingMode) (func([]byte, int) []byte, error)
- func GetUnpadding(mode paddingMode) (func([]byte) []byte, error)
- func HMACHash(hash stdcrypto.Hash, key []byte, src []byte) ([]byte, error)
- func HMACHashFile(hash stdcrypto.Hash, key []byte, file string) ([]byte, error)
- func HMACVerify(hash stdcrypto.Hash, key []byte, src []byte, checksum []byte) error
- func HMACVerifyFile(hash stdcrypto.Hash, key []byte, file string, checksum []byte) error
- func MD5Hash(src []byte) ([]byte, error)
- func MD5HashFile(file string) ([]byte, error)
- func RSADecrypt(privatekey []byte, cipher []byte) ([]byte, error)
- func RSAEncrypt(publicKey []byte, originData []byte) ([]byte, error)
- func SHA1Hash(src []byte) ([]byte, error)
- func SHA1HashFile(file string) ([]byte, error)
- func SHA256Hash(src []byte) ([]byte, error)
- func SHA256HashFile(file string) ([]byte, error)
- func SHA512Hash(src []byte) ([]byte, error)
- func SHA512HashFile(file string) ([]byte, error)
- func TripleDESDecrypt(src []byte, key []byte, padding paddingMode) ([]byte, error)
- func TripleDESEncrypt(src []byte, key []byte, padding paddingMode) ([]byte, error)
- type DHKey
- type DHPulbic
- type HMAC
Constants ¶
const ( ZerosPaddingMode = paddingMode(`Zeros`) PKCS5PaddingMode = paddingMode(`PKCS5`) )
padding modes
Variables ¶
var ( ErrParam = errors.New("invalid parameters") ErrVerify = errors.New("verify failed") )
errors
Functions ¶
func AESDecrypt ¶
AESDecrypt : AES decrypt with CBC mode
func AESEncrypt ¶
AESEncrypt : AES encrypt with CBC mode
func Base64DecodeSTD ¶
Base64DecodeSTD : BASE64 decode
func Base64DecodeURL ¶
Base64DecodeURL : BASE64 decode for url
func Base64EncodeURL ¶
Base64EncodeURL : BASE64 encode for url
func CalculateExchangeKey ¶
CalculateExchangeKey : calculate exchange key
func DESDecrypt ¶
DESDecrypt : DES decrypt with CBC mode
func DESEncrypt ¶
DESEncrypt : DES encrypt with CBC mode
func GenerateRSAKey ¶
GenerateRSAKey : generate RSA key pair
func GetPadding ¶
GetPadding : get padding function
func GetUnpadding ¶
GetUnpadding : get unpadding function
func HMACHashFile ¶
HMACHashFile : generate message authentication code of file
func HMACVerify ¶
HMACVerify : verify message authentication code
func HMACVerifyFile ¶
HMACVerifyFile : generate message authentication code of file
func MD5HashFile ¶
MD5HashFile : calculate message digest of file withc MD5
func RSADecrypt ¶
RSADecrypt : RSA decrypt with private key
func RSAEncrypt ¶
RSAEncrypt : RSA encrypt with public key
func SHA1HashFile ¶
SHA1HashFile : calculate message digest of file with SHA-1
func SHA256Hash ¶
SHA256Hash : calculate message digest with SHA-256
func SHA256HashFile ¶
SHA256HashFile : calculate message digest of file with SHA-256
func SHA512Hash ¶
SHA512Hash : calculate message digest with SHA-512
func SHA512HashFile ¶
SHA512HashFile : calculate message digest of file with SHA-512
func TripleDESDecrypt ¶
TripleDESDecrypt : 3DES decrypt with CBC mode
Types ¶
type DHKey ¶
type DHKey struct {
// contains filtered or unexported fields
}
DHKey : key pair
func GenerateKey ¶
GenerateKey : generate a key pair
func (*DHKey) SetPrivateKey ¶
SetPrivateKey : set x