<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 4/22/2022 1:21 PM, Weijun Wang
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:8hc3urNfRrU2ikT7JhVx0JYsgTDUZPcc6OZv-GNz2tk=.1024b122-b99e-4a97-b884-dd1d37226406@github.com">
      <pre class="moz-quote-pre" wrap="">Compare encoded instead of decoded digest in RSA signature verification.

-------------

Commit messages:
 - RFC 8017 8.2.2 Step 4

Changes: <a class="moz-txt-link-freetext" href="https://git.openjdk.java.net/jdk/pull/8365/files">https://git.openjdk.java.net/jdk/pull/8365/files</a>
 Webrev: <a class="moz-txt-link-freetext" href="https://webrevs.openjdk.java.net/?repo=jdk&pr=8365&range=00">https://webrevs.openjdk.java.net/?repo=jdk&pr=8365&range=00</a>
  Issue: <a class="moz-txt-link-freetext" href="https://bugs.openjdk.java.net/browse/JDK-8285404">https://bugs.openjdk.java.net/browse/JDK-8285404</a>
  Stats: 30 lines in 2 files changed: 3 ins; 26 del; 1 mod
  Patch: <a class="moz-txt-link-freetext" href="https://git.openjdk.java.net/jdk/pull/8365.diff">https://git.openjdk.java.net/jdk/pull/8365.diff</a>
  Fetch: git fetch <a class="moz-txt-link-freetext" href="https://git.openjdk.java.net/jdk">https://git.openjdk.java.net/jdk</a> pull/8365/head:pull/8365

PR: <a class="moz-txt-link-freetext" href="https://git.openjdk.java.net/jdk/pull/8365">https://git.openjdk.java.net/jdk/pull/8365</a>
</pre>
    </blockquote>
    <p>This is a weird one.  AFAICT the way it was being done is valid
      and allowed by RFC8017 - I would have closed the bug report as
      notabug.  Here's the relevant text from  RFC8017:<br>
    </p>
    <p>
      <blockquote type="cite">
        <pre> 4.  Compare the encoded message EM and the second encoded message
          EM'.  If they are the same, output "valid signature";
          otherwise, output "invalid signature".

      Note: <b><u>Another way to implement the signature verification
      operation is to apply a "decoding" operation (not specified in
      this document) to the encoded message to recover the underlying
      hash value, and then compare it to a newly computed hash value.</u></b>
      This has the advantage that it requires less intermediate storage
      (two hash values rather than two encoded messages), but the
      disadvantage that it requires additional code.
</pre>
      </blockquote>
      <br>
    </p>
  </body>
</html>