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

Avoid Class.forName in SecureRandom constructor

    XMLWordPrintable

Details

    Backports

      Description

        Creating a new SecureRandom ends up calling `Class.forName(cap.constructorParameterClassName)`
        where `constructorParameterClassName` is `java.security.SecureRandomParameters`. Doing this repeatedly is a waste of time/resources.

        We can cache this lookup in EngineDescription itself. This covers not just SecureRandom, but also a few other Providers which take params (like CertStore).

        In my experience, `new SecureRandom()` can be on an application's hot path. Users are reluctant to pool or share instances for fear of security and/or concurrency issues, plus more complex code.

        Attachments

          Issue Links

            Activity

              People

                ogillespie Oli Gillespie
                ogillespie Oli Gillespie
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: