Skip to content
Snippets Groups Projects
Commit c9ab8404 authored by ale's avatar ale
Browse files

Handle PGP keys that have an email in the 'id' part of the uid

Some keys can have an empty 'email' field, but will contain an email
address in the 'id' field.
parent f77712cf
No related branches found
No related tags found
No related merge requests found
...@@ -442,8 +442,15 @@ func parseOpenPGPKey(data []byte, email string) (key *crypto.Key, err error) { ...@@ -442,8 +442,15 @@ func parseOpenPGPKey(data []byte, email string) (key *crypto.Key, err error) {
var found bool var found bool
var identities []string var identities []string
for _, identity := range entity.Identities { for _, identity := range entity.Identities {
identities = append(identities, identity.UserId.Email) // Some keys can have an empty Email field, but will
if identity.UserId.Email == email { // contain an email address in the Id field.
idEmail := identity.UserId.Email
if idEmail == "" && strings.Contains(identity.UserId.Id, "@") {
idEmail = identity.UserId.Id
}
identities = append(identities, idEmail)
if idEmail == email {
found = true found = true
break break
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment