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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 11
    • None
    • security-libs
    • b20
    • Verified

        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);
            }

              weijun Weijun Wang
              mchung Mandy Chung (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: