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

SHA1PRNG reads from /dev/random even if /dev/urandom selected

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 5.0, 5.0u6, 5.0u11, 6, 6u13
    • security-libs
    • generic, x86
    • generic, linux

      If you do

      import java.security.SecureRandom;
      class JRand {
        public static void main(String args[]) throws Exception {
          System.out.println("Ok: " +
            SecureRandom.getInstance("SHA1PRNG").nextLong());
        }
      }

      then SecureRandom will read from /dev/random even if securerandom.source is configured to use /dev/urandom. This is a problem if /dev/urandom was chosen because /dev/random is not working properly.

      The root cause is that 4705093 assigned special meaning to the string "/dev/urandom".

            andreas Andreas Sterbenz
            andreas Andreas Sterbenz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: