Add SHA256 fingerprint utils and helpers (#41)
This commit is contained in:
parent
c8b7e87135
commit
3c79f40acb
8 changed files with 88 additions and 3 deletions
|
|
@ -1,6 +1,8 @@
|
|||
package helper
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
)
|
||||
|
||||
|
|
@ -65,3 +67,12 @@ func EncryptAttachment(plainData []byte, fileName string, keyRing *crypto.KeyRin
|
|||
}
|
||||
return decrypted, nil
|
||||
}
|
||||
|
||||
func GetJsonSHA256Fingerprints(publicKey string) ([]byte, error) {
|
||||
key, err := crypto.NewKeyFromArmored(publicKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return json.Marshal(key.GetSHA256Fingerprints())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue