aboutsummaryrefslogtreecommitdiff
path: root/verification.go
diff options
context:
space:
mode:
authorFChannel <>2021-07-03 19:18:29 -0700
committerFChannel <>2021-07-03 19:18:29 -0700
commit02d55188670a599048486c36e896416d917e831c (patch)
treedf26a6eb1d977a97eaf66aaf1342400159301068 /verification.go
parentcf86acee94652ac7cd8e8f313e6abf6c9901c398 (diff)
fixed error with CreatePublicKeyFromPrivate with empty actor
Diffstat (limited to 'verification.go')
-rw-r--r--verification.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/verification.go b/verification.go
index 1e9c50e..555e9ee 100644
--- a/verification.go
+++ b/verification.go
@@ -551,6 +551,7 @@ func CreatePublicKeyFromPrivate(db *sql.DB, actor *Actor, publicKeyPem string) e
if block == nil || block.Type != "RSA PRIVATE KEY" {
return errors.New("failed to decode PEM block containing public key")
}
+
key, err := x509.ParsePKCS1PrivateKey(block.Bytes)
CheckError(err, "failed to parse private key")
@@ -561,13 +562,14 @@ func CreatePublicKeyFromPrivate(db *sql.DB, actor *Actor, publicKeyPem string) e
Headers: nil,
Bytes: publicKeyDer,
}
+
publicFileWriter, err := os.Create(publicFilename)
CheckError(err, "error creating public pem file for " + actor.Name)
err = pem.Encode(publicFileWriter, &pubKeyBlock)
CheckError(err, "error encoding public pem")
}else{
- fmt.Println(`Unable to locate private key from public key generation. Now,
+ fmt.Println(`\nUnable to locate private key from public key generation. Now,
this means that you are now missing the proof that you are the
owner of the "` + actor.Name + `" board. If you are the developer,
then your job is just as easy as generating a new keypair, but
@@ -633,7 +635,7 @@ func ActivitySign(db *sql.DB, actor Actor, signature string) (string, error) {
return base64.StdEncoding.EncodeToString(cipher), nil
}else{
- fmt.Println(`Unable to locate private key. Now,
+ fmt.Println(`\n Unable to locate private key. Now,
this means that you are now missing the proof that you are the
owner of the "` + actor.Name + `" board. If you are the developer,
then your job is just as easy as generating a new keypair, but