fix: mod package
This commit is contained in:
parent
dfafd87235
commit
18e1338125
14
go.mod
14
go.mod
|
@ -4,29 +4,19 @@ go 1.15
|
|||
|
||||
require (
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
|
||||
github.com/beego/beego/v2 v2.0.1
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/fsnotify/fsnotify v1.4.9
|
||||
github.com/gin-gonic/gin v1.6.3
|
||||
github.com/go-openapi/spec v0.20.3 // indirect
|
||||
github.com/go-redis/redis v6.15.9+incompatible
|
||||
github.com/golang/protobuf v1.4.3 // indirect
|
||||
github.com/google/go-cmp v0.5.4 // indirect
|
||||
github.com/google/uuid v1.2.0
|
||||
github.com/jinzhu/gorm v1.9.16
|
||||
github.com/leodido/go-urn v1.2.1 // indirect
|
||||
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
|
||||
github.com/lestrrat-go/strftime v1.0.4 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/onsi/ginkgo v1.15.2 // indirect
|
||||
github.com/onsi/gomega v1.11.0 // indirect
|
||||
github.com/spf13/viper v1.7.1
|
||||
github.com/swaggo/gin-swagger v1.3.0
|
||||
github.com/swaggo/swag v1.7.0
|
||||
go.uber.org/zap v1.15.0
|
||||
golang.org/x/mod v0.4.1 // indirect
|
||||
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 // indirect
|
||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 // indirect
|
||||
golang.org/x/tools v0.1.0 // indirect
|
||||
google.golang.org/protobuf v1.25.0 // indirect
|
||||
gopkg.in/go-playground/validator.v9 v9.31.0
|
||||
gopkg.in/ini.v1 v1.62.0 // indirect
|
||||
)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* @Date: 2021-03-11 17:03:16
|
||||
* @LastEditors: viletyy
|
||||
* @LastEditTime: 2021-03-11 17:42:16
|
||||
* @FilePath: /hello/util/crypt/aes.go
|
||||
* @LastEditTime: 2021-03-25 14:46:17
|
||||
* @FilePath: /potato/utils/crypt/aes.go
|
||||
*/
|
||||
package crypt
|
||||
|
||||
|
@ -13,7 +13,7 @@ import (
|
|||
"encoding/base64"
|
||||
"fmt"
|
||||
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
"github.com/viletyy/potato/global"
|
||||
)
|
||||
|
||||
/*
|
||||
|
@ -38,7 +38,7 @@ func AesEncrypt(orig string, key string) string {
|
|||
// 分组密钥
|
||||
block, err := aes.NewCipher(k)
|
||||
if err != nil {
|
||||
logs.Error(fmt.Sprintf("key 长度必须 16/24/32长度:%s", err.Error()))
|
||||
global.GO_LOG.Error(fmt.Sprintf("key 长度必须 16/24/32长度:%s", err.Error()))
|
||||
}
|
||||
// 获取密钥块的长度
|
||||
blockSize := block.BlockSize()
|
||||
|
@ -65,7 +65,7 @@ func AesDecrypt(cryted string, key string) string {
|
|||
// 分组密钥
|
||||
block, err := aes.NewCipher(k)
|
||||
if err != nil {
|
||||
logs.Error(fmt.Sprintf("key 长度必须 16/24/32长度:%s", err.Error()))
|
||||
global.GO_LOG.Error(fmt.Sprintf("key 长度必须 16/24/32长度:%s", err.Error()))
|
||||
}
|
||||
// 获取密钥块的长度
|
||||
blockSize := block.BlockSize()
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* @Date: 2021-03-11 18:02:34
|
||||
* @LastEditors: viletyy
|
||||
* @LastEditTime: 2021-03-11 18:06:05
|
||||
* @FilePath: /hello/util/crypt/key_pairs.go
|
||||
* @LastEditTime: 2021-03-25 14:47:39
|
||||
* @FilePath: /potato/utils/crypt/key_pairs.go
|
||||
*/
|
||||
package crypt
|
||||
|
||||
|
@ -14,7 +14,8 @@ import (
|
|||
"encoding/pem"
|
||||
"os"
|
||||
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
"github.com/viletyy/potato/global"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// ecdsaCmd represents the doc command
|
||||
|
@ -23,26 +24,26 @@ func KeyPairs(keyName string) {
|
|||
|
||||
privateKey, err := ecdsa.GenerateKey(elliptic.P521(), rand.Reader)
|
||||
if err != nil {
|
||||
logs.Error("Genera KeyPairs Error: %v", err)
|
||||
global.GO_LOG.Error("Genera KeyPairs Error:", zap.Any("err", err))
|
||||
}
|
||||
x509Encoded, _ := x509.MarshalECPrivateKey(privateKey)
|
||||
privateBs := pem.EncodeToMemory(&pem.Block{Type: "PRIVATE KEY", Bytes: x509Encoded})
|
||||
privateFile, err := os.Create(keyName + ".private.pem")
|
||||
if err != nil {
|
||||
logs.Error("Genera KeyPairs Error: %v", err)
|
||||
global.GO_LOG.Error("Genera KeyPairs Error:", zap.Any("err", err))
|
||||
}
|
||||
_, err = privateFile.Write(privateBs)
|
||||
if err != nil {
|
||||
logs.Error("Genera KeyPairs Error: %v", err)
|
||||
global.GO_LOG.Error("Genera KeyPairs Error:", zap.Any("err", err))
|
||||
}
|
||||
x509EncodedPub, _ := x509.MarshalPKIXPublicKey(privateKey.Public())
|
||||
publicBs := pem.EncodeToMemory(&pem.Block{Type: "PUBLIC KEY", Bytes: x509EncodedPub})
|
||||
publicKeyFile, err := os.Create(keyName + ".public.pem")
|
||||
if err != nil {
|
||||
logs.Error("Genera KeyPairs Error: %v", err)
|
||||
global.GO_LOG.Error("Genera KeyPairs Error:", zap.Any("err", err))
|
||||
}
|
||||
_, err = publicKeyFile.Write(publicBs)
|
||||
if err != nil {
|
||||
logs.Error("Genera KeyPairs Error: %v", err)
|
||||
global.GO_LOG.Error("Genera KeyPairs Error:", zap.Any("err", err))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue