File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
src/main/java/com/wolfssl/provider/jce Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -75,13 +75,23 @@ protected synchronized byte[] engineGenerateSeed(int numBytes)
7575 @ Override
7676 protected synchronized void engineNextBytes (byte [] bytes ) {
7777
78+ if (bytes == null ) {
79+ throw new NullPointerException ("Input byte[] should not be null" );
80+ }
81+
7882 rng .generateBlock (bytes );
7983 }
8084
8185 @ Override
8286 protected synchronized void engineSetSeed (byte [] seed ) {
87+
88+ if (seed == null ) {
89+ throw new NullPointerException ("Input seed[] should not be null" );
90+ }
91+
8392 /* wolfCrypt reseeds internally automatically */
8493 log ("setSeed() not supported by wolfJCE" );
94+
8595 }
8696
8797 private void log (String msg ) {
@@ -145,5 +155,21 @@ private synchronized void readObject(ObjectInputStream in)
145155
146156 in .defaultReadObject ();
147157 }
158+
159+ @ Override
160+ public String toString () {
161+ /* Native wolfCrypt DRBG details:
162+ * Hash_DRBG = DRBG implementation
163+ * SHA-256 = hash function used in Hash_DRBG implementation
164+ * 128 = security strength in bits
165+ * reseed_only = NIST implementation default, prediction resistance
166+ * not enabled for every generate call, onlky when explicitly
167+ * reseeded.
168+ *
169+ * This output format matches other JCE providers, some callers
170+ * may expect this format.
171+ */
172+ return "Hash_DRBG,SHA-256,128,reseed_only" ;
173+ }
148174}
149175
You can’t perform that action at this time.
0 commit comments