Documentation
¶
Index ¶
- func BytesToKey(salt, data []byte, h hash.Hash, keyLen, blockLen int) (key, iv []byte, err error)
- func BytesToKeyAES256CBC(salt, data []byte) (key []byte, iv []byte, err error)
- func BytesToKeyAES256CBCMD5(salt, data []byte) (key []byte, iv []byte, err error)
- func Decrypt(password string, ciphertext string) ([]byte, error)
- func Encrypt(password string, plaintext string) (string, error)
- func Md5String(inputs ...string) string
- type Body
- type Client
- type Config
- type Cookie
- type CookieData
- type GetReq
- type GetResp
- type PushReq
- type PushResp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToKey ¶
BytesToKey From https://github.com/walkert/go-evp . BytesToKey implements the Openssl EVP_BytesToKey logic. It takes the salt, data, a hash type and the key/block length used by that type. As such it differs considerably from the openssl method in C.
func BytesToKeyAES256CBC ¶
BytesToKeyAES256CBC implements the SHA256 version of EVP_BytesToKey using AES CBC
func BytesToKeyAES256CBCMD5 ¶
BytesToKeyAES256CBCMD5 implements the MD5 version of EVP_BytesToKey using AES CBC
func Decrypt ¶
Decrypt a CryptoJS.AES.encrypt(msg, password) encrypted msg. ciphertext is the result of CryptoJS.AES.encrypt(), which is the base64 string of "Salted__" + [8 bytes random salt] + [actual ciphertext]. actual ciphertext is padded (make it's length align with block length) using Pkcs7. CryptoJS use a OpenSSL-compatible EVP_BytesToKey to derive (key,iv) from (password,salt), using md5 as hash type and 32 / 16 as length of key / block. See: https://stackoverflow.com/questions/35472396/how-does-cryptojs-get-an-iv-when-none-is-specified , https://stackoverflow.com/questions/64797987/what-is-the-default-aes-config-in-crypto-js
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Get ¶
Get sends a request to the server to get the cookie. see: https://github.com/easychen/CookieCloud/blob/master/api/app.js#L46
func (*Client) Push ¶
Push sends a request to the server to update the cookie. see: https://github.com/easychen/CookieCloud/blob/master/api/app.js#L28
func (*Client) SetHeaders ¶
type CookieData ¶
type CookieData struct {
Domain string `json:"domain"`
ExpirationDate float64 `json:"expirationDate"`
HostOnly bool `json:"hostOnly"`
HttpOnly bool `json:"httpOnly"`
Name string `json:"name"`
Path string `json:"path"`
SameSite string `json:"sameSite"`
Secure bool `json:"secure"`
Session bool `json:"session"`
StoreId string `json:"storeId"`
Value string `json:"value"`
}
func (CookieData) GetExpired ¶
func (c CookieData) GetExpired() time.Time