Update path for certificates

Signed-off-by: Yuan Si <do4suki@gmail.com>
This commit is contained in:
2025-03-10 15:29:29 +08:00
committed by YumeMichi
parent 44b0498bbe
commit fc55a09773
32 changed files with 59 additions and 54 deletions
+9 -8
View File
@@ -7,6 +7,7 @@ import (
"crypto/sha1"
"crypto/x509"
"encoding/pem"
"honoka-chan/config"
"os"
"path/filepath"
"runtime"
@@ -34,7 +35,7 @@ func RSA_Gen(bits int) {
//encode x509 to pem and save to file
//1. create privatefile
privatekeyfile, err := os.Create(currentpath + "/privatekey.pem")
privatekeyfile, err := os.Create(config.PrivateKeyPath)
if err != nil {
panic(err)
}
@@ -57,7 +58,7 @@ func RSA_Gen(bits int) {
//encode x509 to pem and save to file
//1. create publickeyfile
publickeyfile, err := os.Create(currentpath + "/publickey.pem")
publickeyfile, err := os.Create(config.PublicKeyPath)
if err != nil {
panic(err)
}
@@ -109,9 +110,9 @@ func RSA_Encrypt(plainText []byte, publickeypath string) []byte {
return cipherText
}
func RSA_Decrypt(cipherText []byte, privatekeypath string) []byte {
func RSA_Decrypt(cipherText []byte) []byte {
//open privatekeyfile
privatekeyfile, err := os.Open(privatekeypath)
privatekeyfile, err := os.Open(config.PrivateKeyPath)
if err != nil {
panic(err)
}
@@ -137,9 +138,9 @@ func RSA_Decrypt(cipherText []byte, privatekeypath string) []byte {
return plainText
}
func RSA_Sign_SHA1(cipherText []byte, privatekeypath string) []byte {
func RSA_Sign_SHA1(cipherText []byte) []byte {
//open privatekeyfile
privatekeyfile, err := os.Open(privatekeypath)
privatekeyfile, err := os.Open(config.PrivateKeyPath)
if err != nil {
panic(err)
}
@@ -172,9 +173,9 @@ func RSA_Sign_SHA1(cipherText []byte, privatekeypath string) []byte {
return signature
}
func RSA_DecryptOAEP(cipherText []byte, privatekeypath string) []byte {
func RSA_DecryptOAEP(cipherText []byte) []byte {
//open privatekeyfile
privatekeyfile, err := os.Open(privatekeypath)
privatekeyfile, err := os.Open(config.PrivateKeyPath)
if err != nil {
panic(err)
}