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

java.security.SecureRandom.getPrngAlgorithm() returns incorrect value

XMLWordPrintable

    • beta
    • generic
    • generic



      Name: yyT116575 Date: 01/16/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      I have bootstrapped Vector, Hashtable and HashMap. The only diference was that
      the initialCapacity became equal 1 (istead of 10) in implementation of empty
      constructors for these classes. Affter bootstrapping those 3 classes
      NullPointerException started to accure in SecureRandom!
      SecureRandom.getPrngAlgorithm() finds property which key starts
      with "SecureRandom." and returns the rest of the key (String) after the dot in
      it. BUT there are several property keys, that correspond to the algoritm name
      (that has to be found) because an algorithm has several values. All keys,
      assosiated with "SecureRandom" algorithm start with "SecureRandom.",
      SecureRandom.getPrngAlgorithm() find the key, that has algorithm's
      implementation classname in it's value.
      For example:
      there are properties
      "SecureRandom.SHA1PRNG" -> "sun.security.provider.SecureRandom"
      "SecureRandom.SHA1PRNG ImplementedIn" -> "Software"
      When getPrngAlgorithm() finds "SecureRandom.SHA1PRNG", everything is fine, BUT
      when it first finds "SecureRandom.SHA1PRNG ImplementedIn", it returns
      String "SHA1PRNG ImplementedIn" instead of "SHA1PRNG" and this is the reason
      why NullPoiterException occurs after using the result of this method.

      This reveals after bootstrapping of Vector because the order of the keys in
      implementations of Hash is sensitive to initialCapacity of Vector.
      But probably this can be reproduced in other ways also.
      (Review ID: 115242)
      ======================================================================

            smalkanisunw Seema Malkani (Inactive)
            yyoungsunw Yung-ching Young (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: