Drop ALL STARS

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 fc55a09773
commit 782c2d7ab0
3288 changed files with 1 additions and 234137 deletions
-28
View File
@@ -172,31 +172,3 @@ func RSA_Sign_SHA1(cipherText []byte) []byte {
return signature
}
func RSA_DecryptOAEP(cipherText []byte) []byte {
//open privatekeyfile
privatekeyfile, err := os.Open(config.PrivateKeyPath)
if err != nil {
panic(err)
}
defer privatekeyfile.Close()
//get privatekeyfile content
privatekeyinfo, _ := privatekeyfile.Stat()
buf := make([]byte, privatekeyinfo.Size())
privatekeyfile.Read(buf)
//pem decode
privatekeyblock, _ := pem.Decode(buf)
//X509 decode
parseKey, err := x509.ParsePKCS8PrivateKey(privatekeyblock.Bytes)
if err != nil {
panic(err)
}
privateKey := parseKey.(*rsa.PrivateKey)
//decrypt the cipher
plainText, err := rsa.DecryptOAEP(sha1.New(), rand.Reader, privateKey, cipherText, nil)
if err != nil {
panic(err)
}
return plainText
}