in net/JetBrains.DownloadPgpVerifier/src/PgpSignaturesVerifier.cs [129:152]
private static bool IsSubKeyForSigning(PgpPublicKey masterPublicKey, PgpPublicKey publicKey, Action<string> onError)
{
if (masterPublicKey == null) throw new ArgumentNullException(nameof(masterPublicKey));
if (publicKey == null) throw new ArgumentNullException(nameof(publicKey));
if (onError == null) throw new ArgumentNullException(nameof(onError));
if (!masterPublicKey.IsMasterKey)
throw new Exception($"Master key is required. KeyID={masterPublicKey.KeyId:X16}");
if (publicKey.IsMasterKey)
throw new Exception($"Sub key is required. KeyID={publicKey.KeyId:X16}");
foreach (PgpSignature signature in publicKey.GetKeySignatures())
if (signature.SignatureType == PgpSignature.SubkeyBinding)
if ((signature.GetHashedSubPackets().GetKeyFlags() & KeyFlags.SignData) != 0)
if (CheckSignatureFormat(signature, onError))
{
signature.InitVerify(masterPublicKey);
if (signature.VerifyCertification(masterPublicKey, publicKey))
return true;
onError($"Failed to verify the certification of the signature MasterKeyID={masterPublicKey.KeyId:X16} SubKeyID={publicKey.KeyId:X16}");
}
onError($"Incompatible keys MasterKeyID={masterPublicKey.KeyId:X16} SubKeyID={publicKey.KeyId:X16}");
return false;
}