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

CommonSeeder test needs a white-box testing mechanism to replace the default entropy source

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 11
    • Component/s: security-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b20
    • Verification:
      Verified

      Backports

        Description

        test/jdk/sun/security/provider/SecureRandom/CommonSeeder.java

        This test currently uses reflection to hack into a Field object of a static final field to "non-final". It needs a white-box testing mechanism to replace this reflection hack.

            static void setDefaultSeeder(EntropySource es) throws Exception {
                Field f = AbstractDrbg.class.getDeclaredField("defaultES");
                f.setAccessible(true); // no more private
                Field f2 = Field.class.getDeclaredField("modifiers");
                f2.setAccessible(true);
                f2.setInt(f, f2.getInt(f) - Modifier.FINAL); // no more final
                f.set(null, es);
            }

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  weijun Weijun Wang
                  Reporter:
                  mchung Mandy Chung
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: