合并分支 'test' 到 'master'
Test 查看合并请求 !4
正在显示
11 个修改的文件
包含
107 行增加
和
43 行删除
| @@ -103,6 +103,8 @@ spec: | @@ -103,6 +103,8 @@ spec: | ||
| 103 | value: "false" | 103 | value: "false" |
| 104 | - name: HTTP_PORT | 104 | - name: HTTP_PORT |
| 105 | value: "8082" | 105 | value: "8082" |
| 106 | + - name: ALLIED_CREATION_GATEWAY_HOST | ||
| 107 | + value: "https://allied-creation-gateway-dev.fjmaimaimai.com" | ||
| 106 | - name: ALLIED_CREATION_USER_HOST | 108 | - name: ALLIED_CREATION_USER_HOST |
| 107 | value: "http://allied-creation-user-dev.fjmaimaimai.com" | 109 | value: "http://allied-creation-user-dev.fjmaimaimai.com" |
| 108 | - name: ALLIED_CREATION_COOPERATION_HOST | 110 | - name: ALLIED_CREATION_COOPERATION_HOST |
| @@ -107,6 +107,8 @@ spec: | @@ -107,6 +107,8 @@ spec: | ||
| 107 | value: "false" | 107 | value: "false" |
| 108 | - name: HTTP_PORT | 108 | - name: HTTP_PORT |
| 109 | value: "8082" | 109 | value: "8082" |
| 110 | + - name: ALLIED_CREATION_GATEWAY_HOST | ||
| 111 | + value: "https://allied-creation-gateway-test.fjmaimaimai.com" | ||
| 110 | - name: ALLIED_CREATION_USER_HOST | 112 | - name: ALLIED_CREATION_USER_HOST |
| 111 | value: "https://allied-creation-user-test.fjmaimaimai.com" | 113 | value: "https://allied-creation-user-test.fjmaimaimai.com" |
| 112 | - name: ALLIED_CREATION_COOPERATION_HOST | 114 | - name: ALLIED_CREATION_COOPERATION_HOST |
| @@ -6,6 +6,7 @@ require ( | @@ -6,6 +6,7 @@ require ( | ||
| 6 | github.com/GeeTeam/gt3-golang-sdk v0.0.0-20200116043922-446ca8a507d2 | 6 | github.com/GeeTeam/gt3-golang-sdk v0.0.0-20200116043922-446ca8a507d2 |
| 7 | github.com/beego/beego/v2 v2.0.1 | 7 | github.com/beego/beego/v2 v2.0.1 |
| 8 | github.com/dgrijalva/jwt-go v3.2.0+incompatible | 8 | github.com/dgrijalva/jwt-go v3.2.0+incompatible |
| 9 | + github.com/forgoer/openssl v0.0.0-20210828150411-6c5378b5b719 // indirect | ||
| 9 | github.com/go-pg/pg/v10 v10.10.1 | 10 | github.com/go-pg/pg/v10 v10.10.1 |
| 10 | github.com/go-redis/redis v6.14.2+incompatible | 11 | github.com/go-redis/redis v6.14.2+incompatible |
| 11 | github.com/google/uuid v1.1.1 | 12 | github.com/google/uuid v1.1.1 |
| @@ -54,6 +54,8 @@ github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3C | @@ -54,6 +54,8 @@ github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3C | ||
| 54 | github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= | 54 | github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= |
| 55 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= | 55 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= |
| 56 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= | 56 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= |
| 57 | +github.com/forgoer/openssl v0.0.0-20210828150411-6c5378b5b719 h1:sBIoJbXC+QBD9kL00aAxi7dfJJ70YHhiKzSN9yeTjbU= | ||
| 58 | +github.com/forgoer/openssl v0.0.0-20210828150411-6c5378b5b719/go.mod h1:NMVFOzYeLVR7UiGTxsa+A21nrERTZ3Rv2JHDPcJpDyI= | ||
| 57 | github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= | 59 | github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= |
| 58 | github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= | 60 | github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= |
| 59 | github.com/frankban/quicktest v1.4.1 h1:Wv2VwvNn73pAdFIVUQRXYDFp31lXKbqblIXo/Q5GPSg= | 61 | github.com/frankban/quicktest v1.4.1 h1:Wv2VwvNn73pAdFIVUQRXYDFp31lXKbqblIXo/Q5GPSg= |
| @@ -139,7 +139,7 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer | @@ -139,7 +139,7 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer | ||
| 139 | // 分红支出 | 139 | // 分红支出 |
| 140 | DividendsIncome float64 `json:"dividendsIncome"` | 140 | DividendsIncome float64 `json:"dividendsIncome"` |
| 141 | // 企业信息 | 141 | // 企业信息 |
| 142 | - Company domain.CompanyData `json:"company"` | 142 | + Company domain.Company `json:"company"` |
| 143 | } | 143 | } |
| 144 | var cooperationCompanyStatisticsResponses []cooperationCompanyStatisticsResponse | 144 | var cooperationCompanyStatisticsResponses []cooperationCompanyStatisticsResponse |
| 145 | if err := json.UnmarshalFromString(json.MarshalToString(result), &cooperationCompanyStatisticsResponses); err != nil { | 145 | if err := json.UnmarshalFromString(json.MarshalToString(result), &cooperationCompanyStatisticsResponses); err != nil { |
| @@ -152,10 +152,10 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer | @@ -152,10 +152,10 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer | ||
| 152 | var values = make([]interface{}, 0) | 152 | var values = make([]interface{}, 0) |
| 153 | for i := range users.Users { | 153 | for i := range users.Users { |
| 154 | user := users.Users[i] | 154 | user := users.Users[i] |
| 155 | - cooperationCompanyStatisticsResponses[i].Company = domain.CompanyData{ | 155 | + cooperationCompanyStatisticsResponses[i].Company = domain.Company{ |
| 156 | CompanyID: user.Org.OrgId, | 156 | CompanyID: user.Org.OrgId, |
| 157 | CompanyName: user.Org.OrgName, | 157 | CompanyName: user.Org.OrgName, |
| 158 | - CompanyLogo: user.Company.Logo, | 158 | + Logo: user.Company.Logo, |
| 159 | } | 159 | } |
| 160 | values = append(values, cooperationCompanyStatisticsResponses[i]) | 160 | values = append(values, cooperationCompanyStatisticsResponses[i]) |
| 161 | } | 161 | } |
| @@ -70,12 +70,12 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec | @@ -70,12 +70,12 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec | ||
| 70 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 70 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 71 | } | 71 | } |
| 72 | resultApplication, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{ | 72 | resultApplication, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{ |
| 73 | - CooperationProjectNumber: resultProject.CooperationProject.CooperationProjectNumber, | ||
| 74 | - PageNumber: 0, | ||
| 75 | - PageSize: 0, | ||
| 76 | - CompanyId: resultProject.Company.CompanyId, | ||
| 77 | - OrgId: int64(resultProject.Org.OrgId), | ||
| 78 | - CooperationApplicationStatus: 2, //审核通过的 | 73 | + CooperationProjectNumber: resultProject.CooperationProject.CooperationProjectNumber, |
| 74 | + PageNumber: 0, | ||
| 75 | + PageSize: 0, | ||
| 76 | + CompanyId: resultProject.Company.CompanyId, | ||
| 77 | + OrgId: int64(resultProject.Org.OrgId), | ||
| 78 | + //CooperationApplicationStatus: 2, //审核通过的 | ||
| 79 | }) | 79 | }) |
| 80 | if err != nil { | 80 | if err != nil { |
| 81 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 81 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| @@ -8,12 +8,13 @@ import ( | @@ -8,12 +8,13 @@ import ( | ||
| 8 | const SERVICE_NAME = "allied-creation-gateway" | 8 | const SERVICE_NAME = "allied-creation-gateway" |
| 9 | 9 | ||
| 10 | var LOG_LEVEL = "debug" | 10 | var LOG_LEVEL = "debug" |
| 11 | -var LOG_TYPE = "console"// file, console, es | 11 | +var LOG_TYPE = "console" // file, console, es |
| 12 | var LOG_FRAMEWORK = "beego" // beego logrus | 12 | var LOG_FRAMEWORK = "beego" // beego logrus |
| 13 | var LOG_FILE = "app.log" | 13 | var LOG_FILE = "app.log" |
| 14 | var LOG_PREFIX = "[allied-creation-gateway]" | 14 | var LOG_PREFIX = "[allied-creation-gateway]" |
| 15 | 15 | ||
| 16 | var HTTP_PORT int = 8083 | 16 | var HTTP_PORT int = 8083 |
| 17 | +var ALLIED_CREATION_GATEWAY_HOST = "https://allied-creation-gateway-dev.fjmaimaimai.com" | ||
| 17 | 18 | ||
| 18 | //天联共创基础模块 | 19 | //天联共创基础模块 |
| 19 | var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080" //"http://allied-creation-basic-dev.fjmaimaimai.com" | 20 | var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080" //"http://allied-creation-basic-dev.fjmaimaimai.com" |
| @@ -37,6 +38,9 @@ func init() { | @@ -37,6 +38,9 @@ func init() { | ||
| 37 | if os.Getenv("LOG_TYPE") != "" { | 38 | if os.Getenv("LOG_TYPE") != "" { |
| 38 | LOG_TYPE = os.Getenv("LOG_TYPE") | 39 | LOG_TYPE = os.Getenv("LOG_TYPE") |
| 39 | } | 40 | } |
| 41 | + if os.Getenv("ALLIED_CREATION_GATEWAY_HOST") != "" { | ||
| 42 | + ALLIED_CREATION_GATEWAY_HOST = os.Getenv("ALLIED_CREATION_GATEWAY_HOST") | ||
| 43 | + } | ||
| 40 | if os.Getenv("ALLIED_CREATION_BASIC_HOST") != "" { | 44 | if os.Getenv("ALLIED_CREATION_BASIC_HOST") != "" { |
| 41 | ALLIED_CREATION_BASIC_HOST = os.Getenv("ALLIED_CREATION_BASIC_HOST") | 45 | ALLIED_CREATION_BASIC_HOST = os.Getenv("ALLIED_CREATION_BASIC_HOST") |
| 42 | } | 46 | } |
| @@ -6,3 +6,9 @@ type CompanyData struct { | @@ -6,3 +6,9 @@ type CompanyData struct { | ||
| 6 | CompanyLogo string `json:"companyLogo"` | 6 | CompanyLogo string `json:"companyLogo"` |
| 7 | CompanyName string `json:"companyName"` | 7 | CompanyName string `json:"companyName"` |
| 8 | } | 8 | } |
| 9 | + | ||
| 10 | +type Company struct { | ||
| 11 | + CompanyID int `json:"companyId"` | ||
| 12 | + Logo string `json:"logo"` | ||
| 13 | + CompanyName string `json:"companyName"` | ||
| 14 | +} |
| @@ -3,8 +3,8 @@ package domain | @@ -3,8 +3,8 @@ package domain | ||
| 3 | import ( | 3 | import ( |
| 4 | "encoding/base64" | 4 | "encoding/base64" |
| 5 | "fmt" | 5 | "fmt" |
| 6 | - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/util" | ||
| 7 | - "log" | 6 | + "github.com/forgoer/openssl" |
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant" | ||
| 8 | "time" | 8 | "time" |
| 9 | 9 | ||
| 10 | jwt "github.com/dgrijalva/jwt-go" | 10 | jwt "github.com/dgrijalva/jwt-go" |
| @@ -15,8 +15,8 @@ const ( | @@ -15,8 +15,8 @@ const ( | ||
| 15 | qrcodeCodeExpire int64 = 60 * 30 //15分钟过期 | 15 | qrcodeCodeExpire int64 = 60 * 30 //15分钟过期 |
| 16 | ) | 16 | ) |
| 17 | 17 | ||
| 18 | -var aecSecret = []byte("mmm.qrcode.(%^&)") | ||
| 19 | -var loginHost = "https://api.fjmaimaimai.com/app/auth/login/qrcode?key=" | 18 | +var aecSecret = []byte("mmm.qrcode.ecb.1") |
| 19 | +var qrcodeLogin = "/v1/auth/login/qrcode?key=" | ||
| 20 | 20 | ||
| 21 | type QrcodeMessage struct { | 21 | type QrcodeMessage struct { |
| 22 | jwt.StandardClaims | 22 | jwt.StandardClaims |
| @@ -48,34 +48,13 @@ func (qrmsg *QrcodeMessage) GenerateImageBase64() ([]byte, error) { | @@ -48,34 +48,13 @@ func (qrmsg *QrcodeMessage) GenerateImageBase64() ([]byte, error) { | ||
| 48 | if err != nil { | 48 | if err != nil { |
| 49 | return nil, err | 49 | return nil, err |
| 50 | } | 50 | } |
| 51 | - key := loginHost + str | ||
| 52 | - encryptedData, err := util.AesEncrypt([]byte(key), aecSecret) | 51 | + key := constant.ALLIED_CREATION_GATEWAY_HOST + qrcodeLogin + str |
| 52 | + encryptedData, err := openssl.AesECBEncrypt([]byte(key), aecSecret, openssl.PKCS7_PADDING) | ||
| 53 | + if err != nil { | ||
| 54 | + return nil, err | ||
| 55 | + } | ||
| 53 | qrmsg.Token = base64.StdEncoding.EncodeToString(encryptedData) | 56 | qrmsg.Token = base64.StdEncoding.EncodeToString(encryptedData) |
| 54 | - //初始化数据 | ||
| 55 | - //qrmsg.Token = string(encryptedData) | ||
| 56 | qrmsg.IsLogin = false | 57 | qrmsg.IsLogin = false |
| 57 | - | ||
| 58 | - // 输入日志 | ||
| 59 | - decrypted, _ := util.AesDecrypt(encryptedData, aecSecret) | ||
| 60 | - if string(decrypted) == key { | ||
| 61 | - log.Println("token:", str, "\n encrypt:", key, "\n decrypt:", string(decrypted)) | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | - //qrCode, err := qr.Encode(str, qr.M, qr.Auto) | ||
| 65 | - //if err != nil { | ||
| 66 | - // return nil, err | ||
| 67 | - //} | ||
| 68 | - //qrCode, err = barcode.Scale(qrCode, 200, 200) | ||
| 69 | - //if err != nil { | ||
| 70 | - // return nil, err | ||
| 71 | - //} | ||
| 72 | - //var buf bytes.Buffer | ||
| 73 | - //err = png.Encode(&buf, qrCode) | ||
| 74 | - //if err != nil { | ||
| 75 | - // return nil, err | ||
| 76 | - //} | ||
| 77 | - //var result []byte | ||
| 78 | - //base64.StdEncoding.Encode(result, buf.Bytes()) | ||
| 79 | return encryptedData, err | 58 | return encryptedData, err |
| 80 | } | 59 | } |
| 81 | 60 |
| @@ -93,3 +93,30 @@ func AesDecrypt(crypted, key []byte) ([]byte, error) { | @@ -93,3 +93,30 @@ func AesDecrypt(crypted, key []byte) ([]byte, error) { | ||
| 93 | origData = PKCS7UnPadding(origData, blockSize) | 93 | origData = PKCS7UnPadding(origData, blockSize) |
| 94 | return origData, nil | 94 | return origData, nil |
| 95 | } | 95 | } |
| 96 | + | ||
| 97 | +func ECBEncrypt(block cipher.Block, src, key []byte) ([]byte, error) { | ||
| 98 | + blockSize := block.BlockSize() | ||
| 99 | + | ||
| 100 | + encryptData := make([]byte, len(src)) | ||
| 101 | + tmpData := make([]byte, blockSize) | ||
| 102 | + | ||
| 103 | + for index := 0; index < len(src); index += blockSize { | ||
| 104 | + block.Encrypt(tmpData, src[index:index+blockSize]) | ||
| 105 | + copy(encryptData, tmpData) | ||
| 106 | + } | ||
| 107 | + return encryptData, nil | ||
| 108 | +} | ||
| 109 | + | ||
| 110 | +func ECBDecrypt(block cipher.Block, src, key []byte) ([]byte, error) { | ||
| 111 | + dst := make([]byte, len(src)) | ||
| 112 | + | ||
| 113 | + blockSize := block.BlockSize() | ||
| 114 | + tmpData := make([]byte, blockSize) | ||
| 115 | + | ||
| 116 | + for index := 0; index < len(src); index += blockSize { | ||
| 117 | + block.Decrypt(tmpData, src[index:index+blockSize]) | ||
| 118 | + copy(dst, tmpData) | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + return dst, nil | ||
| 122 | +} |
| @@ -3,28 +3,34 @@ package util | @@ -3,28 +3,34 @@ package util | ||
| 3 | import ( | 3 | import ( |
| 4 | "encoding/base64" | 4 | "encoding/base64" |
| 5 | "fmt" | 5 | "fmt" |
| 6 | + "github.com/forgoer/openssl" | ||
| 6 | "testing" | 7 | "testing" |
| 7 | ) | 8 | ) |
| 8 | 9 | ||
| 9 | func Test_Aes(t *testing.T) { | 10 | func Test_Aes(t *testing.T) { |
| 10 | //key的长度必须是16、24或者32字节,分别用于选择AES-128, AES-192, or AES-256 | 11 | //key的长度必须是16、24或者32字节,分别用于选择AES-128, AES-192, or AES-256 |
| 11 | var aeskey = []byte("mmm.qrcode.(%^&)") | 12 | var aeskey = []byte("mmm.qrcode.(%^&)") |
| 12 | - pass := []byte("vdncloud123456") | 13 | + pass := []byte("https://www.baidu.com/") |
| 13 | xpass, err := AesEncrypt(pass, aeskey) | 14 | xpass, err := AesEncrypt(pass, aeskey) |
| 14 | if err != nil { | 15 | if err != nil { |
| 15 | fmt.Println(err) | 16 | fmt.Println(err) |
| 16 | return | 17 | return |
| 17 | } | 18 | } |
| 18 | - | 19 | + fmt.Printf("base64 加密前:%v\n", string(xpass)) |
| 19 | pass64 := base64.StdEncoding.EncodeToString(xpass) | 20 | pass64 := base64.StdEncoding.EncodeToString(xpass) |
| 20 | - fmt.Printf("加密后:%v\n", pass64) | 21 | + fmt.Printf("base64 加密:%v\n", pass64) |
| 22 | + | ||
| 23 | + //pass64 ="qYy8JqxzYGkhmDCZ6581/Fg9LfcGGqlAVjCWHpSayNs=" | ||
| 21 | 24 | ||
| 22 | bytesPass, err := base64.StdEncoding.DecodeString(pass64) | 25 | bytesPass, err := base64.StdEncoding.DecodeString(pass64) |
| 26 | + fmt.Printf("base64 解密:%v\n", string(bytesPass)) | ||
| 23 | if err != nil { | 27 | if err != nil { |
| 24 | fmt.Println(err) | 28 | fmt.Println(err) |
| 25 | return | 29 | return |
| 26 | } | 30 | } |
| 27 | 31 | ||
| 32 | + //bytesPass:=xpass | ||
| 33 | + //fmt.Println(string(bytesPass)) | ||
| 28 | tpass, err := AesDecrypt(bytesPass, aeskey) | 34 | tpass, err := AesDecrypt(bytesPass, aeskey) |
| 29 | if err != nil { | 35 | if err != nil { |
| 30 | fmt.Println(err) | 36 | fmt.Println(err) |
| @@ -32,3 +38,38 @@ func Test_Aes(t *testing.T) { | @@ -32,3 +38,38 @@ func Test_Aes(t *testing.T) { | ||
| 32 | } | 38 | } |
| 33 | fmt.Printf("解密后:%s\n", tpass) | 39 | fmt.Printf("解密后:%s\n", tpass) |
| 34 | } | 40 | } |
| 41 | + | ||
| 42 | +func Test_Base64(t *testing.T) { | ||
| 43 | + xpass := []byte("123") //123 | ||
| 44 | + fmt.Printf("base64 加密前:%v\n", string(xpass)) | ||
| 45 | + pass64 := base64.StdEncoding.EncodeToString(xpass) | ||
| 46 | + fmt.Printf("base64 加密:%v\n", pass64) | ||
| 47 | + | ||
| 48 | + bytesPass, err := base64.StdEncoding.DecodeString(pass64) | ||
| 49 | + fmt.Printf("base64 解密:%v\n", string(bytesPass)) | ||
| 50 | + if err != nil { | ||
| 51 | + fmt.Println(err) | ||
| 52 | + return | ||
| 53 | + } | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +func Test_AES_ECB(t *testing.T) { | ||
| 57 | + src := []byte("123456") | ||
| 58 | + key := []byte("mmm.qrcode.ecb.1") | ||
| 59 | + dst, _ := openssl.AesECBEncrypt(src, key, openssl.PKCS7_PADDING) | ||
| 60 | + fmt.Println(base64.StdEncoding.EncodeToString(dst)) // 1jdzWuniG6UMtoa3T6uNLA== | ||
| 61 | + | ||
| 62 | + dst, _ = openssl.AesECBDecrypt(dst, key, openssl.PKCS7_PADDING) | ||
| 63 | + fmt.Println(string(dst)) // 123456 | ||
| 64 | +} | ||
| 65 | + | ||
| 66 | +func Test_AES_CBC(t *testing.T) { | ||
| 67 | + src := []byte("123456") | ||
| 68 | + key := []byte("mmm.qrcode.ecb.1") | ||
| 69 | + iv := []byte("mmm.qrcode.ecb.1") | ||
| 70 | + dst, _ := openssl.AesCBCEncrypt(src, key, iv, openssl.PKCS7_PADDING) | ||
| 71 | + fmt.Println(base64.StdEncoding.EncodeToString(dst)) // 1jdzWuniG6UMtoa3T6uNLA== | ||
| 72 | + | ||
| 73 | + dst, _ = openssl.AesCBCDecrypt(dst, key, iv, openssl.PKCS7_PADDING) | ||
| 74 | + fmt.Println(string(dst)) // 123456 | ||
| 75 | +} |
-
请 注册 或 登录 后发表评论