96 *
97 * On Windows, this causes the MS CryptoAPI seeder to be used.
98 *
99 * On Solaris/Linux/MacOS, this is identical to using
100 * URLSeedGenerator to read from /dev/[u]random
101 */
102 if (egdSource.equals(SunEntries.URL_DEV_RANDOM) ||
103 egdSource.equals(SunEntries.URL_DEV_URANDOM)) {
104 try {
105 instance = new NativeSeedGenerator(egdSource);
106 if (debug != null) {
107 debug.println(
108 "Using operating system seed generator" + egdSource);
109 }
110 } catch (IOException e) {
111 if (debug != null) {
112 debug.println("Failed to use operating system seed "
113 + "generator: " + e.toString());
114 }
115 }
116 } else if (egdSource.length() != 0) {
117 try {
118 instance = new URLSeedGenerator(egdSource);
119 if (debug != null) {
120 debug.println("Using URL seed generator reading from "
121 + egdSource);
122 }
123 } catch (IOException e) {
124 if (debug != null) {
125 debug.println("Failed to create seed generator with "
126 + egdSource + ": " + e.toString());
127 }
128 }
129 }
130
131 // Fall back to ThreadedSeedGenerator
132 if (instance == null) {
133 if (debug != null) {
134 debug.println("Using default threaded seed generator");
135 }
136 instance = new ThreadedSeedGenerator();
|
96 *
97 * On Windows, this causes the MS CryptoAPI seeder to be used.
98 *
99 * On Solaris/Linux/MacOS, this is identical to using
100 * URLSeedGenerator to read from /dev/[u]random
101 */
102 if (egdSource.equals(SunEntries.URL_DEV_RANDOM) ||
103 egdSource.equals(SunEntries.URL_DEV_URANDOM)) {
104 try {
105 instance = new NativeSeedGenerator(egdSource);
106 if (debug != null) {
107 debug.println(
108 "Using operating system seed generator" + egdSource);
109 }
110 } catch (IOException e) {
111 if (debug != null) {
112 debug.println("Failed to use operating system seed "
113 + "generator: " + e.toString());
114 }
115 }
116 } else if (!egdSource.isEmpty()) {
117 try {
118 instance = new URLSeedGenerator(egdSource);
119 if (debug != null) {
120 debug.println("Using URL seed generator reading from "
121 + egdSource);
122 }
123 } catch (IOException e) {
124 if (debug != null) {
125 debug.println("Failed to create seed generator with "
126 + egdSource + ": " + e.toString());
127 }
128 }
129 }
130
131 // Fall back to ThreadedSeedGenerator
132 if (instance == null) {
133 if (debug != null) {
134 debug.println("Using default threaded seed generator");
135 }
136 instance = new ThreadedSeedGenerator();
|