@@ -557,7 +557,7 @@ public void init(KeyManager[] kms, TrustManager[] tms, SecureRandom sr) throws K
557557 SSL_CTX_set_verify (state .sslCtx , value ,
558558 SSL_CTX_set_verify$callback .allocate (new OpenSSLEngine .VerifyCallback (), contextArena ));
559559
560- // Trust and certificate verification
560+ // Trust and certificate verification (optional - may not be configured)
561561 if (tms != null ) {
562562 // Client certificate verification based on custom trust managers
563563 x509TrustManager = chooseTrustManager (tms );
@@ -580,7 +580,7 @@ public void init(KeyManager[] kms, TrustManager[] tms, SecureRandom sr) throws K
580580 log .debug (sm .getString ("openssl.addedClientCaCert" , caCert .toString ()));
581581 }
582582 }
583- } else {
583+ } else if ( sslHostConfig . getCaCertificateFile () != null || sslHostConfig . getCaCertificatePath () != null ) {
584584 // Client certificate verification based on trusted CA files and dirs
585585 MemorySegment caCertificateFileNative = sslHostConfig .getCaCertificateFile () != null ?
586586 localArena
@@ -590,9 +590,7 @@ public void init(KeyManager[] kms, TrustManager[] tms, SecureRandom sr) throws K
590590 localArena
591591 .allocateFrom (SSLHostConfig .adjustRelativePath (sslHostConfig .getCaCertificatePath ())) :
592592 MemorySegment .NULL ;
593- if ((sslHostConfig .getCaCertificateFile () != null || sslHostConfig .getCaCertificatePath () != null ) &&
594- SSL_CTX_load_verify_locations (state .sslCtx , caCertificateFileNative ,
595- caCertificatePathNative ) <= 0 ) {
593+ if (SSL_CTX_load_verify_locations (state .sslCtx , caCertificateFileNative , caCertificatePathNative ) <= 0 ) {
596594 logLastError ("openssl.errorConfiguringLocations" );
597595 } else {
598596 var caCerts = SSL_CTX_get_client_CA_list (state .sslCtx );
0 commit comments