Documentation
¶
Index ¶
- Constants
- func BuildSigningString(method, path string, query url.Values, body []byte, timestamp int64) string
- func ComparePassword(hashedPassword, currPassword string, saltStr string) bool
- func FormatTimestamp(ts int64) string
- func IsTimestampValid(ts int64) bool
- func ParseTimestamp(ts string) (int64, error)
- type AesCipher
- func (a *AesCipher) BlockSize() int
- func (a *AesCipher) DecodeURIComponent(str string) string
- func (a *AesCipher) Decrypt(cipherText string) ([]byte, error)
- func (a *AesCipher) EncodeURIComponent(str string) string
- func (a *AesCipher) Encrypt(plaintext string) (string, error)
- func (a *AesCipher) String() string
- type AesCipherConfig
- type AesKeySizeError
- type Crypto
- type Encrypt
- type HMACStrategy
- type Rc4Cipher
- func (r *Rc4Cipher) CiphertextFormat(ciphertext string) string
- func (r *Rc4Cipher) CiphertextReplace(ciphertext string) string
- func (r *Rc4Cipher) DecodeURIComponent(str string) string
- func (r *Rc4Cipher) Decrypt(ciphertext string) ([]byte, error)
- func (r *Rc4Cipher) EncodeURIComponent(str string) string
- func (r *Rc4Cipher) Encrypt(plaintext string) (string, error)
- func (r *Rc4Cipher) RandInt(min, max int) int
- func (r *Rc4Cipher) Rc4ClientDecrypt(ciphertext string) (string, error)
- func (r *Rc4Cipher) Rc4ClientEncrypt(plaintext string) (string, error)
- func (r *Rc4Cipher) String() string
- type Rc4CipherConfig
- type RsaCipher
- func (a *RsaCipher) DecodeURIComponent(str string) string
- func (a *RsaCipher) Decrypt(cryptText string) (plainText []byte, err error)
- func (a *RsaCipher) EncodeURIComponent(str string) string
- func (a *RsaCipher) Encrypt(plainText string) (cryptText string, err error)
- func (a *RsaCipher) String() string
- type RsaCipherConfig
- type RsaCiphersConfig
- type SignatureStrategy
- type Verify
Constants ¶
View Source
const ( DefaultAesKey = `159054a86e3bfb85b5f1991cdb07645e` BlockSize = 16 // block size fixed at 16 bytes / 128 bits (Nb=4) for AES DefaultAesNBits = 256 CryptoAesName = "aes" )
View Source
const ( DefaultRC4Key = "159054a86e3bfb85b5f1991cdb07645e" CryptoRC4Name string = "rc4" )
View Source
const ( CryptoRSAName = "rsa" RsaPublicKeyTpl = `-----BEGIN PUBLIC KEY----- %s -----END PUBLIC KEY-----` RsaPrivateKeyTpl = `-----BEGIN RSA PRIVATE KEY----- %s -----END RSA PRIVATE KEY-----` )
Variables ¶
This section is empty.
Functions ¶
func BuildSigningString ¶ added in v2.0.71
func ComparePassword ¶
ComparePassword Check if two passwords compare
func FormatTimestamp ¶ added in v2.0.71
func IsTimestampValid ¶ added in v2.0.71
func ParseTimestamp ¶ added in v2.0.71
Types ¶
type AesCipher ¶
type AesCipher struct {
// contains filtered or unexported fields
}
func (*AesCipher) DecodeURIComponent ¶
func (*AesCipher) EncodeURIComponent ¶
type AesCipherConfig ¶
type AesKeySizeError ¶
type AesKeySizeError int
func (AesKeySizeError) Error ¶
func (k AesKeySizeError) Error() string
type Encrypt ¶
func EncryptPassword ¶
type HMACStrategy ¶ added in v2.0.71
type HMACStrategy struct{}
func (HMACStrategy) Generate ¶ added in v2.0.71
func (s HMACStrategy) Generate(signingString, secret string) string
func (HMACStrategy) Verify ¶ added in v2.0.71
func (s HMACStrategy) Verify(signingString, secret, givenSig string) bool
type Rc4Cipher ¶
type Rc4Cipher struct {
Key string `json:"key" yaml:"key"`
}
func NewRc4Cipher ¶
func (*Rc4Cipher) CiphertextFormat ¶
CiphertextFormat Client encrypt content format
func (*Rc4Cipher) CiphertextReplace ¶
func (*Rc4Cipher) DecodeURIComponent ¶
func (*Rc4Cipher) EncodeURIComponent ¶
func (*Rc4Cipher) Rc4ClientDecrypt ¶
Rc4ClientDecrypt Client RC4 Config file Decrypt
func (*Rc4Cipher) Rc4ClientEncrypt ¶
Rc4ClientEncrypt Client RC4 Config file Encrypt
type Rc4CipherConfig ¶
type Rc4CipherConfig Rc4Cipher
type RsaCipher ¶
type RsaCipher struct {
PubKey string
PriKey string
PublicKey *rsa.PublicKey
PrivateKey *rsa.PrivateKey
}
func NewRsaCipher ¶
func (*RsaCipher) DecodeURIComponent ¶
func (*RsaCipher) EncodeURIComponent ¶
type RsaCipherConfig ¶
type RsaCiphersConfig ¶
type RsaCiphersConfig struct {
Client RsaCipherConfig `yaml:"client" json:"client"`
Server RsaCipherConfig `yaml:"server" json:"server"`
}
Click to show internal directories.
Click to hide internal directories.