@@ -193,6 +193,18 @@ public static Digest getInstance(OCKContext ockContext, String digestAlgo, OpenJ
193193 return new Digest (ockContext , digestAlgo , provider );
194194 }
195195
196+ public static Digest getInstance (OCKContext ockContext , String digestAlgo ) throws OCKException {
197+ if (ockContext == null ) {
198+ throw new IllegalArgumentException ("context is null" );
199+ }
200+
201+ if (digestAlgo == null || digestAlgo .isEmpty ()) {
202+ throw new IllegalArgumentException ("digestAlgo is null/empty" );
203+ }
204+
205+ return new Digest (ockContext , digestAlgo , null );
206+ }
207+
196208 private Digest (OCKContext ockContext , String digestAlgo , OpenJCEPlusProvider provider ) throws OCKException {
197209 //final String methodName = "Digest(String)";
198210 this .ockContext = ockContext ;
@@ -201,8 +213,10 @@ private Digest(OCKContext ockContext, String digestAlgo, OpenJCEPlusProvider pro
201213 getContext ();
202214 //OCKDebug.Msg(debPrefix, methodName, "digestAlgo :" + digestAlgo);
203215
204- this .provider .registerCleanable (this , cleanOCKResources (digestId , algIndx ,
205- contextFromQueue , needsReinit , ockContext ));
216+ if (provider != null ) {
217+ this .provider .registerCleanable (this , cleanOCKResources (digestId , algIndx ,
218+ contextFromQueue , needsReinit , ockContext ));
219+ }
206220 }
207221
208222 private Digest () {
0 commit comments