private static bool IsSubKeyRevoked()

in net/JetBrains.DownloadPgpVerifier/src/PgpSignaturesVerifier.cs [154:183]


    private static bool IsSubKeyRevoked(PgpPublicKey masterPublicKey, PgpPublicKey publicKey, PgpSignature signature, Action<string> onError)
    {
      if (masterPublicKey == null) throw new ArgumentNullException(nameof(masterPublicKey));
      if (publicKey == null) throw new ArgumentNullException(nameof(publicKey));
      if (signature == null) throw new ArgumentNullException(nameof(signature));
      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 revocationSignature in publicKey.GetSignatures())
        if (revocationSignature.SignatureType == PgpSignature.SubkeyRevocation)
          if (CheckSignatureFormat(revocationSignature, onError))
          {
            revocationSignature.InitVerify(masterPublicKey);
            if (!revocationSignature.VerifyCertification(masterPublicKey, publicKey))
            {
              onError($"Failed to verify the certification of the revocation signature MasterKeyID={masterPublicKey.KeyId:X16} SubKeyID={publicKey.KeyId:X16}");
              return false;
            }

            if (revocationSignature.CreationTime <= signature.CreationTime)
            {
              onError($"The signature for SignKeyID={signature.KeyId:X16} was revoked");
              return false;
            }
          }

      return true;
    }