@@ -172,9 +172,11 @@ public void addAttribute(int nid, byte[] value)
172172
173173 confirmObjectIsActive ();
174174
175- WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
176- WolfSSLDebug .INFO , this .x509ReqPtr ,
177- "entered addAttribute(nid: " + nid + ", byte[])" );
175+ synchronized (x509ReqLock ) {
176+ WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
177+ WolfSSLDebug .INFO , this .x509ReqPtr ,
178+ "entered addAttribute(nid: " + nid + ", byte[])" );
179+ }
178180
179181 if (nid != WolfSSL .NID_pkcs9_challengePassword &&
180182 nid != WolfSSL .NID_serialNumber &&
@@ -262,9 +264,11 @@ public void setPublicKey(String filePath, int keyType, int format)
262264
263265 confirmObjectIsActive ();
264266
265- WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
266- WolfSSLDebug .INFO , this .x509ReqPtr , "entered setPublicKey(" +
267- filePath + ", type: " + keyType + ", format: " + format + ")" );
267+ synchronized (x509ReqLock ) {
268+ WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
269+ WolfSSLDebug .INFO , this .x509ReqPtr , "entered setPublicKey(" +
270+ filePath + ", type: " + keyType + ", format: " + format + ")" );
271+ }
268272
269273 if (filePath == null || filePath .isEmpty ()) {
270274 throw new WolfSSLException ("File path is null or empty" );
@@ -309,10 +313,12 @@ public void setPublicKey(byte[] key, int keyType, int format)
309313
310314 confirmObjectIsActive ();
311315
312- WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
313- WolfSSLDebug .INFO , this .x509ReqPtr ,
314- "entered setPublicKey(byte[], type: " + keyType + ", format: " +
315- format + ")" );
316+ synchronized (x509ReqLock ) {
317+ WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
318+ WolfSSLDebug .INFO , this .x509ReqPtr ,
319+ "entered setPublicKey(byte[], type: " + keyType + ", format: " +
320+ format + ")" );
321+ }
316322
317323 if (key == null || key .length == 0 ) {
318324 throw new WolfSSLException ("Key array is null or empty" );
@@ -366,9 +372,11 @@ public void setPublicKey(PublicKey key)
366372
367373 confirmObjectIsActive ();
368374
369- WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
370- WolfSSLDebug .INFO , this .x509ReqPtr ,
371- "entered setPublicKey(" + key + ")" );
375+ synchronized (x509ReqLock ) {
376+ WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
377+ WolfSSLDebug .INFO , this .x509ReqPtr ,
378+ "entered setPublicKey(" + key + ")" );
379+ }
372380
373381 if (key instanceof RSAPublicKey ) {
374382 keyType = WolfSSL .RSAk ;
@@ -442,9 +450,12 @@ public void addExtension(int nid, String value, boolean isCritical)
442450
443451 confirmObjectIsActive ();
444452
445- WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
446- WolfSSLDebug .INFO , this .x509ReqPtr , "entered addExtension(nid: " +
447- nid + ", value: " + value + ", isCritical: " + isCritical + ")" );
453+ synchronized (x509ReqLock ) {
454+ WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
455+ WolfSSLDebug .INFO , this .x509ReqPtr ,
456+ "entered addExtension(nid: " + nid + ", value: " + value +
457+ ", isCritical: " + isCritical + ")" );
458+ }
448459
449460 if (nid != WolfSSL .NID_key_usage &&
450461 nid != WolfSSL .NID_subject_alt_name &&
@@ -502,9 +513,12 @@ public void addExtension(int nid, boolean value, boolean isCritical)
502513
503514 confirmObjectIsActive ();
504515
505- WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
506- WolfSSLDebug .INFO , this .x509ReqPtr , "entered addExtension(nid: " +
507- nid + ", value: " + value + ", isCritical: " + isCritical + ")" );
516+ synchronized (x509ReqLock ) {
517+ WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
518+ WolfSSLDebug .INFO , this .x509ReqPtr ,
519+ "entered addExtension(nid: " + nid + ", value: " + value +
520+ ", isCritical: " + isCritical + ")" );
521+ }
508522
509523 if (nid != WolfSSL .NID_basic_constraints ) {
510524 throw new WolfSSLException (
@@ -553,10 +567,12 @@ public void signRequest(String filePath, int keyType, int format,
553567
554568 confirmObjectIsActive ();
555569
556- WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
557- WolfSSLDebug .INFO , this .x509ReqPtr , "entered signRequest(" +
558- filePath + ", keyType: " + keyType + ", format: " + format +
559- ", digestAlg: " + digestAlg + ")" );
570+ synchronized (x509ReqLock ) {
571+ WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
572+ WolfSSLDebug .INFO , this .x509ReqPtr , "entered signRequest(" +
573+ filePath + ", keyType: " + keyType + ", format: " + format +
574+ ", digestAlg: " + digestAlg + ")" );
575+ }
560576
561577 if (filePath == null || filePath .isEmpty ()) {
562578 throw new WolfSSLException ("File path is null or empty" );
@@ -604,10 +620,12 @@ public void signRequest(byte[] key, int keyType, int format,
604620
605621 confirmObjectIsActive ();
606622
607- WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
608- WolfSSLDebug .INFO , this .x509ReqPtr ,
609- "entered signRequest(byte[], keyType: " + keyType + ", format: " +
610- format + ", digestAlg: " + digestAlg + ")" );
623+ synchronized (x509ReqLock ) {
624+ WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
625+ WolfSSLDebug .INFO , this .x509ReqPtr ,
626+ "entered signRequest(byte[], keyType: " + keyType +
627+ ", format: " + format + ", digestAlg: " + digestAlg + ")" );
628+ }
611629
612630 if (key == null || key .length == 0 ) {
613631 throw new WolfSSLException ("Key array is null or empty" );
@@ -665,9 +683,12 @@ public void signRequest(PrivateKey key, String digestAlg)
665683
666684 confirmObjectIsActive ();
667685
668- WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
669- WolfSSLDebug .INFO , this .x509ReqPtr , "entered signRequest(key: " +
670- key + ", digestAlg: " + digestAlg + ")" );
686+ synchronized (x509ReqLock ) {
687+ WolfSSLDebug .log (getClass (), WolfSSLDebug .Component .JNI ,
688+ WolfSSLDebug .INFO , this .x509ReqPtr ,
689+ "entered signRequest(key: " + key + ", digestAlg: " +
690+ digestAlg + ")" );
691+ }
671692
672693 if (key == null ) {
673694 throw new WolfSSLException ("Key object is null" );
0 commit comments