Compare commits
No commits in common. "5cf96d8ab31882fa4e753fe63e8a0d31af434847" and "991e82cfda2bd8aca6186ea3b18586daa781c23f" have entirely different histories.
5cf96d8ab3
...
991e82cfda
21
src/http.go
21
src/http.go
|
@ -35,11 +35,10 @@ func domainList(c *gin.Context) {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
encryptData := encryptResult(string(data), token)
|
|
||||||
c.JSON(200, gin.H{
|
c.JSON(200, gin.H{
|
||||||
"code": 200,
|
"code": 200,
|
||||||
"msg": "success",
|
"msg": "Success",
|
||||||
"data": encryptData,
|
"data": encryptResult(string(data), token),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,24 +78,12 @@ func getCert(c *gin.Context) {
|
||||||
}
|
}
|
||||||
key := string(keyContent)
|
key := string(keyContent)
|
||||||
|
|
||||||
certInfoFilePath := path.Join(dir, CertInfoFileName)
|
|
||||||
certInfoContent, err := os.ReadFile(certInfoFilePath)
|
|
||||||
if err != nil {
|
|
||||||
c.JSON(200, gin.H{
|
|
||||||
"code": 500,
|
|
||||||
"msg": "Failed to read cert info file.",
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
certInfo := string(certInfoContent)
|
|
||||||
|
|
||||||
c.JSON(200, gin.H{
|
c.JSON(200, gin.H{
|
||||||
"code": 200,
|
"code": 200,
|
||||||
"msg": "Success",
|
"msg": "Success",
|
||||||
"data": gin.H{
|
"data": gin.H{
|
||||||
"crt": encryptResult(crt, token),
|
"crt": encryptResult(crt, token),
|
||||||
"key": encryptResult(key, token),
|
"key": encryptResult(key, token),
|
||||||
"info": encryptResult(certInfo, token),
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,12 +61,3 @@ func TestRSA(t *testing.T) {
|
||||||
fmt.Println(string(decryptd))
|
fmt.Println(string(decryptd))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAES(t *testing.T) {
|
|
||||||
content := "123456"
|
|
||||||
encryptd := crypto.EncryptAES([]byte("12345678901234561234567890123456"), []byte(content))
|
|
||||||
fmt.Println(base64.StdEncoding.EncodeToString(encryptd))
|
|
||||||
plain := crypto.DecryptAES([]byte("12345678901234561234567890123456"), encryptd)
|
|
||||||
fmt.Println(string(plain))
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user