mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
fix: use correct GPG key for export
`GPGKeyToEntity` incorrectly assumed that within a keyring with multiple keys that the first key is verified and should be exported. Look at all keys and find the one that matches the verified key ID.
This commit is contained in:
parent
590795f592
commit
1ca9cbb7c2
1 changed files with 7 additions and 1 deletions
|
|
@ -111,7 +111,13 @@ func GPGKeyToEntity(ctx context.Context, k *GPGKey) (*openpgp.Entity, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return keys[0], err
|
||||
|
||||
for _, key := range keys {
|
||||
if key.PrimaryKey.KeyIdString() == k.KeyID {
|
||||
return key, nil
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("key with %s id not found", k.KeyID)
|
||||
}
|
||||
|
||||
// parseSubGPGKey parse a sub Key
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue