Fixed RS256, again
This commit is contained in:
parent
728279ec63
commit
04af6c00fb
9
main.go
9
main.go
|
@ -258,11 +258,17 @@ func main() {
|
|||
log.Fatal("[ERROR] Failed to parse PEM block containing the private key")
|
||||
}
|
||||
|
||||
privateKey, err = x509.ParsePKCS1PrivateKey(block.Bytes)
|
||||
privKey, err := x509.ParsePKCS8PrivateKey(block.Bytes)
|
||||
if err != nil {
|
||||
log.Fatal("[ERROR] Failed to parse private key:", err)
|
||||
}
|
||||
|
||||
var ok bool
|
||||
privateKey, ok = privKey.(*rsa.PrivateKey)
|
||||
if !ok {
|
||||
log.Fatal("[ERROR] Failed to convert private key to RSA private key")
|
||||
}
|
||||
|
||||
pubKeyFile, err := os.ReadFile(PUBLIC_KEY_PATH)
|
||||
if err != nil {
|
||||
log.Fatal("[ERROR] Cannot read public key:", err)
|
||||
|
@ -278,7 +284,6 @@ func main() {
|
|||
log.Fatal("[ERROR] Failed to parse public key:", err)
|
||||
}
|
||||
|
||||
var ok bool
|
||||
publicKey, ok = pubKey.(*rsa.PublicKey)
|
||||
if !ok {
|
||||
log.Fatal("[ERROR] Failed to convert public key to RSA public key")
|
||||
|
|
Reference in New Issue