Documentation ¶
Index ¶
- Constants
- func AeadEncryptB64(a *AEAD, plaintext []byte, additionalData ...[]byte) (string, error)
- func Decrypt(secret string, salt []byte, ciphertext []byte, additionalData ...[]byte) ([]byte, error)
- func DecryptStrings(secret string, salt string, ciphertext string, additionalStrings ...string) ([]byte, error)
- func GenerateCryptoRand(size int) ([]byte, error)
- func GenerateString(length ...int) string
- func H256(data []byte, extras ...string) []byte
- func H256B64(data []byte, extras ...string) string
- func H256Hex(data []byte, extras ...string) string
- func HashEqual(hash1 string, hash2 string) bool
- func Sign(signer ESigner, data []byte, extraData ...string) (string, error)
- func VerifySignature(verifier EVerifier, data []byte, signature string, extraData ...string) error
- type AEAD
- type AEADConfig
- type DigestBuilder
- type ESigner
- type EVerifier
- type Hash
- func (h *Hash) Add(data []byte)
- func (h *Hash) Calc(data ...[]byte) []byte
- func (h *Hash) CalcStr(data ...[]byte) string
- func (h *Hash) CalcStrIn(data ...string)
- func (h *Hash) CalcStrStr(data ...string) string
- func (h *Hash) Check(sum []byte) bool
- func (h *Hash) CheckStr(sum string) error
- func (h *Hash) Sum() []byte
- type Hmac
- func (h *Hmac) Calc(data ...[]byte) []byte
- func (h *Hmac) CalcStr(data []byte) string
- func (h *Hmac) CalcStrStr(data string) string
- func (h *Hmac) CalcStrings(data ...string) []byte
- func (h *Hmac) CalcStringsStr(data ...string) string
- func (h *Hmac) Check(sum []byte) bool
- func (h *Hmac) CheckStr(sum string) error
- func (h *Hmac) Sum() []byte
- func (h *Hmac) SumStr() string
- type MakeAeadFnc
- type Pbkdf2Config
- type PbkdfConfig
- type PbkdfFnc
- type RsaSigner
- func (r *RsaSigner) Key() *rsa.PrivateKey
- func (r *RsaSigner) LoadKey(data []byte, password string) (err error)
- func (r *RsaSigner) LoadKeyFromFile(filePath string, password string) error
- func (r *RsaSigner) Sign(data []byte, extraData ...string) ([]byte, error)
- func (r *RsaSigner) SignB64(data []byte, extraData ...string) (string, error)
- type RsaVerifier
Constants ¶
View Source
const RSA_H256_SIGNATURE = "rsa_h256_signature"
Variables ¶
This section is empty.
Functions ¶
func AeadEncryptB64 ¶
func DecryptStrings ¶
func GenerateCryptoRand ¶
func GenerateString ¶
Types ¶
type AEADConfig ¶
type AEADConfig struct { MakeAead MakeAeadFnc DeriveKey PbkdfFnc KeySize int }
func DefaultAEADConfig ¶
func DefaultAEADConfig(pbkdfCfg Pbkdf2Config) AEADConfig
type DigestBuilder ¶
type Hash ¶
type Hash struct { Hash hash.Hash StringCoding utils.StringCoding }
func NewHash ¶
func NewHash(digestBuilder ...DigestBuilder) *Hash
func (*Hash) CalcStrStr ¶
type Hmac ¶
type Hmac struct { Hash hash.Hash StringCoding utils.StringCoding }
func NewHmac ¶
func NewHmac(secret string, digestBuilder ...DigestBuilder) *Hmac
func NewHmacCoding ¶
func NewHmacCoding(secret string, val utils.StringCoding, digestBuilder ...DigestBuilder) *Hmac
func (*Hmac) CalcStrStr ¶
func (*Hmac) CalcStrings ¶
func (*Hmac) CalcStringsStr ¶
type Pbkdf2Config ¶
type Pbkdf2Config struct { Iter int HashBuilder DigestBuilder }
func DefaultPbkdfConfig ¶
func DefaultPbkdfConfig() Pbkdf2Config
type PbkdfConfig ¶
type PbkdfConfig struct { Iter int HashBuilder func() DigestBuilder }
type RsaSigner ¶
type RsaSigner struct { utils.WithStringCoderBase // contains filtered or unexported fields }
func NewRsaSigner ¶
func NewRsaSigner(encoder ...utils.StringCoding) *RsaSigner
func (*RsaSigner) Key ¶
func (r *RsaSigner) Key() *rsa.PrivateKey
func (*RsaSigner) LoadKeyFromFile ¶
type RsaVerifier ¶
type RsaVerifier struct { utils.WithStringCoderBase // contains filtered or unexported fields }
func NewRsaVerifier ¶
func NewRsaVerifier(encoder ...utils.StringCoding) *RsaVerifier
func (*RsaVerifier) LoadKey ¶
func (r *RsaVerifier) LoadKey(data []byte) (err error)
func (*RsaVerifier) LoadKeyFromFile ¶
func (r *RsaVerifier) LoadKeyFromFile(filePath string) error
Click to show internal directories.
Click to hide internal directories.