Add getEntity and getEcryptionKeyIDs functions to key and message types respectively (#55)

* add getEntity function to key struct

* add getEncryptionKeyIDs

* add chengelog + bool return in getEncryptionKeyIDs

* fix description
This commit is contained in:
Ilya Chesnokov 2020-07-02 15:55:11 +07:00 committed by GitHub
parent d1f6f7d718
commit 8d42a53775
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 0 deletions

View file

@ -7,6 +7,7 @@ import (
"strings"
"testing"
"golang.org/x/crypto/openpgp"
"golang.org/x/crypto/openpgp/armor"
"golang.org/x/crypto/rsa"
@ -378,3 +379,13 @@ func TestGetSHA256FingerprintsV4(t *testing.T) {
assert.Exactly(t, "d9ac0b857da6d2c8be985b251a9e3db31e7a1d2d832d1f07ebe838a9edce9c24", sha256Fingerprints[0])
assert.Exactly(t, "203dfba1f8442c17e59214d9cd11985bfc5cc8721bb4a71740dd5507e58a1a0d", sha256Fingerprints[1])
}
func TestGetEntity(t *testing.T) {
publicKey, err := NewKeyFromArmored(readTestFile("keyring_publicKey", false))
if err != nil {
t.Fatal("Cannot unarmor key:", err)
}
entity := publicKey.GetEntity()
assert.True(t, entity.PrimaryIdentity().SelfSignature.FlagsValid)
assert.IsType(t, &openpgp.Entity{}, entity)
}