Documentation ¶
Index ¶
- Variables
- func AesDecrypt(crypted, key []byte) ([]byte, error)
- func AesEncrypt(origData, key []byte) ([]byte, error)
- func ComputeKey(pubKey, priKey *big.Int) (*big.Int, error)
- func Decrypt(encrypted []byte, key []byte) (plaintext []byte, err error)
- func EcbDecrypt(key, src []byte) ([]byte, error)
- func EcbDecryptBase64(key, src string) (string, error)
- func EcbEncrypt(key, src []byte) ([]byte, error)
- func EcbEncryptBase64(key, src string) (string, error)
- func Encrypt(plaintext []byte, key []byte) (encrypted []byte, err error)
- func GetRandomString(l int) string
- func Gunzip(bs []byte) ([]byte, error)
- func Gzip(bs []byte) []byte
- func Hmac(key []byte, body string) []byte
- func HmacBase64(key []byte, body string) string
- func InitTls()
- func Md5(s string) string
- func New(passphrase []byte, usersalt []byte) (key []byte, salt []byte, err error)
- func NewECBDecrypter(b cipher.Block) cipher.BlockMode
- func NewECBEncrypter(b cipher.Block) cipher.BlockMode
- func NewPublicKey(bs []byte) *big.Int
- func NewTlsClientConn(conn net.Conn) net.Conn
- func NewTlsServerConn(conn net.Conn) net.Conn
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) (error, []byte)
- type ClientHelloMsg
- type CurveID
- type DhKey
- type RsaDecrypter
- type RsaEncrypter
- type SignatureScheme
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidPriKey = errors.New("invalid private key") ErrInvalidPubKey = errors.New("invalid public key") ErrPubKeyOutOfBound = errors.New("public key out of bound") )
View Source
var ( ErrPrivateKey = errors.New("private key error") ErrPublicKey = errors.New("failed to parse PEM block containing the public key") ErrNotRsaKey = errors.New("key type is not RSA") )
View Source
var ErrPaddingSize = errors.New("padding size error")
Functions ¶
func EcbDecrypt ¶
func EcbDecryptBase64 ¶
func EcbEncrypt ¶
func EcbEncryptBase64 ¶
func GetRandomString ¶ added in v0.3.9
Generating Random Verification Key
func HmacBase64 ¶
func NewPublicKey ¶
func PKCS5Padding ¶ added in v0.3.9
Completion when the length is insufficient
func PKCS5UnPadding ¶ added in v0.3.9
Remove excess
Types ¶
type ClientHelloMsg ¶ added in v0.3.9
type ClientHelloMsg struct {
// contains filtered or unexported fields
}
func (*ClientHelloMsg) GetServerName ¶ added in v0.3.9
func (m *ClientHelloMsg) GetServerName() string
func (*ClientHelloMsg) Unmarshal ¶ added in v0.3.9
func (m *ClientHelloMsg) Unmarshal(data []byte) bool
type DhKey ¶
func GenerateKey ¶
type RsaDecrypter ¶
type RsaDecrypter interface { Decrypt(input []byte) ([]byte, error) DecryptBase64(input string) ([]byte, error) }
func NewRsaDecrypter ¶
func NewRsaDecrypter(file string) (RsaDecrypter, error)
type RsaEncrypter ¶
func NewRsaEncrypter ¶
func NewRsaEncrypter(key []byte) (RsaEncrypter, error)
type SignatureScheme ¶ added in v0.3.9
type SignatureScheme uint16
Click to show internal directories.
Click to hide internal directories.