mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-11-02 18:26:43 +00:00
indicate if user provided key was used in pgp verification
This commit is contained in:
parent
c8165e154a
commit
d0afa09870
2 changed files with 4 additions and 2 deletions
|
@ -75,8 +75,10 @@ public class PGPUtils {
|
|||
if(subkeyIdentifier != null) {
|
||||
PGPPublicKey signedByKey = null;
|
||||
long primaryKeyId = subkeyIdentifier.getPrimaryKeyId();
|
||||
boolean userProvidedKey = false;
|
||||
if(publicKeyRing != null && publicKeyRing.getPublicKey(primaryKeyId) != null) {
|
||||
signedByKey = publicKeyRing.getPublicKey(primaryKeyId);
|
||||
userProvidedKey = true;
|
||||
log.debug("Signed using provided public key");
|
||||
} else if(appPgpPublicKeyRingCollection != null && appPgpPublicKeyRingCollection.getPublicKey(primaryKeyId) != null
|
||||
&& !isExpired(appPgpPublicKeyRingCollection.getPublicKey(primaryKeyId))) {
|
||||
|
@ -102,7 +104,7 @@ public class PGPUtils {
|
|||
expired = isExpired(signedByKey);
|
||||
}
|
||||
|
||||
return new PGPVerificationResult(primaryKeyId, userId, signatureVerification.getSignature().getCreationTime(), expired);
|
||||
return new PGPVerificationResult(primaryKeyId, userId, signatureVerification.getSignature().getCreationTime(), expired, userProvidedKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,4 +2,4 @@ package com.sparrowwallet.drongo.pgp;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
public record PGPVerificationResult(long keyId, String userId, Date signatureTimestamp, boolean expired) { }
|
||||
public record PGPVerificationResult(long keyId, String userId, Date signatureTimestamp, boolean expired, boolean userProvidedKey) { }
|
||||
|
|
Loading…
Reference in a new issue