Documentation ¶
Overview ¶
Package gnomon 是一个编写go应用或软件可选的公共库
目前提供的方法包如下:
gnomon.Byte… // 字节
gnomon.Command… // 命令行
gnomon.Env… // 环境变量
gnomon.File… // 文件操作
gnomon.IP… // IP
gnomon.JWT… // JWT
gnomon.String… // 字符串
gnomon.CryptoHash… // Hash/散列
gnomon.CryptoRSA… // RSA
gnomon.CryptoECC… // ECC
gnomon.CryptoAES… // AES
gnomon.CryptoDES… // DES
gnomon.CA… // CA
gnomon.Log… // 日志
gnomon.Scale… // 算数/转换
gnomon.Time… // 时间
SQLCommon sql 连接对象 ¶
Pool io.Closer连接池工具 ¶
gnomon.HTTPClientCommon http客户端工具
未来会陆续添加新的方法或类型,对于已经编写的内容会尽量覆盖其测试范围。如果有新的需求可以提出,以便后续加进去,或直接提交代码对该库进行补充
Index ¶
- func AESDecryptCBC(encrypted []byte, key []byte) []byte
- func AESDecryptCFB(encrypted []byte, key []byte) (decrypted []byte)
- func AESDecryptECB(encrypted []byte, key []byte) (decrypted []byte)
- func AESDecryptOFB(encrypted []byte, key []byte) (decrypted []byte)
- func AESEncryptCBC(data []byte, key []byte) (encrypted []byte)
- func AESEncryptCFB(data []byte, key []byte) (encrypted []byte)
- func AESEncryptECB(data []byte, key []byte) (encrypted []byte)
- func AESEncryptOFB(data []byte, key []byte) (encrypted []byte)
- func BytesToInt(byte []byte) (int, error)
- func BytesToUint16(buf []byte) uint16
- func BytesToUint32(buf []byte) uint32
- func BytesToUint64(buf []byte) uint64
- func CAGenerateCertificate(cert *Cert) (certData []byte, err error)
- func CAGenerateCertificateRequest(cert *CertRequestModel) (csr []byte, err error)
- func CAGenerateCertificateSelf(cert *CertSelf) (certData []byte, err error)
- func CAGenerateECCCertificateRequest(cert *CertRequest, pemType string) (csr []byte, err error)
- func CAGenerateECCCertificateRequestFP(cert *CertRequestFP, pemType string) (csr []byte, err error)
- func CAGenerateECCCertificateRequestFPWithPass(cert *CertRequestFP, password, pemType string) (csr []byte, err error)
- func CAGenerateECCCertificateRequestWithPass(cert *CertRequest, password, pemType string) (csr []byte, err error)
- func CAGenerateRSACertificateRequest(cert *CertRequest, pemType string, pks PKSCType) (csr []byte, err error)
- func CAGenerateRSACertificateRequestFP(cert *CertRequestFP, pemType string, pks PKSCType) (csr []byte, err error)
- func CAGenerateRSACertificateRequestFPWithPass(cert *CertRequestFP, password, pemType string, pks PKSCType) (csr []byte, err error)
- func CAGenerateRSACertificateRequestWithPass(cert *CertRequest, password, pemType string, pks PKSCType) (csr []byte, err error)
- func CALoadCrtFromFP(crtFilePath string) (certificate *x509.Certificate, err error)
- func CALoadCsrPemFromFP(csrFilePath string) (cert *x509.CertificateRequest, err error)
- func CommandExec(commandName string, params ...string) (line int, cmd *exec.Cmd, contentArray []string, err error)
- func CommandExecAsync(commandAsync chan *CommandAsync, commandName string, params ...string)
- func CommandExecSilent(commandName string, params ...string) (line int, cmd *exec.Cmd, contentArray []string, err error)
- func CommandExecTail(commandName string, params ...string) (line int, cmd *exec.Cmd, contentArray []string, err error)
- func DESDecryptCBC(data, key []byte) []byte
- func DESDecryptECB(data, key []byte) []byte
- func DESEncryptCBC(data, key []byte) []byte
- func DESEncryptECB(data, key []byte) []byte
- func ECCBytes2PriKey(data []byte, curve elliptic.Curve) *ecdsa.PrivateKey
- func ECCBytes2PubKey(data []byte, curve elliptic.Curve) (*ecdsa.PublicKey, error)
- func ECCDecrypt(data []byte, privateKey *ecies.PrivateKey) ([]byte, error)
- func ECCEncrypt(data []byte, publicKey *ecies.PublicKey) ([]byte, error)
- func ECCGenerate(curve elliptic.Curve) (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)
- func ECCGenerateKey(path, priFileName, pubFileName string, curve elliptic.Curve) error
- func ECCGeneratePemBytes(priPemType, pubPemType, passwd string, curve elliptic.Curve) (priBytes, pubBytes []byte, err error)
- func ECCGeneratePemKey(path, priFileName, pubFileName, priPemType, pubPemType string, ...) error
- func ECCGeneratePemKeyWithPass(path, priFileName, pubFileName, passwd, priPemType, pubPemType string, ...) error
- func ECCGeneratePemPriKey(path, priFileName, pemType string, curve elliptic.Curve) error
- func ECCGeneratePemPriKeyWithPass(path, priFileName, passwd, pemType string, curve elliptic.Curve) error
- func ECCGeneratePemPubKey(privateKey *ecdsa.PrivateKey, path, pubFileName, pemType string) error
- func ECCGeneratePriKey(path, priFileName string, curve elliptic.Curve) error
- func ECCGeneratePubKey(privateKey *ecdsa.PrivateKey, path, pubFileName string, curve elliptic.Curve) error
- func ECCLoadPri(file string, curve elliptic.Curve) (*ecdsa.PrivateKey, error)
- func ECCLoadPriPem(privateKey []byte, pemType string) (*ecdsa.PrivateKey, error)
- func ECCLoadPriPemFP(file, pemType string) (*ecdsa.PrivateKey, error)
- func ECCLoadPriPemFPWithPass(file, passwd, pemType string) (*ecdsa.PrivateKey, error)
- func ECCLoadPriPemWithPass(privateKey []byte, passwd, pemType string) (*ecdsa.PrivateKey, error)
- func ECCLoadPub(file string, curve elliptic.Curve) (*ecdsa.PublicKey, error)
- func ECCLoadPubPem(publicKey []byte, pemType string) (*ecdsa.PublicKey, error)
- func ECCLoadPubPemFP(file, pemType string) (*ecdsa.PublicKey, error)
- func ECCPri2PemBytes(priPemType, passwd string, privateKey *ecdsa.PrivateKey) (data []byte, err error)
- func ECCPriKey2Bytes(privateKey *ecdsa.PrivateKey) []byte
- func ECCPub2PemBytes(pubPemType string, publicKey *ecdsa.PublicKey) (data []byte, err error)
- func ECCPubKey2Bytes(publicKey *ecdsa.PublicKey, curve elliptic.Curve) []byte
- func ECCSavePri(file string, privateKey *ecdsa.PrivateKey) error
- func ECCSavePriPem(privateKey *ecdsa.PrivateKey, path, fileName, pemType string) error
- func ECCSavePriPemWithPass(privateKey *ecdsa.PrivateKey, passwd, path, fileName, pemType string) error
- func ECCSavePub(file string, publicKey *ecdsa.PublicKey, curve elliptic.Curve) error
- func ECCSavePubPem(file, pemType string, publicKey *ecdsa.PublicKey) error
- func ECCSign(privateKey *ecdsa.PrivateKey, data []byte) (sign []byte, err error)
- func ECCVerify(publicKey *ecdsa.PublicKey, data, sign []byte) (bool, error)
- func EnvGet(envName string) string
- func EnvGetBool(envName string) bool
- func EnvGetD(envName string, defaultValue string) string
- func EnvGetFloat64(envName string) (float64, error)
- func EnvGetFloat64D(envName string, defaultValue float64) float64
- func EnvGetInt(envName string) (int, error)
- func EnvGetInt64(envName string) (int64, error)
- func EnvGetInt64D(envName string, defaultValue int64) int64
- func EnvGetIntD(envName string, defaultValue int) int
- func EnvGetUint64(envName string) (uint64, error)
- func EnvGetUint64D(envName string, defaultValue uint64) uint64
- func FileAppend(filePath string, data []byte, force bool) (int, error)
- func FileCompressTar(files []*os.File, dest string) error
- func FileCompressZip(files []*os.File, dest string) error
- func FileCopy(srcFilePath, dstFilePath string) (written int64, err error)
- func FileDeCompressZip(zipFile, dest string) error
- func FileLoopDirs(pathname string) ([]string, error)
- func FileLoopFileNames(pathname string) ([]string, error)
- func FileLoopFiles(pathname string) ([]string, error)
- func FileLoopOneDirs(pathname string) ([]string, error)
- func FileModify(filePath string, offset int64, data []byte, force bool) (int, error)
- func FileParentPath(filePath string) string
- func FilePathExists(path string) bool
- func FileReadFirstLine(filePath string) (string, error)
- func FileReadLines(filePath string) ([]string, error)
- func FileReadPointLine(filePath string, line int) (string, error)
- func GRPCGetClientIP(ctx context.Context) (address string, port int, err error)
- func GRPCRequest(url string, business Business) (interface{}, error)
- func GRPCRequestPool(pool *Pond, business Business) (interface{}, error)
- func GRPCRequestPools(url string, business Business) (interface{}, error)
- func GRPCRequestSingleConn(url string, business Business) (interface{}, error)
- func GetBytes(key interface{}) ([]byte, error)
- func HTTPDelete(url string) (resp *http.Response, err error)
- func HTTPDeleteJSON(url string, model interface{}) (resp *http.Response, err error)
- func HTTPDeleteJSONTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPDeleteJSONTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPDeleteMsgPack(url string, model interface{}) (resp *http.Response, err error)
- func HTTPDeleteMsgPackTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPDeleteMsgPackTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPDeleteProtoBuf(url string, pm proto.Message) (resp *http.Response, err error)
- func HTTPDeleteProtoBufTLS(url string, pm proto.Message, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPDeleteProtoBufTLSBytes(url string, pm proto.Message, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPDeleteTLS(url string, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPDeleteTLSBytes(url string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPDeleteXML(url string, model interface{}) (resp *http.Response, err error)
- func HTTPDeleteXMLTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPDeleteXMLTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPDeleteYaml(url string, model interface{}) (resp *http.Response, err error)
- func HTTPDeleteYamlTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPDeleteYamlTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPDo(req *http.Request) (resp *http.Response, err error)
- func HTTPDoTLS(req *http.Request, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPDoTLSBytes(req *http.Request, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPGet(url string) (resp *http.Response, err error)
- func HTTPGetHostTLSBytes(url, host string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPGetTLS(url string, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPGetTLSBytes(url string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPatchForm(url string, paramMap map[string]string) (resp *http.Response, err error)
- func HTTPPatchFormMultipart(url string, paramMap map[string]string, fileMap map[string]string) (resp *http.Response, err error)
- func HTTPPatchFormMultipartTLS(url string, paramMap map[string]string, fileMap map[string]string, ...) (resp *http.Response, err error)
- func HTTPPatchFormMultipartTLSBytes(url string, paramMap map[string]string, fileMap map[string]string, ...) (resp *http.Response, err error)
- func HTTPPatchFormTLS(url string, paramMap map[string]string, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPatchFormTLSBytes(url string, paramMap map[string]string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPatchJSON(url string, model interface{}) (resp *http.Response, err error)
- func HTTPPatchJSONTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPatchJSONTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPatchMsgPack(url string, model interface{}) (resp *http.Response, err error)
- func HTTPPatchMsgPackTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPatchMsgPackTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPatchProtoBuf(url string, pm proto.Message) (resp *http.Response, err error)
- func HTTPPatchProtoBufTLS(url string, pm proto.Message, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPatchProtoBufTLSBytes(url string, pm proto.Message, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPatchXML(url string, model interface{}) (resp *http.Response, err error)
- func HTTPPatchXMLTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPatchXMLTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPatchYaml(url string, model interface{}) (resp *http.Response, err error)
- func HTTPPatchYamlTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPatchYamlTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPostForm(url string, paramMap map[string]string) (resp *http.Response, err error)
- func HTTPPostFormMultipart(url string, paramMap map[string]string, fileMap map[string]string) (resp *http.Response, err error)
- func HTTPPostFormMultipartTLS(url string, paramMap map[string]string, fileMap map[string]string, ...) (resp *http.Response, err error)
- func HTTPPostFormMultipartTLSBytes(url string, paramMap map[string]string, fileMap map[string]string, ...) (resp *http.Response, err error)
- func HTTPPostFormTLS(url string, paramMap map[string]string, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPostFormTLSBytes(url string, paramMap map[string]string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPostJSON(url string, model interface{}) (resp *http.Response, err error)
- func HTTPPostJSONTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPostJSONTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPostMsgPack(url string, model interface{}) (resp *http.Response, err error)
- func HTTPPostMsgPackTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPostMsgPackTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPostProtoBuf(url string, pm proto.Message) (resp *http.Response, err error)
- func HTTPPostProtoBufTLS(url string, pm proto.Message, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPostProtoBufTLSBytes(url string, pm proto.Message, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPostXML(url string, model interface{}) (resp *http.Response, err error)
- func HTTPPostXMLTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPostXMLTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPostYaml(url string, model interface{}) (resp *http.Response, err error)
- func HTTPPostYamlTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPostYamlTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPutForm(url string, paramMap map[string]string) (resp *http.Response, err error)
- func HTTPPutFormMultipart(url string, paramMap map[string]string, fileMap map[string]string) (resp *http.Response, err error)
- func HTTPPutFormMultipartTLS(url string, paramMap map[string]string, fileMap map[string]string, ...) (resp *http.Response, err error)
- func HTTPPutFormMultipartTLSBytes(url string, paramMap map[string]string, fileMap map[string]string, ...) (resp *http.Response, err error)
- func HTTPPutFormTLS(url string, paramMap map[string]string, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPutFormTLSBytes(url string, paramMap map[string]string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPutJSON(url string, model interface{}) (resp *http.Response, err error)
- func HTTPPutJSONTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPutJSONTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPutMsgPack(url string, model interface{}) (resp *http.Response, err error)
- func HTTPPutMsgPackTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPutMsgPackTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPutProtoBuf(url string, pm proto.Message) (resp *http.Response, err error)
- func HTTPPutProtoBufTLS(url string, pm proto.Message, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPutProtoBufTLSBytes(url string, pm proto.Message, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPutXML(url string, model interface{}) (resp *http.Response, err error)
- func HTTPPutXMLTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPutXMLTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HTTPPutYaml(url string, model interface{}) (resp *http.Response, err error)
- func HTTPPutYamlTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
- func HTTPPutYamlTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
- func HashMD5(text string) string
- func HashMD516(text string) string
- func HashMD516Bytes(bytes []byte) string
- func HashMD5Bytes(bytes []byte) string
- func HashSha1(text string) string
- func HashSha1Bytes(bytes []byte) string
- func HashSha224(text string) string
- func HashSha224Bytes(bytes []byte) string
- func HashSha256(text string) string
- func HashSha256Bytes(bytes []byte) string
- func HashSha384(text string) string
- func HashSha384Bytes(bytes []byte) string
- func HashSha512(text string) string
- func HashSha512Bytes(bytes []byte) string
- func IPGet(req *http.Request) string
- func IntToBytes(n int) ([]byte, error)
- func JWTBuild(method int, key interface{}, sub, iss, jti string, iat, nbf, exp int64) (string, error)
- func JWTCheck(key interface{}, token string) bool
- func NewSpinLock() sync.Locker
- func RSADecrypt(privateKey, data []byte, pemType string, pks PKSCType) ([]byte, error)
- func RSADecryptFP(privateKeyFilePath, pemType string, data []byte, pks PKSCType) ([]byte, error)
- func RSADecryptFPWithPass(privateKeyFilePath, passwd, pemType string, data []byte, pks PKSCType) ([]byte, error)
- func RSADecryptWithPass(privateKey, data []byte, passwd, pemType string, pks PKSCType) ([]byte, error)
- func RSAEncrypt(publicKey, data []byte, pemType string) ([]byte, error)
- func RSAEncryptFP(publicKeyFilePath, pemType string, data []byte) ([]byte, error)
- func RSAGenerateKey(bits int, path, priFileName, pubFileName, priPemType, pubPemType string, ...) error
- func RSAGenerateKeyPemBytes(bits int, priPemType, pubPemType, passwd string, pks PKSCType) (priBytes, pubBytes []byte, err error)
- func RSAGenerateKeyWithPass(bits int, ...) error
- func RSAGeneratePriKey(bits int, path, fileName, pemType string, pks PKSCType) (*rsa.PrivateKey, error)
- func RSAGeneratePriKeyWithPass(bits int, path, fileName, passwd, pemType string, alg x509.PEMCipher, ...) (*rsa.PrivateKey, error)
- func RSAGeneratePubKey(privateKey *rsa.PrivateKey, path, fileName, pemType string) error
- func RSAGeneratePubKeyBytes(privateKey []byte, path, fileName, priPemType, pubPemType string, pks PKSCType) error
- func RSAGeneratePubKeyBytesWithPass(privateKey []byte, passwd, path, fileName, priPemType, pubPemType string, ...) error
- func RSAGeneratePubKeyFP(privateKeyFilePath, path, fileName, priPemType, pubPemType string, ...) error
- func RSAGeneratePubKeyFPWithPass(privateKeyFilePath, passwd, path, fileName, priPemType, pubPemType string, ...) error
- func RSALoadPri(privateKey []byte, pemType string, pks PKSCType) (*rsa.PrivateKey, error)
- func RSALoadPriFP(privateKeyFilePath, pemType string, pks PKSCType) (*rsa.PrivateKey, error)
- func RSALoadPriFPWithPass(privateKeyFilePath, passwd, pemType string, pks PKSCType) (*rsa.PrivateKey, error)
- func RSALoadPriWithPass(privateKey []byte, passwd, pemType string, pks PKSCType) (*rsa.PrivateKey, error)
- func RSALoadPub(publicKey []byte, pemType string) (*rsa.PublicKey, error)
- func RSALoadPubFP(publicKeyFilePath, pemType string) (*rsa.PublicKey, error)
- func RSAPri2PemBytes(priPemType, passwd string, privateKey *rsa.PrivateKey, pks PKSCType) (data []byte, err error)
- func RSAPub2PemBytes(pubPemType string, publicKey *rsa.PublicKey) (data []byte, err error)
- func RSASavePriPem(privateKey *rsa.PrivateKey, path, fileName, pemType string, alg x509.PEMCipher, ...) error
- func RSASavePriPemWithPass(privateKey *rsa.PrivateKey, path, fileName, passwd, pemType string, ...) error
- func RSASign(privateKey, data []byte, pemType string, hash crypto.Hash, pks PKSCType, ...) ([]byte, error)
- func RSASignFP(privateKeyPath, pemType string, data []byte, hash crypto.Hash, pks PKSCType, ...) ([]byte, error)
- func RSASignFPWithPass(privateKeyPath, passwd, pemType string, data []byte, hash crypto.Hash, ...) ([]byte, error)
- func RSASignWithPass(privateKey, data []byte, passwd, pemType string, hash crypto.Hash, ...) ([]byte, error)
- func RSAVerify(publicKey, data, signData []byte, pemType string, hash crypto.Hash, ...) error
- func RSAVerifyFP(publicKeyPath, pemType string, data, signData []byte, hash crypto.Hash, ...) error
- func SM2Generate() (pri *sm2.PrivateKey, pub *sm2.PublicKey, err error)
- func SM2GeneratePemBytes(priPemType, pubPemType, passwd string) (priBytes, pubBytes []byte, err error)
- func SM2Pri2PemBytes(priPemType, passwd string, pri *sm2.PrivateKey) (data []byte, err error)
- func SM2Pub2PemBytes(pubPemType string, pub *sm2.PublicKey) (data []byte, err error)
- func ScaleDDuoStringToInt64(dDuo string) int64
- func ScaleDDuoStringToUint64(dDuo string) uint64
- func ScaleDuoStringToInt64(duo string) int64
- func ScaleDuoStringToUint64(duo string) uint64
- func ScaleFloat64toInt64(num float64, retain int) int64
- func ScaleHexStringToInt64(hex string) int64
- func ScaleHexStringToUint64(hex string) uint64
- func ScaleInt32Len(i int32) int
- func ScaleInt32ToDDuoString(i int32) string
- func ScaleInt32ToDuoString(i int32) string
- func ScaleInt32ToHexString(i int32) string
- func ScaleInt64Len(i int64) int
- func ScaleInt64ToDDuoString(i int64) string
- func ScaleInt64ToDuoString(i int64) string
- func ScaleInt64ToHexString(i int64) string
- func ScaleInt64toFloat64(num int64, retain int) float64
- func ScaleIntLen(i int) int
- func ScaleIntToDDuoString(i int) string
- func ScaleIntToDuoString(i int) string
- func ScaleIntToHexString(i int) string
- func ScaleUint32Len(i uint32) int
- func ScaleUint32ToDDuoString(i uint32) string
- func ScaleUint32ToDuoString(i uint32) string
- func ScaleUint32ToHexString(i uint32) string
- func ScaleUint32toFullState(index uint32) string
- func ScaleUint64Len(i uint64) int
- func ScaleUint64ToDDuoString(i uint64) string
- func ScaleUint64ToDuoString(i uint64) string
- func ScaleUint64ToHexString(i uint64) string
- func ScaleUint8toFullState(index uint8) string
- func ScaleUintLen(i uint) int
- func ScaleUintToDDuoString(i uint) string
- func ScaleUintToDuoString(i uint) string
- func ScaleUintToHexString(i uint) string
- func String2Timestamp(date, format string, zone *time.Location) (int64, error)
- func StringBuild(arrString ...string) string
- func StringBuildSep(sep string, arrString ...string) string
- func StringConvert(oriString string) string
- func StringIsEmpty(str string) bool
- func StringIsNotEmpty(str string) bool
- func StringPrefixSupplementZero(str string, offset int) string
- func StringRandSeq(n int) string
- func StringRandSeq16() string
- func StringSingleSpace(res string) string
- func StringSingleValue(res string, value string) string
- func StringTrim(str string) string
- func StringTrimN(str string) string
- func SubString(res string, start, end int) string
- func Timestamp2String(timestampSec, timestampNSec int64, format string, zone *time.Location) string
- func ToString(i interface{}) string
- func Uint16ToBytes(i uint16) []byte
- func Uint32ToBytes(i uint32) []byte
- func Uint64ToBytes(i uint64) []byte
- type Business
- type Cert
- type CertRequest
- type CertRequestFP
- type CertRequestModel
- type CertSelf
- type CommandAsync
- type Conn
- type Field
- type HTTPTLSBytesConfig
- type HTTPTLSConfig
- type PKSCType
- type Pond
- type Schema
- type SignMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AESDecryptCBC ¶
AESDecryptCBC AES CBC模式解密
func AESDecryptCFB ¶
AESDecryptCFB AES CFB模式解密
func AESDecryptECB ¶
AESDecryptECB AES ECB模式解密
func AESDecryptOFB ¶
AESDecryptOFB AES OFB模式解密
func AESEncryptCBC ¶
AESEncryptCBC AES CBC模式加密
func AESEncryptCFB ¶
AESEncryptCFB AES CFB模式加密
func AESEncryptECB ¶
AESEncryptECB AES ECB模式加密
func AESEncryptOFB ¶
AESEncryptOFB AES OFB模式加密
func CAGenerateCertificateRequest ¶
func CAGenerateCertificateRequest(cert *CertRequestModel) (csr []byte, err error)
CAGenerateCertificateRequest 生成证书签名请求文件
cert 证书生成请求对象
func CAGenerateECCCertificateRequest ¶
func CAGenerateECCCertificateRequest(cert *CertRequest, pemType string) (csr []byte, err error)
CAGenerateECCCertificateRequest 生成证书签名请求文件
cert 证书生成请求对象
func CAGenerateECCCertificateRequestFP ¶
func CAGenerateECCCertificateRequestFP(cert *CertRequestFP, pemType string) (csr []byte, err error)
CAGenerateECCCertificateRequestFP 生成证书签名请求文件
cert 证书生成请求对象
func CAGenerateECCCertificateRequestFPWithPass ¶
func CAGenerateECCCertificateRequestFPWithPass(cert *CertRequestFP, password, pemType string) (csr []byte, err error)
CAGenerateECCCertificateRequestFPWithPass 生成证书签名请求文件
cert 证书生成请求对象
password 生成时输入的密码
func CAGenerateECCCertificateRequestWithPass ¶
func CAGenerateECCCertificateRequestWithPass(cert *CertRequest, password, pemType string) (csr []byte, err error)
CAGenerateECCCertificateRequestWithPass 生成证书签名请求文件
cert 证书生成请求对象
password 生成时输入的密码
func CAGenerateRSACertificateRequest ¶
func CAGenerateRSACertificateRequest(cert *CertRequest, pemType string, pks PKSCType) (csr []byte, err error)
CAGenerateRSACertificateRequest 生成证书签名请求文件
cert 证书生成请求对象
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘RSAPKSC1()’和‘RSAPKSC8()’方法赋值
func CAGenerateRSACertificateRequestFP ¶
func CAGenerateRSACertificateRequestFP(cert *CertRequestFP, pemType string, pks PKSCType) (csr []byte, err error)
CAGenerateRSACertificateRequestFP 生成证书签名请求文件
cert 证书生成请求对象
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘RSAPKSC1()’和‘RSAPKSC8()’方法赋值
func CAGenerateRSACertificateRequestFPWithPass ¶
func CAGenerateRSACertificateRequestFPWithPass(cert *CertRequestFP, password, pemType string, pks PKSCType) (csr []byte, err error)
CAGenerateRSACertificateRequestFPWithPass 生成证书签名请求文件
cert 证书生成请求对象
password 生成时输入的密码
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘RSAPKSC1()’和‘RSAPKSC8()’方法赋值
func CAGenerateRSACertificateRequestWithPass ¶
func CAGenerateRSACertificateRequestWithPass(cert *CertRequest, password, pemType string, pks PKSCType) (csr []byte, err error)
CAGenerateRSACertificateRequestWithPass 生成证书签名请求文件
cert 证书生成请求对象
password 生成时输入的密码
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘RSAPKSC1()’和‘RSAPKSC8()’方法赋值
func CALoadCrtFromFP ¶
func CALoadCrtFromFP(crtFilePath string) (certificate *x509.Certificate, err error)
CALoadCrtFromFP 从文件中加载Crt对象
func CALoadCsrPemFromFP ¶
func CALoadCsrPemFromFP(csrFilePath string) (cert *x509.CertificateRequest, err error)
CALoadCsrPemFromFP 从文件中读取csr信息
func CommandExec ¶
func CommandExec(commandName string, params ...string) (line int, cmd *exec.Cmd, contentArray []string, err error)
CommandExec 执行cmd命令
commandName 命令执行文件名
命令后续参数以字符串数组的方式传入
line 执行命令后输出总行数
cmd cmd对象
contentArray 执行命令后输出内容按行放入字符串数组
func CommandExecAsync ¶
func CommandExecAsync(commandAsync chan *CommandAsync, commandName string, params ...string)
CommandExecAsync 异步执行cmd命令
commandAsync CommandAsync通道对象
commandName 命令执行文件名
命令后续参数以字符串数组的方式传入
func CommandExecSilent ¶
func CommandExecSilent(commandName string, params ...string) (line int, cmd *exec.Cmd, contentArray []string, err error)
CommandExecSilent 执行cmd命令
commandName 命令执行文件名
命令后续参数以字符串数组的方式传入
line 执行命令后输出总行数
cmd cmd对象
contentArray 执行命令后输出内容按行放入字符串数组
func CommandExecTail ¶
func CommandExecTail(commandName string, params ...string) (line int, cmd *exec.Cmd, contentArray []string, err error)
CommandExecTail 实时打印执行脚本过程中的命令
命令后续参数以字符串数组的方式传入
line 执行命令后输出总行数
cmd cmd对象
contentArray 执行命令后输出内容按行放入字符串数组
func ECCBytes2PriKey ¶
func ECCBytes2PriKey(data []byte, curve elliptic.Curve) *ecdsa.PrivateKey
ECCBytes2PriKey []byte转私钥
func ECCBytes2PubKey ¶
ECCBytes2PubKey []byte转公钥
func ECCDecrypt ¶
func ECCDecrypt(data []byte, privateKey *ecies.PrivateKey) ([]byte, error)
ECCDecrypt 解密
func ECCEncrypt ¶
ECCEncrypt 加密
func ECCGenerate ¶
ECCGenerate 生成公私钥对
curve 曲线生成类型,如 crypto.S256()/elliptic.P256()/elliptic.P384()/elliptic.P512()
func ECCGenerateKey ¶
ECCGenerateKey 生成公私钥对
path 指定公私钥所在生成目录
priFileName 指定生成的密钥名称
pubFileName 指定生成的密钥名称
curve 曲线生成类型,如 crypto.S256()/elliptic.P256()/elliptic.P384()/elliptic.P512()
func ECCGeneratePemBytes ¶
func ECCGeneratePemBytes(priPemType, pubPemType, passwd string, curve elliptic.Curve) (priBytes, pubBytes []byte, err error)
ECCGeneratePemBytes 生成公私钥对
curve 曲线生成类型,如 crypto.S256()/elliptic.P256()/elliptic.P384()/elliptic.P512()
func ECCGeneratePemKey ¶
func ECCGeneratePemKey(path, priFileName, pubFileName, priPemType, pubPemType string, curve elliptic.Curve) error
ECCGeneratePemKey 生成公私钥对
path 指定公私钥所在生成目录
priFileName 指定生成的密钥名称
pubFileName 指定生成的密钥名称
curve 曲线生成类型,如 crypto.S256()/elliptic.P256()/elliptic.P384()/elliptic.P512()
func ECCGeneratePemKeyWithPass ¶
func ECCGeneratePemKeyWithPass(path, priFileName, pubFileName, passwd, priPemType, pubPemType string, curve elliptic.Curve) error
ECCGeneratePemKeyWithPass 生成公私钥对
path 指定公私钥所在生成目录
priFileName 指定生成的密钥名称
pubFileName 指定生成的密钥名称
passwd 生成密码
curve 曲线生成类型,如 crypto.S256()/elliptic.P256()/elliptic.P384()/elliptic.P512()
func ECCGeneratePemPriKey ¶
ECCGeneratePemPriKey 生成私钥
path 指定私钥所在生成目录
priFileName 指定生成的密钥名称
curve 曲线生成类型,如 crypto.S256()/elliptic.P256()/elliptic.P384()/elliptic.P512()
func ECCGeneratePemPriKeyWithPass ¶
func ECCGeneratePemPriKeyWithPass(path, priFileName, passwd, pemType string, curve elliptic.Curve) error
ECCGeneratePemPriKeyWithPass 生成私钥
path 指定私钥所在生成目录
priFileName 指定生成的密钥名称
passwd 生成时输入的密码
curve 曲线生成类型,如 crypto.S256()/elliptic.P256()/elliptic.P384()/elliptic.P512()
func ECCGeneratePemPubKey ¶
func ECCGeneratePemPubKey(privateKey *ecdsa.PrivateKey, path, pubFileName, pemType string) error
ECCGeneratePemPubKey 生成公钥
path 指定公钥所在生成目录
func ECCGeneratePriKey ¶
ECCGeneratePriKey 生成私钥
path 指定私钥所在生成目录
priFileName 指定生成的密钥名称
curve 曲线生成类型,如 crypto.S256()/elliptic.P256()/elliptic.P384()/elliptic.P512()
func ECCGeneratePubKey ¶
func ECCGeneratePubKey(privateKey *ecdsa.PrivateKey, path, pubFileName string, curve elliptic.Curve) error
ECCGeneratePubKey 生成公钥
path 指定公钥所在生成目录
func ECCLoadPriPem ¶
func ECCLoadPriPem(privateKey []byte, pemType string) (*ecdsa.PrivateKey, error)
ECCLoadPriPem 解析私钥
privateKey 私钥内容,如取出字符串'priData',则传入'string(priData)'即可
func ECCLoadPriPemFP ¶
func ECCLoadPriPemFP(file, pemType string) (*ecdsa.PrivateKey, error)
ECCLoadPriPemFP 从文件中加载私钥
file 文件路径
func ECCLoadPriPemFPWithPass ¶
func ECCLoadPriPemFPWithPass(file, passwd, pemType string) (*ecdsa.PrivateKey, error)
ECCLoadPriPemFPWithPass 从文件中加载私钥
file 文件路径
passwd 生成privateKey时输入密码
func ECCLoadPriPemWithPass ¶
func ECCLoadPriPemWithPass(privateKey []byte, passwd, pemType string) (*ecdsa.PrivateKey, error)
ECCLoadPriPemWithPass 解析私钥
privateKey 私钥内容,如取出字符串'priData',则传入'string(priData)'即可
passwd 生成privateKey时输入密码
func ECCLoadPub ¶
ECCLoadPub 从文件中加载公钥
file 文件路径
curve 曲线生成类型,如 crypto.S256()/elliptic.P256()/elliptic.P384()/elliptic.P512()
func ECCPri2PemBytes ¶
func ECCPri2PemBytes(priPemType, passwd string, privateKey *ecdsa.PrivateKey) (data []byte, err error)
ECCPri2PemBytes ECCPri2PemBytes
func ECCPriKey2Bytes ¶
func ECCPriKey2Bytes(privateKey *ecdsa.PrivateKey) []byte
ECCPriKey2Bytes 私钥转[]byte
func ECCPub2PemBytes ¶
ECCPub2PemBytes ECCPub2PemBytes
func ECCPubKey2Bytes ¶
ECCPubKey2Bytes 公钥转[]byte
pub 公钥
curve 曲线生成类型,如 crypto.S256()/elliptic.P256()/elliptic.P384()/elliptic.P512()
func ECCSavePri ¶
func ECCSavePri(file string, privateKey *ecdsa.PrivateKey) error
ECCSavePri 将私钥保存到给定文件,密钥数据保存为hex编码
func ECCSavePriPem ¶
func ECCSavePriPem(privateKey *ecdsa.PrivateKey, path, fileName, pemType string) error
ECCSavePriPem 将私钥保存到给定文件
func ECCSavePriPemWithPass ¶
func ECCSavePriPemWithPass(privateKey *ecdsa.PrivateKey, passwd, path, fileName, pemType string) error
ECCSavePriPemWithPass 将私钥保存到给定文件
func ECCSavePub ¶
ECCSavePub 将公钥保存到给定文件,密钥数据保存为hex编码
file 文件路径
curve 曲线生成类型,如 crypto.S256()/elliptic.P256()/elliptic.P384()/elliptic.P512()
func ECCSign ¶
func ECCSign(privateKey *ecdsa.PrivateKey, data []byte) (sign []byte, err error)
ECCSign 签名
func FileAppend ¶
FileAppend 追加内容到文件中
filePath 文件地址
data 内容
force 如果文件已存在,会将文件清空
It returns the number of bytes written and an error
func FileCompressTar ¶
FileCompressTar 压缩文件 files 文件数组,可以是不同dir下的文件或者文件夹 dest 压缩文件存放地址
func FileCompressZip ¶
FileCompressZip 压缩文件 files 文件数组,可以是不同dir下的文件或者文件夹 dest 压缩文件存放地址
func FileLoopFileNames ¶
FileLoopFileNames 遍历文件夹及子文件夹下的所有文件名
func FileLoopFiles ¶
FileLoopFiles 遍历文件夹及子文件夹下的所有文件
func FileLoopOneDirs ¶
FileLoopOneDirs 遍历文件夹下一层的所有子文件夹
func FileModify ¶
FileModify 修改文件中指定位置的内容
filePath 文件地址
offset 以0为起始坐标的偏移量
data 内容
force 如果文件已存在,会将文件清空
It returns the number of bytes written and an error
func FileReadFirstLine ¶
FileReadFirstLine 从文件中读取第一行并返回字符串数组
func FileReadLines ¶
FileReadLines 从文件中逐行读取并返回字符串数组
func FileReadPointLine ¶
FileReadPointLine 从文件中读取指定行并返回字符串数组
func GRPCGetClientIP ¶
GRPCGetClientIP 取出gRPC客户端的ip地址和端口号
string form of address (for example, "192.0.2.1:25", "[2001:db8::1]:80")
func GRPCRequest ¶
GRPCRequest RPC 通过rpc进行通信 protoc --go_out=plugins=grpc:. grpc/proto/*.proto
func GRPCRequestPool ¶
GRPCRequestPool 通过rpc进行通信 protoc --go_out=plugins=grpc:. grpc/proto/*.proto
func GRPCRequestPools ¶
GRPCRequestPools 通过rpc进行通信 protoc --go_out=plugins=grpc:. grpc/proto/*.proto
func GRPCRequestSingleConn ¶
GRPCRequestSingleConn RPC 通过rpc进行通信 protoc --go_out=plugins=grpc:. grpc/proto/*.proto
func HTTPDeleteJSON ¶
HTTPDeleteJSON delete 请求
func HTTPDeleteJSONTLS ¶
func HTTPDeleteJSONTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPDeleteJSONTLS delete tls 请求
func HTTPDeleteJSONTLSBytes ¶
func HTTPDeleteJSONTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPDeleteJSONTLSBytes delete tls 请求
func HTTPDeleteMsgPack ¶
HTTPDeleteMsgPack delete 请求
func HTTPDeleteMsgPackTLS ¶
func HTTPDeleteMsgPackTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPDeleteMsgPackTLS delete tls 请求
func HTTPDeleteMsgPackTLSBytes ¶
func HTTPDeleteMsgPackTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPDeleteMsgPackTLSBytes delete tls 请求
func HTTPDeleteProtoBuf ¶
HTTPDeleteProtoBuf delete 请求
func HTTPDeleteProtoBufTLS ¶
func HTTPDeleteProtoBufTLS(url string, pm proto.Message, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPDeleteProtoBufTLS delete tls 请求
func HTTPDeleteProtoBufTLSBytes ¶
func HTTPDeleteProtoBufTLSBytes(url string, pm proto.Message, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPDeleteProtoBufTLSBytes delete tls 请求
content-type=application/x-protobuf
func HTTPDeleteTLS ¶
func HTTPDeleteTLS(url string, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPDeleteTLS delete tls 请求
func HTTPDeleteTLSBytes ¶
func HTTPDeleteTLSBytes(url string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPDeleteTLSBytes delete tls 请求
func HTTPDeleteXML ¶
HTTPDeleteXML delete 请求
func HTTPDeleteXMLTLS ¶
func HTTPDeleteXMLTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPDeleteXMLTLS delete tls 请求
func HTTPDeleteXMLTLSBytes ¶
func HTTPDeleteXMLTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPDeleteXMLTLSBytes delete tls 请求
func HTTPDeleteYaml ¶
HTTPDeleteYaml delete 请求
func HTTPDeleteYamlTLS ¶
func HTTPDeleteYamlTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPDeleteYamlTLS delete tls 请求
func HTTPDeleteYamlTLSBytes ¶
func HTTPDeleteYamlTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPDeleteYamlTLSBytes delete tls 请求
func HTTPDoTLSBytes ¶
func HTTPDoTLSBytes(req *http.Request, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPDoTLSBytes 处理 tls 请求
func HTTPGetHostTLSBytes ¶
func HTTPGetHostTLSBytes(url, host string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPGetHostTLSBytes get tls 请求
func HTTPGetTLS ¶
func HTTPGetTLS(url string, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPGetTLS get tls 请求
func HTTPGetTLSBytes ¶
func HTTPGetTLSBytes(url string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPGetTLSBytes get tls 请求
func HTTPPatchFormMultipart ¶
func HTTPPatchFormMultipart(url string, paramMap map[string]string, fileMap map[string]string) (resp *http.Response, err error)
HTTPPatchFormMultipart patch 请求
paramMap form普通参数
fileMap form附件key及附件路径
func HTTPPatchFormMultipartTLS ¶
func HTTPPatchFormMultipartTLS(url string, paramMap map[string]string, fileMap map[string]string, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPatchFormMultipartTLS patch tls 请求
paramMap form普通参数
fileMap form附件key及附件路径
func HTTPPatchFormMultipartTLSBytes ¶
func HTTPPatchFormMultipartTLSBytes(url string, paramMap map[string]string, fileMap map[string]string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPatchFormMultipartTLSBytes patch tls 请求
paramMap form普通参数
fileMap form附件key及附件路径
func HTTPPatchFormTLS ¶
func HTTPPatchFormTLS(url string, paramMap map[string]string, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPatchFormTLS patch tls 请求
paramMap form普通参数
fileMap form附件key及附件路径
func HTTPPatchFormTLSBytes ¶
func HTTPPatchFormTLSBytes(url string, paramMap map[string]string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPatchFormTLSBytes patch tls 请求
paramMap form普通参数
fileMap form附件key及附件路径
func HTTPPatchJSONTLS ¶
func HTTPPatchJSONTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPatchJSONTLS patch tls 请求
content-type=application/json
func HTTPPatchJSONTLSBytes ¶
func HTTPPatchJSONTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPatchJSONTLSBytes patch tls 请求
content-type=application/json
func HTTPPatchMsgPackTLS ¶
func HTTPPatchMsgPackTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPatchMsgPackTLS patch tls 请求
content-type=application/x-msgpack
func HTTPPatchMsgPackTLSBytes ¶
func HTTPPatchMsgPackTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPatchMsgPackTLSBytes patch tls 请求
content-type=application/x-msgpack
func HTTPPatchProtoBufTLS ¶
func HTTPPatchProtoBufTLS(url string, pm proto.Message, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPatchProtoBufTLS patch tls 请求
content-type=application/x-protobuf
func HTTPPatchProtoBufTLSBytes ¶
func HTTPPatchProtoBufTLSBytes(url string, pm proto.Message, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPatchProtoBufTLSBytes patch tls 请求
content-type=application/x-protobuf
func HTTPPatchXMLTLS ¶
func HTTPPatchXMLTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPatchXMLTLS patch tls 请求
content-type=application/xml
func HTTPPatchXMLTLSBytes ¶
func HTTPPatchXMLTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPatchXMLTLSBytes patch tls 请求
content-type=application/xml
func HTTPPatchYamlTLS ¶
func HTTPPatchYamlTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPatchYamlTLS patch tls 请求
content-type=application/x-yaml
func HTTPPatchYamlTLSBytes ¶
func HTTPPatchYamlTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPatchYamlTLSBytes patch tls 请求
content-type=application/x-yaml
func HTTPPostFormMultipart ¶
func HTTPPostFormMultipart(url string, paramMap map[string]string, fileMap map[string]string) (resp *http.Response, err error)
HTTPPostFormMultipart post 请求
paramMap form普通参数
fileMap form附件key及附件路径
func HTTPPostFormMultipartTLS ¶
func HTTPPostFormMultipartTLS(url string, paramMap map[string]string, fileMap map[string]string, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPostFormMultipartTLS post tls 请求
paramMap form普通参数
fileMap form附件key及附件路径
func HTTPPostFormMultipartTLSBytes ¶
func HTTPPostFormMultipartTLSBytes(url string, paramMap map[string]string, fileMap map[string]string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPostFormMultipartTLSBytes post tls 请求
paramMap form普通参数
fileMap form附件key及附件路径
func HTTPPostFormTLS ¶
func HTTPPostFormTLS(url string, paramMap map[string]string, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPostFormTLS post tls 请求
paramMap form普通参数
fileMap form附件key及附件路径
func HTTPPostFormTLSBytes ¶
func HTTPPostFormTLSBytes(url string, paramMap map[string]string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPostFormTLSBytes post tls 请求
paramMap form普通参数
fileMap form附件key及附件路径
func HTTPPostJSONTLS ¶
func HTTPPostJSONTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPostJSONTLS post tls 请求
content-type=application/json
func HTTPPostJSONTLSBytes ¶
func HTTPPostJSONTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPostJSONTLSBytes post tls 请求
content-type=application/json
func HTTPPostMsgPackTLS ¶
func HTTPPostMsgPackTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPostMsgPackTLS post tls 请求
content-type=application/x-msgpack
func HTTPPostMsgPackTLSBytes ¶
func HTTPPostMsgPackTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPostMsgPackTLSBytes post tls 请求
content-type=application/x-msgpack
func HTTPPostProtoBufTLS ¶
func HTTPPostProtoBufTLS(url string, pm proto.Message, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPostProtoBufTLS post tls 请求
content-type=application/x-protobuf
func HTTPPostProtoBufTLSBytes ¶
func HTTPPostProtoBufTLSBytes(url string, pm proto.Message, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPostProtoBufTLSBytes post tls 请求
content-type=application/x-protobuf
func HTTPPostXMLTLS ¶
func HTTPPostXMLTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPostXMLTLS post tls 请求
content-type=application/xml
func HTTPPostXMLTLSBytes ¶
func HTTPPostXMLTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPostXMLTLSBytes post tls 请求
content-type=application/xml
func HTTPPostYamlTLS ¶
func HTTPPostYamlTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPostYamlTLS post tls 请求
content-type=application/x-yaml
func HTTPPostYamlTLSBytes ¶
func HTTPPostYamlTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPostYamlTLSBytes post tls 请求
content-type=application/x-yaml
func HTTPPutFormMultipart ¶
func HTTPPutFormMultipart(url string, paramMap map[string]string, fileMap map[string]string) (resp *http.Response, err error)
HTTPPutFormMultipart put 请求
paramMap form普通参数
fileMap form附件key及附件路径
func HTTPPutFormMultipartTLS ¶
func HTTPPutFormMultipartTLS(url string, paramMap map[string]string, fileMap map[string]string, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPutFormMultipartTLS put tls 请求
paramMap form普通参数
fileMap form附件key及附件路径
func HTTPPutFormMultipartTLSBytes ¶
func HTTPPutFormMultipartTLSBytes(url string, paramMap map[string]string, fileMap map[string]string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPutFormMultipartTLSBytes put tls 请求
paramMap form普通参数
fileMap form附件key及附件路径
func HTTPPutFormTLS ¶
func HTTPPutFormTLS(url string, paramMap map[string]string, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPutFormTLS put tls 请求
paramMap form普通参数
fileMap form附件key及附件路径
func HTTPPutFormTLSBytes ¶
func HTTPPutFormTLSBytes(url string, paramMap map[string]string, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPutFormTLSBytes put tls 请求
paramMap form普通参数
fileMap form附件key及附件路径
func HTTPPutJSONTLS ¶
func HTTPPutJSONTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPutJSONTLS put tls 请求
content-type=application/json
func HTTPPutJSONTLSBytes ¶
func HTTPPutJSONTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPutJSONTLSBytes put tls 请求
content-type=application/json
func HTTPPutMsgPackTLS ¶
func HTTPPutMsgPackTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPutMsgPackTLS put tls 请求
content-type=application/x-msgpack
func HTTPPutMsgPackTLSBytes ¶
func HTTPPutMsgPackTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPutMsgPackTLSBytes put tls 请求
content-type=application/x-msgpack
func HTTPPutProtoBufTLS ¶
func HTTPPutProtoBufTLS(url string, pm proto.Message, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPutProtoBufTLS put tls 请求
content-type=application/x-protobuf
func HTTPPutProtoBufTLSBytes ¶
func HTTPPutProtoBufTLSBytes(url string, pm proto.Message, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPutProtoBufTLSBytes put tls 请求
content-type=application/x-protobuf
func HTTPPutXMLTLS ¶
func HTTPPutXMLTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPutXMLTLS put tls 请求
content-type=application/xml
func HTTPPutXMLTLSBytes ¶
func HTTPPutXMLTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPutXMLTLSBytes put tls 请求
content-type=application/xml
func HTTPPutYamlTLS ¶
func HTTPPutYamlTLS(url string, model interface{}, tlsConfig *HTTPTLSConfig) (resp *http.Response, err error)
HTTPPutYamlTLS put tls 请求
content-type=application/x-yaml
func HTTPPutYamlTLSBytes ¶
func HTTPPutYamlTLSBytes(url string, model interface{}, tlsConfig *HTTPTLSBytesConfig) (resp *http.Response, err error)
HTTPPutYamlTLSBytes put tls 请求
content-type=application/x-yaml
func JWTBuild ¶
func JWTBuild(method int, key interface{}, sub, iss, jti string, iat, nbf, exp int64) (string, error)
JWTBuild 创建一个 jwt token
"sub": "1", 该JWT所面向的用户
"iss": "http://localhost:8000/user/sign_up", 该JWT的签发者
"iat": 1451888119, 在什么时候签发的token
"exp": 1454516119, token什么时候过期
"nbf": 1451888119, token在此时间之前不能被接收处理
"jti": "37c107e4609ddbcc9c096ea5ee76c667" token提供唯一标识
func RSADecrypt ¶
RSADecrypt 私钥解密
privateKey 私钥内容,如取出字符串'priData',则传入'string(priData)'即可
data 待解密数据
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSADecryptFP ¶
RSADecryptFP 私钥解密
privateKeyFilePath 私钥地址
data 待解密数据
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSADecryptFPWithPass ¶
func RSADecryptFPWithPass(privateKeyFilePath, passwd, pemType string, data []byte, pks PKSCType) ([]byte, error)
RSADecryptFPWithPass 私钥解密
privateKeyFilePath 私钥地址
passwd 生成privateKey时输入密码
data 待解密数据
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSADecryptWithPass ¶
func RSADecryptWithPass(privateKey, data []byte, passwd, pemType string, pks PKSCType) ([]byte, error)
RSADecryptWithPass 私钥解密
privateKey 私钥内容,如取出字符串'priData',则传入'string(priData)'即可
data 待解密数据
passwd 生成privateKey时输入密码
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSAGenerateKey ¶
func RSAGenerateKey(bits int, path, priFileName, pubFileName, priPemType, pubPemType string, pks PKSCType) error
RSAGenerateKey RSA公钥私钥产生
bits 指定生成位大小
path 指定公私钥所在生成目录
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSAGenerateKeyPemBytes ¶
func RSAGenerateKeyPemBytes(bits int, priPemType, pubPemType, passwd string, pks PKSCType) (priBytes, pubBytes []byte, err error)
RSAGenerateKeyPemBytes RSA公钥私钥产生
bits 指定生成位大小
path 指定公私钥所在生成目录
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSAGenerateKeyWithPass ¶
func RSAGenerateKeyWithPass(bits int, path, priFileName, pubFileName, passwd, priPemType, pubPemType string, alg x509.PEMCipher, pks PKSCType) error
RSAGenerateKeyWithPass RSA公钥私钥产生
bits 指定生成位大小
path 指定公私钥所在生成目录
passwd 生成密码
alg der编码数据指定算法,如:x509.PEMCipher3DES
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSAGeneratePriKey ¶
func RSAGeneratePriKey(bits int, path, fileName, pemType string, pks PKSCType) (*rsa.PrivateKey, error)
RSAGeneratePriKey RSA私钥产生
bits 指定生成位大小
path 指定私钥所在生成目录
fileName 指定私钥的文件名称,如'private.pem'
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSAGeneratePriKeyWithPass ¶
func RSAGeneratePriKeyWithPass(bits int, path, fileName, passwd, pemType string, alg x509.PEMCipher, pks PKSCType) (*rsa.PrivateKey, error)
RSAGeneratePriKeyWithPass RSA私钥产生
bits 指定生成位大小
path 指定私钥所在生成目录
fileName 指定私钥的文件名称,如'private.pem'
passwd 生成密码
alg der编码数据指定算法,如:x509.PEMCipher3DES
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSAGeneratePubKey ¶
func RSAGeneratePubKey(privateKey *rsa.PrivateKey, path, fileName, pemType string) error
RSAGeneratePubKey RSA公钥产生
privateKey 私钥
path 指定公私钥所在生成目录
fileName 指定公钥的文件名称,如'public.pem'
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSAGeneratePubKeyBytes ¶
func RSAGeneratePubKeyBytes(privateKey []byte, path, fileName, priPemType, pubPemType string, pks PKSCType) error
RSAGeneratePubKeyBytes RSA公钥产生
privateKey 私钥内容,如取出字符串'priData',则传入'string(priData)'即可
path 指定公私钥所在生成目录
fileName 指定公钥的文件名称,如'public.pem'
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSAGeneratePubKeyBytesWithPass ¶
func RSAGeneratePubKeyBytesWithPass(privateKey []byte, passwd, path, fileName, priPemType, pubPemType string, pks PKSCType) error
RSAGeneratePubKeyBytesWithPass RSA公钥产生
privateKey 私钥内容,如取出字符串'priData',则传入'string(priData)'即可
passwd 生成privateKey时输入密码
path 指定公私钥所在生成目录
fileName 指定公钥的文件名称,如'public.pem'
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSAGeneratePubKeyFP ¶
func RSAGeneratePubKeyFP(privateKeyFilePath, path, fileName, priPemType, pubPemType string, pks PKSCType) error
RSAGeneratePubKeyFP RSA公钥产生
privateKeyFilePath 私钥地址
path 指定公私钥所在生成目录
fileName 指定公钥的文件名称,如'public.pem'
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSAGeneratePubKeyFPWithPass ¶
func RSAGeneratePubKeyFPWithPass(privateKeyFilePath, passwd, path, fileName, priPemType, pubPemType string, pks PKSCType) error
RSAGeneratePubKeyFPWithPass RSA公钥产生
privateKeyFilePath 私钥地址
passwd 生成privateKey时输入密码
path 指定公私钥所在生成目录
fileName 指定公钥的文件名称,如'public.pem'
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSALoadPri ¶
RSALoadPri 解析私钥
privateKey 私钥内容,如取出字符串'priData',则传入'string(priData)'即可
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSALoadPriFP ¶
func RSALoadPriFP(privateKeyFilePath, pemType string, pks PKSCType) (*rsa.PrivateKey, error)
RSALoadPriFP 加载私钥
privateKeyFilePath 私钥地址
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSALoadPriFPWithPass ¶
func RSALoadPriFPWithPass(privateKeyFilePath, passwd, pemType string, pks PKSCType) (*rsa.PrivateKey, error)
RSALoadPriFPWithPass 加载私钥
privateKeyFilePath 私钥地址
passwd 生成privateKey时输入密码
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSALoadPriWithPass ¶
func RSALoadPriWithPass(privateKey []byte, passwd, pemType string, pks PKSCType) (*rsa.PrivateKey, error)
RSALoadPriWithPass 解析私钥
privateKey 私钥内容,如取出字符串'priData',则传入'string(priData)'即可
passwd 生成privateKey时输入密码
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSAPri2PemBytes ¶
func RSAPri2PemBytes(priPemType, passwd string, privateKey *rsa.PrivateKey, pks PKSCType) (data []byte, err error)
RSAPri2PemBytes RSAPri2PemBytes
func RSAPub2PemBytes ¶
RSAPub2PemBytes RSAPub2PemBytes
func RSASavePriPem ¶
func RSASavePriPem(privateKey *rsa.PrivateKey, path, fileName, pemType string, alg x509.PEMCipher, pks PKSCType) error
RSASavePriPem 将私钥保存到给定文件
alg der编码数据指定算法,如:x509.PEMCipher3DES
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSASavePriPemWithPass ¶
func RSASavePriPemWithPass(privateKey *rsa.PrivateKey, path, fileName, passwd, pemType string, alg x509.PEMCipher, pks PKSCType) error
RSASavePriPemWithPass 将私钥保存到给定文件
alg der编码数据指定算法,如:x509.PEMCipher3DES
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
func RSASign ¶
func RSASign(privateKey, data []byte, pemType string, hash crypto.Hash, pks PKSCType, mod SignMode) ([]byte, error)
RSASign 签名:采用RSA-PKCS#1 v1.5模式
privateKey 私钥内容,如取出字符串'priData',则传入'string(priData)'即可
data 待签名数据
hash 算法,如 crypto.SHA1/crypto.SHA256等
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
mod RSA签名模式,默认提供PSS和PKCS1v15,通过调用‘CryptoRSA().SignPSS()’和‘CryptoRSA().SignPKCS()’方法赋值
func RSASignFP ¶
func RSASignFP(privateKeyPath, pemType string, data []byte, hash crypto.Hash, pks PKSCType, mod SignMode) ([]byte, error)
RSASignFP 签名:采用RSA-PKCS#1 v1.5模式
privateKeyPath 私钥文件存储路径
data 待签名数据
hash 算法,如 crypto.SHA1/crypto.SHA256等
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
mod RSA签名模式,默认提供PSS和PKCS1v15,通过调用‘CryptoRSA().SignPSS()’和‘CryptoRSA().SignPKCS()’方法赋值
func RSASignFPWithPass ¶
func RSASignFPWithPass(privateKeyPath, passwd, pemType string, data []byte, hash crypto.Hash, pks PKSCType, mod SignMode) ([]byte, error)
RSASignFPWithPass 签名:采用RSA-PKCS#1 v1.5模式
privateKeyPath 私钥文件存储路径
passwd 生成privateKey时输入密码
data 待签名数据
hash 算法,如 crypto.SHA1/crypto.SHA256等
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
mod RSA签名模式,默认提供PSS和PKCS1v15,通过调用‘CryptoRSA().SignPSS()’和‘CryptoRSA().SignPKCS()’方法赋值
func RSASignWithPass ¶
func RSASignWithPass(privateKey, data []byte, passwd, pemType string, hash crypto.Hash, pks PKSCType, mod SignMode) ([]byte, error)
RSASignWithPass 签名:采用RSA-PKCS#1 v1.5模式
privateKey 私钥内容,如取出字符串'priData',则传入'string(priData)'即可
data 待签名数据
passwd 生成privateKey时输入密码
hash 算法,如 crypto.SHA1/crypto.SHA256等
pks 私钥格式,默认提供PKCS1和PKCS8,通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
mod RSA签名模式,默认提供PSS和PKCS1v15,通过调用‘CryptoRSA().SignPSS()’和‘CryptoRSA().SignPKCS()’方法赋值
func RSAVerify ¶
func RSAVerify(publicKey, data, signData []byte, pemType string, hash crypto.Hash, mod SignMode) error
RSAVerify 验签:采用RSA-PKCS#1 v1.5模式
publicKey 公钥内容,如取出字符串'pubData',则传入'string(pubData)'即可
data 待签名数据
hash 算法,如 crypto.SHA1/crypto.SHA256等
mod RSA签名模式,默认提供PSS和PKCS1v15,通过调用‘CryptoRSA().SignPSS()’和‘CryptoRSA().SignPKCS()’方法赋值
func RSAVerifyFP ¶
func RSAVerifyFP(publicKeyPath, pemType string, data, signData []byte, hash crypto.Hash, mod SignMode) error
RSAVerifyFP 验签:采用RSA-PKCS#1 v1.5模式
publicKeyPath 公钥文件存储路径
data 待签名数据
hash 算法,如 crypto.SHA1/crypto.SHA256等
mod RSA签名模式,默认提供PSS和PKCS1v15,通过调用‘CryptoRSA().SignPSS()’和‘CryptoRSA().SignPKCS()’方法赋值
func SM2Generate ¶
func SM2Generate() (pri *sm2.PrivateKey, pub *sm2.PublicKey, err error)
SM2Generate SM2公钥私钥产生
path 指定公私钥所在生成目录
func SM2GeneratePemBytes ¶
func SM2GeneratePemBytes(priPemType, pubPemType, passwd string) (priBytes, pubBytes []byte, err error)
SM2GeneratePemBytes SM2公钥私钥产生
func SM2Pri2PemBytes ¶
func SM2Pri2PemBytes(priPemType, passwd string, pri *sm2.PrivateKey) (data []byte, err error)
SM2Pri2PemBytes SM2Pri2Bytes
func SM2Pub2PemBytes ¶
SM2Pub2PemBytes SM2Pub2PemBytes
func ScaleDDuoStringToInt64 ¶
ScaleDDuoStringToInt64 int字符串转int
func ScaleDDuoStringToUint64 ¶
ScaleDDuoStringToUint64 int字符串转int
func ScaleDuoStringToInt64 ¶
ScaleDuoStringToInt64 int字符串转int
func ScaleDuoStringToUint64 ¶
ScaleDuoStringToUint64 int字符串转int
func ScaleFloat64toInt64 ¶
ScaleFloat64toInt64 将float64转成精确的int64
func ScaleHexStringToInt64 ¶
ScaleHexStringToInt64 int字符串转int
func ScaleHexStringToUint64 ¶
ScaleHexStringToUint64 int字符串转int
func ScaleInt32ToDDuoString ¶
ScaleInt32ToDDuoString int32转十六进制字符串
func ScaleInt32ToDuoString ¶
ScaleInt32ToDuoString int32转十六进制字符串
func ScaleInt32ToHexString ¶
ScaleInt32ToHexString int32转十六进制字符串
func ScaleInt64ToDDuoString ¶
ScaleInt64ToDDuoString int64转十六进制字符串
func ScaleInt64ToDuoString ¶
ScaleInt64ToDuoString int64转十六进制字符串
func ScaleInt64ToHexString ¶
ScaleInt64ToHexString int64转十六进制字符串
func ScaleInt64toFloat64 ¶
ScaleInt64toFloat64 将int64恢复成正常的float64
func ScaleIntToDDuoString ¶
ScaleIntToDDuoString int转64进制字符串
func ScaleUint32ToDDuoString ¶
ScaleUint32ToDDuoString uint32转十六进制字符串
func ScaleUint32ToDuoString ¶
ScaleUint32ToDuoString uint32转十六进制字符串
func ScaleUint32ToHexString ¶
ScaleUint32ToHexString uint32转十六进制字符串
func ScaleUint32toFullState ¶
ScaleUint32toFullState 补全不满十位数状态,如1->0000000001、34->0000000034、215->0000000215
func ScaleUint64ToDDuoString ¶
ScaleUint64ToDDuoString uint64转十六进制字符串
func ScaleUint64ToDuoString ¶
ScaleUint64ToDuoString uint64转十六进制字符串
func ScaleUint64ToHexString ¶
ScaleUint64ToHexString uint64转十六进制字符串
func ScaleUint8toFullState ¶
ScaleUint8toFullState 补全不满三位数状态,如1->001、34->034、215->215
func ScaleUintToDDuoString ¶
ScaleUintToDDuoString int转64进制字符串
func ScaleUintToDuoString ¶
ScaleUintToDuoString uint转十六进制字符串
func ScaleUintToHexString ¶
ScaleUintToHexString uint转十六进制字符串
func String2Timestamp ¶
String2Timestamp 字符串转时间戳
date 待转换时间字符串 如:2019/09/17 10:16:56
format 时间字符串格式化类型 如:2006/01/02 15:04:05
zone 时区 如:time.Local / time.UTC
func StringBuildSep ¶
StringBuildSep 拼接字符串
func StringConvert ¶
StringConvert 下划线转换,首字母小写变大写, 下划线去掉并将下划线后的首字母大写
func StringPrefixSupplementZero ¶
StringPrefixSupplementZero 当字符串长度不满足时,将字符串前几位补充0
str 字符串内容
offset 字符串期望的长度
func StringSingleSpace ¶
StringSingleSpace 将字符串内所有连续空格替换为单个空格
func StringSingleValue ¶
StringSingleValue 将字符串内所有连续value替换为单个value
func Timestamp2String ¶
Timestamp2String 时间戳转字符串
timestampSec 时间戳秒值
timestampNSec 时间戳纳秒值
format 时间字符串格式化类型 如:2006/01/02 15:04:05
Types ¶
type CertRequest ¶
type CertRequest struct { PrivateKeyData []byte // privateKeyData 私钥字节数组 CertificateRequestFilePath string // certificateFilePath 指定生成的证书签名请求文件路径,如'/etc/rootCA.csr' SignatureAlgorithm x509.SignatureAlgorithm // signatureAlgorithm 生成证书时候采用的签名算法 Subject pkix.Name // Subject 签名信息 DNSNames []string // DNSNames DNS限制 EmailAddresses []string // EmailAddresses 邮箱地址限制 IPAddresses []net.IP // IPAddresses IP地址限制 URIs []*url.URL // URIs URL地址限制 }
CertRequest 证书生成请求对象
type CertRequestFP ¶
type CertRequestFP struct { PrivateKeyFilePath string // privateKeyFilePath 私钥文件存储路径 CertificateRequestFilePath string // certificateFilePath 指定生成的证书签名请求文件路径,如'/etc/rootCA.csr' SignatureAlgorithm x509.SignatureAlgorithm // signatureAlgorithm 生成证书时候采用的签名算法 Subject pkix.Name // Subject 签名信息 DNSNames []string // DNSNames DNS限制 EmailAddresses []string // EmailAddresses 邮箱地址限制 IPAddresses []net.IP // IPAddresses IP地址限制 URIs []*url.URL // URIs URL地址限制 }
CertRequestFP 证书生成请求对象
type CertRequestModel ¶
type CertRequestModel struct { PrivateKey crypto.Signer // privateKey 私钥字节数组 CertificateRequestFilePath string // certificateFilePath 指定生成的证书签名请求文件路径,如'/etc/rootCA.csr' Template *x509.CertificateRequest // template 生成证书时候采用的请求模板 }
CertRequestModel 证书生成请求对象
type CertSelf ¶
type CertSelf struct { CertificateFilePath string // 签名后数字证书文件存储路径 Subject pkix.Name // Subject 签名信息 ParentPrivateKey, PublicKey interface{} // 公私钥 BasicConstraintsValid bool // 基本的有效性约束 IsCA bool // 是否是根证书 NotBeforeDays, NotAfterDays time.Time // 在指定时间之后生效及之前失效 ExtKeyUsage []x509.ExtKeyUsage // ExtKeyUsage表示对给定键有效的扩展操作集。每个ExtKeyUsage*常量定义一个惟一的操作。 KeyUsage x509.KeyUsage // KeyUsage表示对给定密钥有效的操作集。它是KeyUsage*常量的位图。 SignatureAlgorithm x509.SignatureAlgorithm // signatureAlgorithm 生成证书时候采用的签名算法 DNSNames []string // DNSNames DNS限制 EmailAddresses []string // EmailAddresses 邮箱地址限制 IPAddresses []net.IP // IPAddresses IP地址限制 URIs []*url.URL // URIs URL地址限制 }
CertSelf 自签名数字证书对象
type CommandAsync ¶
CommandAsync 异步命令执行归属通道对象
type Field ¶
type Field struct { Name string // 参数名 Value reflect.Value // 参数值 Tag string // 参数标签 Kind reflect.Kind // 参数类型 Fields []*Field // 自身作为根结构体信息 }
Field 上一结构体所属参数信息
type HTTPTLSBytesConfig ¶
type HTTPTLSBytesConfig struct { RootCrtBytes []byte // 服务端根证书,用于我方验证对方证书合法性 CertBytes []byte // 服务端签发的子证书,用于对方验证我方证书合法性 KeyBytes []byte // 客户端私钥,用于对方验证我方证书合法性 InsecureSkipVerify bool // 是否验证服务端证书,即双向认证 }
HTTPTLSBytesConfig http tls 请求配置
type HTTPTLSConfig ¶
type HTTPTLSConfig struct { RootCrtFilePath string // 服务端根证书,用于我方验证对方证书合法性 CertFilePath string // 服务端签发的子证书,用于对方验证我方证书合法性 KeyFilePath string // 客户端私钥,用于对方验证我方证书合法性 InsecureSkipVerify bool // 是否验证服务端证书,即双向认证 }
HTTPTLSConfig http tls 请求配置
type PKSCType ¶
type PKSCType string
PKSCType 私钥格式,默认提供PKCS1和PKCS8
通过调用‘CryptoRSA().PKSC1()’和‘CryptoRSA().PKSC8()’方法赋值
type Pond ¶
Pond 连接池对象
type Schema ¶
type Schema struct { Model interface{} Name string // 结构体名称 Fields []*Field // contains filtered or unexported fields }
Schema 根结构体信息