Documentation
¶
Index ¶
- Variables
- func AddFileToMemory(memFile MemFile)
- func AddTime(timeStr string, timeValue interface{}) time.Time
- func AppendInt(buf []byte, u uint64) []byte
- func AppendUniqueString(to []string, from string) []string
- func AppendUniqueStrings(to []string, from []string) []string
- func Archive(srcPath, destFile string) error
- func BBlack(s interface{}, attribs ...AttribCode) string
- func BBlue(s interface{}, attribs ...AttribCode) string
- func BCyan(s interface{}, attribs ...AttribCode) string
- func BGreen(s interface{}, attribs ...AttribCode) string
- func BMagenta(s interface{}, attribs ...AttribCode) string
- func BRed(s interface{}, attribs ...AttribCode) string
- func BWhite(s interface{}, attribs ...AttribCode) string
- func BYellow(s interface{}, attribs ...AttribCode) string
- func Base64(data []byte) []byte
- func Base64String(data []byte) string
- func Black(s interface{}, attribs ...AttribCode) string
- func Blue(s interface{}, attribs ...AttribCode) string
- func Bool(value interface{}) bool
- func BoolPtr(value bool) *bool
- func Bytes(value interface{}) []byte
- func CheckPath(filename string)
- func Color(s interface{}, textColor TextColor, bgColor BgColor, attribs ...AttribCode) string
- func Compress(data []byte, cType string) ([]byte, error)
- func Convert(from, to interface{})
- func CopyFile(from, to string) error
- func CopyToFile(from io.Reader, to string) error
- func Cyan(s interface{}, attribs ...AttribCode) string
- func DecodeInt(buf []byte) uint64
- func Decompress(data []byte, cType string) ([]byte, error)
- func DecryptChaCha20(cipher []byte, key []byte, salt []byte) []byte
- func Dim(s interface{}) string
- func DisableCoreDump() error
- func Duration(value string) time.Duration
- func EncodeInt(u uint64) []byte
- func EncryptChaCha20(raw []byte, key []byte, salt []byte) []byte
- func ExchangeInt(buf []byte) []byte
- func Extract(srcFile, destDir string, stripRoot bool) error
- func FileExists(filename string) bool
- func FillInt(buf []byte, length int) []byte
- func FinalSet(from, to reflect.Value)
- func FinalType(v reflect.Value) reflect.Type
- func FinalValue(v reflect.Value) reflect.Value
- func FixJsonBytes(b []byte) []byte
- func FixNilValue(v reflect.Value)
- func FixPath(path string) string
- func FixPtr(value interface{}) interface{}
- func FixUpperCase(data []byte, excludesKeys []string)
- func FixedJson(value interface{}) string
- func FixedJsonP(value interface{}) string
- func Float(value interface{}) float32
- func Float32Ptr(value float32) *float32
- func Float64(value interface{}) float64
- func Float64Ptr(value float64) *float64
- func Floats(value interface{}) []float64
- func FormatTime(layout string, timeValue interface{}) string
- func GenerateECDSAKeyPair(bitSize int) ([]byte, []byte, error)
- func GenerateEd25519KeyPair() ([]byte, []byte, error)
- func GenerateRSAKeyPair(bitSize int) ([]byte, []byte, error)
- func GenerateX25519KeyPair() ([]byte, []byte, error)
- func GetAbsFilename(filename string) string
- func GetLowerName(s string) string
- func GetUpperName(s string) string
- func Green(s interface{}, attribs ...AttribCode) string
- func Gunzip(data []byte) ([]byte, error)
- func GunzipN(data []byte) []byte
- func Gzip(data []byte) ([]byte, error)
- func GzipN(data []byte) []byte
- func HashInt(buf []byte) []byte
- func Hex(data []byte) []byte
- func HexString(data []byte) string
- func HmacMD5(key []byte, data ...[]byte) []byte
- func HmacSha1(key []byte, data ...[]byte) []byte
- func HmacSha256(key []byte, data ...[]byte) []byte
- func HmacSha512(key []byte, data ...[]byte) []byte
- func If(i bool, a, b interface{}) interface{}
- func In(arr []interface{}, s interface{}) bool
- func Int(value interface{}) int
- func Int64(value interface{}) int64
- func Int64Ptr(value int64) *int64
- func IntPtr(value int) *int
- func IntSlicePtr(value []int) *[]int
- func Ints(value interface{}) []int64
- func Italic(s interface{}) string
- func JoinArgs(arr []string, sep string) string
- func Json(value interface{}) string
- func JsonBytes(value interface{}) []byte
- func JsonBytesP(value interface{}) []byte
- func JsonP(value interface{}) string
- func Load(filename string, to any) error
- func LoadFileToMemory(filename string)
- func LoadFileToMemoryWithCompress(filename string)
- func LoadFilesToMemoryFromB64(b64File *MemFileB64)
- func LoadFilesToMemoryFromB64KeepGzip(b64File *MemFileB64)
- func LoadFilesToMemoryFromJson(jsonFiles string)
- func LoadJson(filename string, to any) error
- func LoadX(filename string, to any) error
- func LoadYaml(filename string, to any) error
- func MD5(data ...[]byte) []byte
- func MD5Base64(data string) string
- func MD5String(data string) string
- func Magenta(s interface{}, attribs ...AttribCode) string
- func MakeBoolMap(str string) map[string]bool
- func MakeExcludeUpperKeys(data interface{}, prefix string) []string
- func MakeId(size int) string
- func MakeSafeToken(size int) []byte
- func MakeToken(size int) []byte
- func MapPtr(value map[string]interface{}) *map[string]interface{}
- func ParseInt(s string) int64
- func ParseTime(v interface{}) time.Time
- func ParseUint(s string) uint64
- func ReadFile(filename string) (string, error)
- func ReadFileBytes(filename string) ([]byte, error)
- func ReadFileBytesN(filename string) []byte
- func ReadFileLines(filename string) ([]string, error)
- func ReadFileLinesN(filename string) []string
- func ReadFileN(filename string) string
- func RealValue(v reflect.Value) reflect.Value
- func Red(s interface{}, attribs ...AttribCode) string
- func RunCommand(command string, args ...string) ([]string, error)
- func SafeLoadFileToMemory(filename string)
- func SafeLoadFileToMemoryWithCompress(filename string)
- func Save(filename string, data any) error
- func SaveJson(filename string, data any) error
- func SaveJsonP(filename string, data any) error
- func SaveYaml(filename string, data any) error
- func SetSafeBufObfuscator(encrypt func([]byte) ([]byte, []byte), decrypt func([]byte, []byte) []byte)
- func SetValue(to, from reflect.Value)
- func Sha1(data ...[]byte) []byte
- func Sha1Base64(data string) string
- func Sha1String(data string) string
- func Sha256(data ...[]byte) []byte
- func Sha256Base64(data string) string
- func Sha256String(data string) string
- func Sha512(data ...[]byte) []byte
- func Sha512Base64(data string) string
- func Sha512String(data string) string
- func SplitArgs(s string) []string
- func SplitTrim(s, sep string) []string
- func SplitTrimN(s, sep string, n int) []string
- func SplitWithoutNone(s, sep string) []string
- func SplitWithoutNoneN(s, sep string, n int) []string
- func String(value interface{}) string
- func StringFromValue(v reflect.Value) string
- func StringIf(i bool, a, b string) string
- func StringIn(arr []string, s string) bool
- func StringP(value interface{}) string
- func StringPtr(value string) *string
- func StringSlicePtr(value []string) *[]string
- func Strings(value interface{}) []string
- func Switch(i uint, args ...interface{}) interface{}
- func ToInterfaceArray(in interface{}) []interface{}
- func UInt64Ptr(value uint64) *uint64
- func UIntPtr(value uint) *uint
- func Uint(value interface{}) uint
- func Uint64(value interface{}) uint64
- func UnBase64(data []byte) ([]byte, error)
- func UnBase64String(data string) ([]byte, error)
- func UnHex(data []byte) ([]byte, error)
- func UnHexString(data string) ([]byte, error)
- func UnJson(str string, value interface{}) interface{}
- func UnJsonArr(str string) []interface{}
- func UnJsonBytes(data []byte, value interface{}) interface{}
- func UnJsonMap(str string) map[string]interface{}
- func UnUrlBase64(data []byte) ([]byte, error)
- func UnUrlBase64String(data string) ([]byte, error)
- func UnYaml(data string, value interface{}) interface{}
- func UnYamlArr(data string) []interface{}
- func UnYamlMap(data string) map[string]interface{}
- func Unzip(data []byte) ([]byte, error)
- func UnzipN(data []byte) []byte
- func UrlBase64(data []byte) []byte
- func UrlBase64String(data []byte) string
- func ValueToString(v reflect.Value) string
- func White(s interface{}, attribs ...AttribCode) string
- func WriteFile(filename string, content string) error
- func WriteFileBytes(filename string, content []byte) error
- func Yaml(value interface{}) string
- func Yellow(s interface{}, attribs ...AttribCode) string
- func ZeroMemory(buf []byte)
- func Zip(data []byte) ([]byte, error)
- func ZipN(data []byte) []byte
- type AESCipher
- type Asymmetric
- func NewAsymmetric(algorithm AsymmetricAlgorithm, safePrivateKeyBuf, safePublicKeyBuf *SafeBuf) (*Asymmetric, error)
- func NewAsymmetricAndEraseKey(algorithm AsymmetricAlgorithm, privateKey, publicKey []byte) (*Asymmetric, error)
- func NewAsymmetricWithoutEraseKey(algorithm AsymmetricAlgorithm, privateKey, publicKey []byte, ...) (*Asymmetric, error)
- func NewECDSA(safePrivateKeyBuf, safePublicKeyBuf *SafeBuf) (*Asymmetric, error)
- func NewECDSAWithOutEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
- func NewECDSAndEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
- func NewED25519(safePrivateKeyBuf, safePublicKeyBuf *SafeBuf) (*Asymmetric, error)
- func NewED25519AndEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
- func NewED25519WithOutEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
- func NewRSA(safePrivateKeyBuf, safePublicKeyBuf *SafeBuf) (*Asymmetric, error)
- func NewRSAWithOutEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
- func NewRSAndEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
- func NewX25519(safePrivateKeyBuf, safePublicKeyBuf *SafeBuf) (*Asymmetric, error)
- func NewX25519AndEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
- func NewX25519WithOutEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
- type AsymmetricAlgorithm
- type AsymmetricCipherAlgorithm
- type AttribCode
- type BgColor
- type ECDSAAlgorithm
- func (e *ECDSAAlgorithm) Decrypt(privateKeyObj any, data []byte) ([]byte, error)
- func (e *ECDSAAlgorithm) Encrypt(publicKeyObj any, data []byte) ([]byte, error)
- func (e *ECDSAAlgorithm) ParsePrivateKey(der []byte) (any, error)
- func (e *ECDSAAlgorithm) ParsePublicKey(der []byte) (any, error)
- func (e *ECDSAAlgorithm) Sign(privateKeyObj any, data []byte, hash ...crypto.Hash) ([]byte, error)
- func (e *ECDSAAlgorithm) Verify(publicKeyObj any, data []byte, signature []byte, hash ...crypto.Hash) (bool, error)
- type Ed25519Algorithm
- func (e *Ed25519Algorithm) ParsePrivateKey(der []byte) (any, error)
- func (e *Ed25519Algorithm) ParsePublicKey(der []byte) (any, error)
- func (e *Ed25519Algorithm) Sign(privateKeyObj any, data []byte, hash ...crypto.Hash) ([]byte, error)
- func (e *Ed25519Algorithm) Verify(publicKeyObj any, data []byte, signature []byte, hash ...crypto.Hash) (bool, error)
- type FileInfo
- type IdMaker
- type IntEncoder
- type MemFile
- type MemFileB64
- type RSAAlgorithm
- func (r *RSAAlgorithm) Decrypt(privateKeyObj any, data []byte) ([]byte, error)
- func (r *RSAAlgorithm) Encrypt(publicKeyObj any, data []byte) ([]byte, error)
- func (r *RSAAlgorithm) ParsePrivateKey(der []byte) (any, error)
- func (r *RSAAlgorithm) ParsePublicKey(der []byte) (any, error)
- func (r *RSAAlgorithm) Sign(privateKeyObj any, data []byte, hash ...crypto.Hash) ([]byte, error)
- func (r *RSAAlgorithm) Verify(publicKeyObj any, data []byte, signature []byte, hash ...crypto.Hash) (bool, error)
- type Rand
- func (r *Rand) Float32() float32
- func (r *Rand) Float64() float64
- func (r *Rand) Int() int
- func (r *Rand) Int31n(n int32) int32deprecated
- func (r *Rand) Int32() int32
- func (r *Rand) Int32N(n int32) int32
- func (r *Rand) Int63n(n int64) int64deprecated
- func (r *Rand) Int64() int64
- func (r *Rand) Int64N(n int64) int64
- func (r *Rand) IntN(n int) int
- func (r *Rand) Intn(n int) intdeprecated
- func (r *Rand) Perm(n int) []int
- func (r *Rand) Shuffle(n int, swap func(i, j int))
- func (r *Rand) Uint32() uint32
- func (r *Rand) Uint32N(n uint32) uint32
- func (r *Rand) Uint64() uint64
- func (r *Rand) Uint64N(n uint64) uint64
- func (r *Rand) UintN(n uint) uint
- type SafeBuf
- type SecretPlaintext
- type StructInfo
- type Symmetric
- func NewAESCBC(safeKeyBuf, safeIvBuf *SafeBuf) (*Symmetric, error)
- func NewAESCBCAndEraseKey(safeKeyBuf, safeIvBuf []byte) (*Symmetric, error)
- func NewAESCBCWithOutEraseKey(safeKeyBuf, safeIvBuf []byte) (*Symmetric, error)
- func NewAESGCM(safeKeyBuf, safeIvBuf *SafeBuf) (*Symmetric, error)
- func NewAESGCMAndEraseKey(safeKeyBuf, safeIvBuf []byte) (*Symmetric, error)
- func NewAESGCMWithOutEraseKey(safeKeyBuf, safeIvBuf []byte) (*Symmetric, error)
- func NewSymmetric(cipher SymmetricCipher, safeKeyBuf, safeIvBuf *SafeBuf) (*Symmetric, error)
- func NewSymmetricAndEraseKey(cipher SymmetricCipher, key, iv []byte) (*Symmetric, error)
- func NewSymmetricWithOutEraseKey(cipher SymmetricCipher, key, iv []byte) (*Symmetric, error)
- func (_this *Symmetric) Close()
- func (_this *Symmetric) Decrypt(data []byte) (*SafeBuf, error)
- func (_this *Symmetric) DecryptBytes(data []byte) ([]byte, error)
- func (_this *Symmetric) DecryptBytesN(data []byte) []byte
- func (_this *Symmetric) Encrypt(safeBuf *SafeBuf) ([]byte, error)
- func (_this *Symmetric) EncryptBytes(data []byte) ([]byte, error)
- type SymmetricCipher
- type TextColor
- type X25519Algorithm
- func (x *X25519Algorithm) Decrypt(privateKeyObj any, data []byte) ([]byte, error)
- func (x *X25519Algorithm) Encrypt(publicKeyObj any, data []byte) ([]byte, error)
- func (x *X25519Algorithm) ParsePrivateKey(der []byte) (any, error)
- func (x *X25519Algorithm) ParsePublicKey(der []byte) (any, error)
- func (x *X25519Algorithm) Sign(privateKeyObj any, data []byte, hash ...crypto.Hash) ([]byte, error)
- func (x *X25519Algorithm) Verify(publicKeyObj any, data []byte, signature []byte, hash ...crypto.Hash) (bool, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var AESCBC = &AESCipher{useGCM: false}
View Source
var AESGCM = &AESCipher{useGCM: true}
View Source
var DefaultIdMaker = NewIdMaker(nil)
View Source
var DefaultIntEncoder, _ = NewIntEncoder("9ukH1grX75TQS6LzpFAjIivsdZoO0mc8NBwnyYDhtMWEC2V3KaGxfJRPqe4lbU", 62)
View Source
var ECDSACBC = &ECDSAAlgorithm{useGCM: false, hash: crypto.SHA256}
View Source
var ECDSAGCM = &ECDSAAlgorithm{useGCM: true, hash: crypto.SHA256}
View Source
var ED25519 = &Ed25519Algorithm{}
View Source
var GlobalRand1 = &Rand{}
View Source
var GlobalRand2 = &Rand{isPCG: true}
View Source
var OrderedIntEncoder, _ = NewIntEncoder("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 62)
View Source
var RSA = &RSAAlgorithm{isPSS: true, isOAEP: true}
View Source
var RSAPKCS1v15 = &RSAAlgorithm{isPSS: false, isOAEP: false}
Deprecated: RSAPKCS1v15 is not recommended. Please use RSA instead.
View Source
var X25519CBC = &X25519Algorithm{useGCM: false, hash: crypto.SHA256}
View Source
var X25519GCM = &X25519Algorithm{useGCM: true, hash: crypto.SHA256}
Functions ¶
func AddFileToMemory ¶ added in v1.7.4
func AddFileToMemory(memFile MemFile)
func AppendUniqueString ¶ added in v0.1.17
func AppendUniqueStrings ¶ added in v0.1.17
func BBlack ¶
func BBlack(s interface{}, attribs ...AttribCode) string
func BBlue ¶
func BBlue(s interface{}, attribs ...AttribCode) string
func BCyan ¶
func BCyan(s interface{}, attribs ...AttribCode) string
func BGreen ¶
func BGreen(s interface{}, attribs ...AttribCode) string
func BMagenta ¶
func BMagenta(s interface{}, attribs ...AttribCode) string
func BRed ¶
func BRed(s interface{}, attribs ...AttribCode) string
func BWhite ¶
func BWhite(s interface{}, attribs ...AttribCode) string
func BYellow ¶
func BYellow(s interface{}, attribs ...AttribCode) string
func Base64String ¶ added in v0.5.40
func Black ¶
func Black(s interface{}, attribs ...AttribCode) string
func Blue ¶
func Blue(s interface{}, attribs ...AttribCode) string
func Color ¶
func Color(s interface{}, textColor TextColor, bgColor BgColor, attribs ...AttribCode) string
func Cyan ¶
func Cyan(s interface{}, attribs ...AttribCode) string
func DecryptChaCha20 ¶ added in v1.7.25
func DisableCoreDump ¶ added in v1.7.25
func DisableCoreDump() error
func EncryptChaCha20 ¶ added in v1.7.25
func ExchangeInt ¶ added in v1.7.14
func FileExists ¶ added in v0.0.8
func FixJsonBytes ¶ added in v0.5.40
修复Golang中Json默认处理HTML转义 < > & 的问题
func FixNilValue ¶ added in v0.1.9
func FixUpperCase ¶
func FixedJsonP ¶ added in v0.5.40
func FixedJsonP(value interface{}) string
func Float32Ptr ¶ added in v1.7.20
func Float64Ptr ¶ added in v1.7.20
func FormatTime ¶ added in v1.7.14
func GenerateECDSAKeyPair ¶ added in v1.7.25
func GenerateEd25519KeyPair ¶ added in v1.7.25
func GenerateRSAKeyPair ¶ added in v1.7.25
func GenerateX25519KeyPair ¶ added in v1.7.25
func GetAbsFilename ¶ added in v1.7.5
func GetLowerName ¶ added in v0.1.9
func GetUpperName ¶ added in v0.1.9
func Green ¶
func Green(s interface{}, attribs ...AttribCode) string
func HmacSha256 ¶ added in v1.7.22
func HmacSha512 ¶ added in v1.7.22
func IntSlicePtr ¶ added in v1.7.20
func JsonBytesP ¶ added in v0.5.40
func JsonBytesP(value interface{}) []byte
func LoadFileToMemory ¶ added in v1.7.4
func LoadFileToMemory(filename string)
func LoadFileToMemoryWithCompress ¶ added in v1.7.4
func LoadFileToMemoryWithCompress(filename string)
func LoadFilesToMemoryFromB64 ¶ added in v1.7.4
func LoadFilesToMemoryFromB64(b64File *MemFileB64)
func LoadFilesToMemoryFromB64KeepGzip ¶ added in v1.7.4
func LoadFilesToMemoryFromB64KeepGzip(b64File *MemFileB64)
func LoadFilesToMemoryFromJson ¶ added in v1.7.4
func LoadFilesToMemoryFromJson(jsonFiles string)
func Magenta ¶
func Magenta(s interface{}, attribs ...AttribCode) string
func MakeBoolMap ¶ added in v1.7.20
func MakeExcludeUpperKeys ¶ added in v0.5.50
func MakeSafeToken ¶ added in v1.7.25
func ReadFileBytes ¶ added in v0.5.30
func ReadFileBytesN ¶ added in v1.7.4
func ReadFileLines ¶ added in v0.1.15
func ReadFileLinesN ¶ added in v1.7.4
func Red ¶
func Red(s interface{}, attribs ...AttribCode) string
func SafeLoadFileToMemory ¶ added in v1.7.25
func SafeLoadFileToMemory(filename string)
func SafeLoadFileToMemoryWithCompress ¶ added in v1.7.25
func SafeLoadFileToMemoryWithCompress(filename string)
func SetSafeBufObfuscator ¶ added in v1.7.25
func Sha1Base64 ¶ added in v0.1.17
func Sha1String ¶ added in v0.1.17
func Sha256Base64 ¶ added in v0.1.17
func Sha256String ¶ added in v0.1.17
func Sha512Base64 ¶ added in v0.1.17
func Sha512String ¶ added in v0.1.17
func SplitTrimN ¶ added in v1.7.14
func SplitWithoutNone ¶ added in v0.1.17
func SplitWithoutNoneN ¶ added in v1.7.14
func StringFromValue ¶ added in v1.7.7
func StringSlicePtr ¶ added in v1.7.20
func ToInterfaceArray ¶ added in v0.1.17
func ToInterfaceArray(in interface{}) []interface{}
func UnBase64String ¶ added in v0.5.40
func UnHexString ¶ added in v1.7.25
func UnJsonBytes ¶ added in v0.5.40
func UnJsonBytes(data []byte, value interface{}) interface{}
func UnUrlBase64 ¶ added in v0.5.40
func UnUrlBase64String ¶ added in v0.5.40
func UrlBase64String ¶ added in v0.5.40
func ValueToString ¶ added in v0.1.10
func White ¶
func White(s interface{}, attribs ...AttribCode) string
func WriteFileBytes ¶ added in v0.5.30
func Yellow ¶
func Yellow(s interface{}, attribs ...AttribCode) string
func ZeroMemory ¶ added in v1.7.25
func ZeroMemory(buf []byte)
Types ¶
type AESCipher ¶ added in v1.7.25
type AESCipher struct {
// contains filtered or unexported fields
}
type Asymmetric ¶ added in v1.7.25
type Asymmetric struct {
// contains filtered or unexported fields
}
func NewAsymmetric ¶ added in v1.7.25
func NewAsymmetric(algorithm AsymmetricAlgorithm, safePrivateKeyBuf, safePublicKeyBuf *SafeBuf) (*Asymmetric, error)
func NewAsymmetricAndEraseKey ¶ added in v1.7.25
func NewAsymmetricAndEraseKey(algorithm AsymmetricAlgorithm, privateKey, publicKey []byte) (*Asymmetric, error)
func NewAsymmetricWithoutEraseKey ¶ added in v1.7.25
func NewAsymmetricWithoutEraseKey(algorithm AsymmetricAlgorithm, privateKey, publicKey []byte, fastModeButIsNotSecure bool) (*Asymmetric, error)
func NewECDSA ¶ added in v1.7.25
func NewECDSA(safePrivateKeyBuf, safePublicKeyBuf *SafeBuf) (*Asymmetric, error)
func NewECDSAWithOutEraseKey ¶ added in v1.7.25
func NewECDSAWithOutEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
func NewECDSAndEraseKey ¶ added in v1.7.25
func NewECDSAndEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
func NewED25519 ¶ added in v1.7.25
func NewED25519(safePrivateKeyBuf, safePublicKeyBuf *SafeBuf) (*Asymmetric, error)
func NewED25519AndEraseKey ¶ added in v1.7.25
func NewED25519AndEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
func NewED25519WithOutEraseKey ¶ added in v1.7.25
func NewED25519WithOutEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
func NewRSA ¶ added in v1.7.25
func NewRSA(safePrivateKeyBuf, safePublicKeyBuf *SafeBuf) (*Asymmetric, error)
func NewRSAWithOutEraseKey ¶ added in v1.7.25
func NewRSAWithOutEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
func NewRSAndEraseKey ¶ added in v1.7.25
func NewRSAndEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
func NewX25519 ¶ added in v1.7.25
func NewX25519(safePrivateKeyBuf, safePublicKeyBuf *SafeBuf) (*Asymmetric, error)
func NewX25519AndEraseKey ¶ added in v1.7.25
func NewX25519AndEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
func NewX25519WithOutEraseKey ¶ added in v1.7.25
func NewX25519WithOutEraseKey(safePrivateKeyBuf, safePublicKeyBuf []byte) (*Asymmetric, error)
func (*Asymmetric) Close ¶ added in v1.7.25
func (_this *Asymmetric) Close()
func (*Asymmetric) Decrypt ¶ added in v1.7.25
func (_this *Asymmetric) Decrypt(data []byte) ([]byte, error)
func (*Asymmetric) Encrypt ¶ added in v1.7.25
func (_this *Asymmetric) Encrypt(data []byte) ([]byte, error)
type AsymmetricAlgorithm ¶ added in v1.7.25
type AsymmetricCipherAlgorithm ¶ added in v1.7.25
type AttribCode ¶
type AttribCode int
const ( AttrNone AttribCode = iota AttrBold AttrDim AttrItalic AttrUnderline AttrBlink AttrFastBlink AttrReverse AttrHidden AttrCrossedOut )
type ECDSAAlgorithm ¶ added in v1.7.25
type ECDSAAlgorithm struct {
// contains filtered or unexported fields
}
func NewECDSAAlgorithm ¶ added in v1.7.25
func NewECDSAAlgorithm(useGCM bool, hash crypto.Hash, kdfInfo, kdfSalt []byte) *ECDSAAlgorithm
func (*ECDSAAlgorithm) Decrypt ¶ added in v1.7.25
func (e *ECDSAAlgorithm) Decrypt(privateKeyObj any, data []byte) ([]byte, error)
func (*ECDSAAlgorithm) Encrypt ¶ added in v1.7.25
func (e *ECDSAAlgorithm) Encrypt(publicKeyObj any, data []byte) ([]byte, error)
func (*ECDSAAlgorithm) ParsePrivateKey ¶ added in v1.7.25
func (e *ECDSAAlgorithm) ParsePrivateKey(der []byte) (any, error)
func (*ECDSAAlgorithm) ParsePublicKey ¶ added in v1.7.25
func (e *ECDSAAlgorithm) ParsePublicKey(der []byte) (any, error)
type Ed25519Algorithm ¶ added in v1.7.25
type Ed25519Algorithm struct{}
func (*Ed25519Algorithm) ParsePrivateKey ¶ added in v1.7.25
func (e *Ed25519Algorithm) ParsePrivateKey(der []byte) (any, error)
func (*Ed25519Algorithm) ParsePublicKey ¶ added in v1.7.25
func (e *Ed25519Algorithm) ParsePublicKey(der []byte) (any, error)
type FileInfo ¶ added in v1.7.4
func GetFileInfo ¶ added in v1.7.5
type IdMaker ¶ added in v1.7.26
func NewIdMaker ¶ added in v1.7.26
func (*IdMaker) GetForMysql ¶ added in v1.7.26
func (*IdMaker) GetForPostgreSQL ¶ added in v1.7.26
type IntEncoder ¶ added in v1.7.25
type IntEncoder struct {
// contains filtered or unexported fields
}
func NewIntEncoder ¶
func NewIntEncoder(digits string, radix uint8) (*IntEncoder, error)
func (*IntEncoder) AppendInt ¶ added in v1.7.25
func (enc *IntEncoder) AppendInt(buf []byte, u uint64) []byte
func (*IntEncoder) DecodeInt ¶ added in v1.7.25
func (enc *IntEncoder) DecodeInt(buf []byte) uint64
func (*IntEncoder) EncodeInt ¶ added in v1.7.25
func (enc *IntEncoder) EncodeInt(u uint64) []byte
func (*IntEncoder) FillInt ¶ added in v1.7.25
func (enc *IntEncoder) FillInt(buf []byte, length int) []byte
func (*IntEncoder) HashInt ¶ added in v1.7.25
func (enc *IntEncoder) HashInt(buf []byte) []byte
type MemFile ¶ added in v1.7.4
type MemFile struct {
Name string
ModTime time.Time
IsDir bool
Compressed bool
Size int64
Data []byte
SafeData *SafeBuf
// contains filtered or unexported fields
}
func ReadDirFromMemory ¶ added in v1.7.4
func ReadFileFromMemory ¶ added in v1.7.4
func (*MemFile) GetSafeData ¶ added in v1.7.25
func (mf *MemFile) GetSafeData() *SecretPlaintext
type MemFileB64 ¶ added in v1.7.4
type MemFileB64 struct {
Name string
ModTime time.Time
IsDir bool
DataB64 []byte
Compressed bool
Size int64
Children []MemFileB64
}
func LoadFileToB64 ¶ added in v1.7.4
func LoadFileToB64(filename string) *MemFileB64
type RSAAlgorithm ¶ added in v1.7.25
type RSAAlgorithm struct {
// contains filtered or unexported fields
}
func (*RSAAlgorithm) Decrypt ¶ added in v1.7.25
func (r *RSAAlgorithm) Decrypt(privateKeyObj any, data []byte) ([]byte, error)
func (*RSAAlgorithm) Encrypt ¶ added in v1.7.25
func (r *RSAAlgorithm) Encrypt(publicKeyObj any, data []byte) ([]byte, error)
func (*RSAAlgorithm) ParsePrivateKey ¶ added in v1.7.25
func (r *RSAAlgorithm) ParsePrivateKey(der []byte) (any, error)
func (*RSAAlgorithm) ParsePublicKey ¶ added in v1.7.25
func (r *RSAAlgorithm) ParsePublicKey(der []byte) (any, error)
type SafeBuf ¶ added in v1.7.25
type SafeBuf struct {
// contains filtered or unexported fields
}
func MakeSafeBuf ¶ added in v1.7.25
func NewSafeBuf ¶ added in v1.7.25
func (*SafeBuf) Open ¶ added in v1.7.25
func (sb *SafeBuf) Open() *SecretPlaintext
type SecretPlaintext ¶ added in v1.7.25
type SecretPlaintext struct {
Data []byte
}
func NewSafeString ¶ added in v1.7.25
func NewSafeString(raw []byte) (*SecretPlaintext, string)
func (*SecretPlaintext) Close ¶ added in v1.7.25
func (sp *SecretPlaintext) Close()
func (*SecretPlaintext) String ¶ added in v1.7.25
func (sp *SecretPlaintext) String() string
type StructInfo ¶ added in v0.5.43
type StructInfo struct {
Fields []reflect.StructField
Values map[string]reflect.Value
Methods []reflect.Method
MethodValues map[string]reflect.Value
}
func FlatStruct ¶ added in v0.5.43
func FlatStruct(data interface{}) *StructInfo
func FlatStructWithUnexported ¶ added in v0.5.43
func FlatStructWithUnexported(data interface{}) *StructInfo
type Symmetric ¶ added in v1.7.25
type Symmetric struct {
// contains filtered or unexported fields
}
func NewAESCBCAndEraseKey ¶ added in v1.7.25
func NewAESCBCWithOutEraseKey ¶ added in v1.7.25
func NewAESGCMAndEraseKey ¶ added in v1.7.25
func NewAESGCMWithOutEraseKey ¶ added in v1.7.25
func NewSymmetric ¶ added in v1.7.25
func NewSymmetric(cipher SymmetricCipher, safeKeyBuf, safeIvBuf *SafeBuf) (*Symmetric, error)
func NewSymmetricAndEraseKey ¶ added in v1.7.25
func NewSymmetricAndEraseKey(cipher SymmetricCipher, key, iv []byte) (*Symmetric, error)
func NewSymmetricWithOutEraseKey ¶ added in v1.7.25
func NewSymmetricWithOutEraseKey(cipher SymmetricCipher, key, iv []byte) (*Symmetric, error)
func (*Symmetric) DecryptBytes ¶ added in v1.7.25
func (*Symmetric) DecryptBytesN ¶ added in v1.7.25
type SymmetricCipher ¶ added in v1.7.25
type X25519Algorithm ¶ added in v1.7.25
type X25519Algorithm struct {
// contains filtered or unexported fields
}
func NewX25519Algorithm ¶ added in v1.7.25
func NewX25519Algorithm(useGCM bool, hash crypto.Hash, kdfInfo, kdfSalt []byte) *X25519Algorithm
func (*X25519Algorithm) Decrypt ¶ added in v1.7.25
func (x *X25519Algorithm) Decrypt(privateKeyObj any, data []byte) ([]byte, error)
func (*X25519Algorithm) Encrypt ¶ added in v1.7.25
func (x *X25519Algorithm) Encrypt(publicKeyObj any, data []byte) ([]byte, error)
func (*X25519Algorithm) ParsePrivateKey ¶ added in v1.7.25
func (x *X25519Algorithm) ParsePrivateKey(der []byte) (any, error)
func (*X25519Algorithm) ParsePublicKey ¶ added in v1.7.25
func (x *X25519Algorithm) ParsePublicKey(der []byte) (any, error)
Click to show internal directories.
Click to hide internal directories.