Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8157603

TestCipher.java doesn't check one of the decrypted message as expected

XMLWordPrintable

    • b81
    • 9
    • b123

        In this file:
        http://hg.openjdk.java.net/jdk9/dev/jdk/file/0b2d0cf231c7/test/com/sun/crypto/provider/Cipher/TestCipher.java

        Decryption is performed into INPUT_TEXT (lines 194-197).

                // Recover text from cipher and save to same buffer
                ci.update(INPUT_TEXT, STORAGE_OFFSET, TEXT_LEN + PAD_LEN, INPUT_TEXT,
                        ENC_OFFSET);
                ci.doFinal(INPUT_TEXT, ENC_OFFSET);

        But check that decryption went well is performed on another buffer - recoveredText (lines 199 -206):

                if (!equalsBlock(
                        plainText, ENC_OFFSET, recoveredText, 0,
                        recoveredText.length)) {
                    throw new RuntimeException(
                            "Recovered text not same as plain text with same buffer");
                } else {
                    out.println("Recovered and plain text are same with same buffer");
                }

              akosarev Artem Kosarev (Inactive)
              akosarev Artem Kosarev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: