1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-23 03:17:58 +01:00

KeyAccessor.ViaKeyId: Differentiate between primary key (direct-key sig) and subkey

This commit is contained in:
Paul Schaub 2021-11-27 16:03:32 +01:00
parent b44a97760a
commit c7dc7f755c

View file

@ -110,7 +110,13 @@ public abstract class KeyAccessor {
@Override
public @Nonnull PGPSignature getSignatureWithPreferences() {
PGPSignature signature = info.getLatestDirectKeySelfSignature();
PGPSignature signature;
if (key.getPrimaryKeyId() != key.getSubkeyId()) {
signature = info.getCurrentSubkeyBindingSignature(key.getSubkeyId());
} else {
signature = info.getLatestDirectKeySelfSignature();
}
if (signature != null) {
return signature;
}