@@ -179,7 +179,9 @@ void releaseContext() throws OCKException {
179179
180180 private long digestId = 0 ;
181181
182- public static Digest getInstance (OCKContext ockContext , String digestAlgo ) throws OCKException {
182+ private OpenJCEPlusProvider provider ;
183+
184+ public static Digest getInstance (OCKContext ockContext , String digestAlgo , OpenJCEPlusProvider provider ) throws OCKException {
183185 if (ockContext == null ) {
184186 throw new IllegalArgumentException ("context is null" );
185187 }
@@ -188,17 +190,18 @@ public static Digest getInstance(OCKContext ockContext, String digestAlgo) throw
188190 throw new IllegalArgumentException ("digestAlgo is null/empty" );
189191 }
190192
191- return new Digest (ockContext , digestAlgo );
193+ return new Digest (ockContext , digestAlgo , provider );
192194 }
193195
194- private Digest (OCKContext ockContext , String digestAlgo ) throws OCKException {
196+ private Digest (OCKContext ockContext , String digestAlgo , OpenJCEPlusProvider provider ) throws OCKException {
195197 //final String methodName = "Digest(String)";
196198 this .ockContext = ockContext ;
197199 this .digestAlgo = digestAlgo ;
200+ this .provider = provider ;
198201 getContext ();
199202 //OCKDebug.Msg(debPrefix, methodName, "digestAlgo :" + digestAlgo);
200203
201- OpenJCEPlusProvider .registerCleanable (this , cleanOCKResources (digestId , algIndx ,
204+ this . provider .registerCleanable (this , cleanOCKResources (digestId , algIndx ,
202205 contextFromQueue , needsReinit , ockContext ));
203206 }
204207
@@ -343,6 +346,7 @@ public synchronized Object clone() throws CloneNotSupportedException {
343346 copy .needsReinit = this .needsReinit ;
344347 copy .ockContext = this .ockContext ;
345348 copy .contextFromQueue = false ;
349+ copy .provider = this .provider ;
346350
347351 // Allocate a new context for the digestId and copy all state information from our
348352 // original context into the copy.
@@ -360,12 +364,12 @@ public synchronized Object clone() throws CloneNotSupportedException {
360364 throw new CloneNotSupportedException (stackTrace );
361365 }
362366
363- OpenJCEPlusProvider .registerCleanable (copy , cleanOCKResources (copy .digestId , copy .algIndx ,
367+ this . provider .registerCleanable (copy , cleanOCKResources (copy .digestId , copy .algIndx ,
364368 copy .contextFromQueue , copy .needsReinit , copy .ockContext ));
365369 return copy ;
366370 }
367371
368- private static Runnable cleanOCKResources (long digestId , int algIndx , boolean contextFromQueue ,
372+ private Runnable cleanOCKResources (long digestId , int algIndx , boolean contextFromQueue ,
369373 boolean needsReinit , OCKContext ockContext ) {
370374 return () -> {
371375 try {
0 commit comments