问:
Could not read maven project in eclipse, Access denied
pom.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.hznt</groupId>
        <artifactId>yeahgo-dependencies-service</artifactId>
        <version>2.6.4-SNAPSHOT</version>
        <relativePath/>
    </parent>
    <artifactId>yeahgo-rest4php-service</artifactId>
    <version>${revision}</version>

    <properties>
        ...
    </properties>

    <dependencies>
       ...
    </dependencies>

    <build>
        <plugins>
            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-jar-plugin</artifactId>
               <version>2.4</version>
               <!-- <version>3.3.0</version> change version, still same error-->
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>flatten-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

</code>```

i got a error in eclipse:

```<code>Description Resource    Path    Location    Type
Could not read maven project (org.apache.maven.plugins:maven-jar-plugin:2.4:jar:default-jar:package)

org.eclipse.core.runtime.CoreException: Could not read maven project
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.lambda$3(MavenImpl.java:433)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:350)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:219)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:205)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.readProject(MavenImpl.java:424)
    at org.eclipse.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator.lambda$4(AbstractMavenArchiverConfigurator.java:576)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:350)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:262)
    at org.eclipse.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator.loadParentHierarchy(AbstractMavenArchiverConfigurator.java:568)
    at org.eclipse.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator.generateManifest(AbstractMavenArchiverConfigurator.java:364)
    at org.eclipse.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator.mavenProjectChanged(AbstractMavenArchiverConfigurator.java:227)
    at org.eclipse.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator$1.build(AbstractMavenArchiverConfigurator.java:177)
    at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:135)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:168)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$1(MavenBuilder.java:113)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:350)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:219)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$0(MavenBuilder.java:104)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:350)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:262)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:205)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:87)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:197)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1024)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:254)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:311)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:400)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:403)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:514)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:462)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:544)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:161)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:255)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: org.apache.maven.project.ProjectBuildingException: 1 problem was encountered while building the effective model
[FATAL] Non-readable POM C:\work\java\git\yeahgo-rest4php: C:\work\java\git\yeahgo-rest4php (Access denied。) @
 for project  at C:\work\java\git\yeahgo-rest4php
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:180)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:124)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.lambda$3(MavenImpl.java:431)
    ... 36 more
Caused by: org.apache.maven.model.building.ModelBuildingException: 1 problem was encountered while building the effective model
[FATAL] Non-readable POM C:\work\java\git\yeahgo-rest4php: C:\work\java\git\yeahgo-rest4php (Access denied。) @

    at org.apache.maven.model.building.DefaultModelProblemCollector.newModelBuildingException(DefaultModelProblemCollector.java:197)
    at org.apache.maven.model.building.DefaultModelBuilder.readModel(DefaultModelBuilder.java:687)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:303)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:267)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:173)
    ... 38 more
    pom.xml /yeahgo-rest4php-service    line 4  Maven Build Problem
</code>```

enter image description here

There is no problem with the project. I can execute any maven command, but there are always errors in eclipse
I tried many methods but failed to solve them. The error still appears, including:

Execute in eclipse, maven -> update project

Run as -> maven clean

Delete the error prompt in problems, and then it comes out again

Authorization directory, cmd -> cacls yeahgo-rest4php /e /g everyone:f

Create a new directory as Demo, copy src and pom.xml, and import them into eclipse

How do I resolve this error prompt?

There is no problem with the project itself. I run mvn clean install:

```<code>[INFO] --- maven-source-plugin:2.2.1:jar-no-fork (default) @ yeahgo-rest4php-service ---
[INFO] Building jar: C:\work\java\git\yeahgo-rest4php\target\yeahgo-rest4php-service-2.6.4-SNAPSHOT-sources.jar
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ yeahgo-rest4php-service ---
[INFO] Not copying test resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ yeahgo-rest4php-service ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ yeahgo-rest4php-service ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ yeahgo-rest4php-service ---
[INFO] Building jar: C:\work\java\git\yeahgo-rest4php\target\yeahgo-rest4php-service-2.6.4-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.1.2.RELEASE:repackage (default) @ yeahgo-rest4php-service ---
[INFO] Replacing main artifact with repackaged archive
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ yeahgo-rest4php-service ---
[INFO] Installing C:\work\java\git\yeahgo-rest4php\target\yeahgo-rest4php-service-2.6.4-SNAPSHOT.jar to C:\work\java\repository\com\hznt\yeahgo-rest4php-service\2.6.4-SNAPSHOT\yeahgo-rest4php-service-2.6.4-SNAPSHOT.jar
[INFO] Installing C:\work\java\git\yeahgo-rest4php\.flattened-pom.xml to C:\work\java\repository\com\hznt\yeahgo-rest4php-service\2.6.4-SNAPSHOT\yeahgo-rest4php-service-2.6.4-SNAPSHOT.pom
[INFO] Installing C:\work\java\git\yeahgo-rest4php\target\yeahgo-rest4php-service-2.6.4-SNAPSHOT-sources.jar to C:\work\java\repository\com\hznt\yeahgo-rest4php-service\2.6.4-SNAPSHOT\yeahgo-rest4php-service-2.6.4-SNAPSHOT-sources.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  9.769 s
[INFO] Finished at: 2022-12-09T13:15:59+08:00
[INFO] ------------------------------------------------------------------------
</code>```

Body:
pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.hznt</groupId>
        <artifactId>yeahgo-dependencies-service</artifactId>
        <version>2.6.4-SNAPSHOT</version>
        <relativePath/>
    </parent>
    <artifactId>yeahgo-rest4php-service</artifactId>
    <version>${revision}</version>

    <properties>
        ...
    </properties>

    <dependencies>
       ...
    </dependencies>

    <build>
        <plugins>
            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-jar-plugin</artifactId>
               <version>2.4</version>

            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>flatten-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

i got a error in eclipse:

Description Resource    Path    Location    Type
Could not read maven project (org.apache.maven.plugins:maven-jar-plugin:2.4:jar:default-jar:package)

org.eclipse.core.runtime.CoreException: Could not read maven project
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.lambda$3(MavenImpl.java:433)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:350)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:219)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:205)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.readProject(MavenImpl.java:424)
    at org.eclipse.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator.lambda$4(AbstractMavenArchiverConfigurator.java:576)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:350)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:262)
    at org.eclipse.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator.loadParentHierarchy(AbstractMavenArchiverConfigurator.java:568)
    at org.eclipse.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator.generateManifest(AbstractMavenArchiverConfigurator.java:364)
    at org.eclipse.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator.mavenProjectChanged(AbstractMavenArchiverConfigurator.java:227)
    at org.eclipse.m2e.mavenarchiver.internal.AbstractMavenArchiverConfigurator$1.build(AbstractMavenArchiverConfigurator.java:177)
    at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:135)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:168)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$1(MavenBuilder.java:113)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:350)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:219)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$0(MavenBuilder.java:104)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:350)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:262)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:205)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:87)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:197)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1024)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:254)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:311)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:400)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:403)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:514)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:462)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:544)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:161)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:255)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: org.apache.maven.project.ProjectBuildingException: 1 problem was encountered while building the effective model
[FATAL] Non-readable POM C:\work\java\git\yeahgo-rest4php: C:\work\java\git\yeahgo-rest4php (Access denied。) @
 for project  at C:\work\java\git\yeahgo-rest4php
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:180)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:124)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.lambda$3(MavenImpl.java:431)
    ... 36 more
Caused by: org.apache.maven.model.building.ModelBuildingException: 1 problem was encountered while building the effective model
[FATAL] Non-readable POM C:\work\java\git\yeahgo-rest4php: C:\work\java\git\yeahgo-rest4php (Access denied。) @

    at org.apache.maven.model.building.DefaultModelProblemCollector.newModelBuildingException(DefaultModelProblemCollector.java:197)
    at org.apache.maven.model.building.DefaultModelBuilder.readModel(DefaultModelBuilder.java:687)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:303)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:267)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:173)
    ... 38 more
    pom.xml /yeahgo-rest4php-service    line 4  Maven Build Problem

enter image description here

There is no problem with the project. I can execute any maven command, but there are always errors in eclipse
I tried many methods but failed to solve them. The error still appears, including:

Execute in eclipse, maven -> update project

Run as -> maven clean

Delete the error prompt in problems, and then it comes out again

Authorization directory, cmd -> cacls yeahgo-rest4php /e /g everyone:f

Create a new directory as Demo, copy src and pom.xml, and import them into eclipse

How do I resolve this error prompt?

There is no problem with the project itself. I run mvn clean install:

[INFO] --- maven-source-plugin:2.2.1:jar-no-fork (default) @ yeahgo-rest4php-service ---
[INFO] Building jar: C:\work\java\git\yeahgo-rest4php\target\yeahgo-rest4php-service-2.6.4-SNAPSHOT-sources.jar
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ yeahgo-rest4php-service ---
[INFO] Not copying test resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ yeahgo-rest4php-service ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ yeahgo-rest4php-service ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ yeahgo-rest4php-service ---
[INFO] Building jar: C:\work\java\git\yeahgo-rest4php\target\yeahgo-rest4php-service-2.6.4-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.1.2.RELEASE:repackage (default) @ yeahgo-rest4php-service ---
[INFO] Replacing main artifact with repackaged archive
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ yeahgo-rest4php-service ---
[INFO] Installing C:\work\java\git\yeahgo-rest4php\target\yeahgo-rest4php-service-2.6.4-SNAPSHOT.jar to C:\work\java\repository\com\hznt\yeahgo-rest4php-service\2.6.4-SNAPSHOT\yeahgo-rest4php-service-2.6.4-SNAPSHOT.jar
[INFO] Installing C:\work\java\git\yeahgo-rest4php\.flattened-pom.xml to C:\work\java\repository\com\hznt\yeahgo-rest4php-service\2.6.4-SNAPSHOT\yeahgo-rest4php-service-2.6.4-SNAPSHOT.pom
[INFO] Installing C:\work\java\git\yeahgo-rest4php\target\yeahgo-rest4php-service-2.6.4-SNAPSHOT-sources.jar to C:\work\java\repository\com\hznt\yeahgo-rest4php-service\2.6.4-SNAPSHOT\yeahgo-rest4php-service-2.6.4-SNAPSHOT-sources.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  9.769 s
[INFO] Finished at: 2022-12-09T13:15:59+08:00
[INFO] ------------------------------------------------------------------------


来源: stackexchange

问:
Zod field level validation isn't working, after the npm documentation still not working
I am trying to implement field level validation in my form but it is not working.
here are npm docment fot this. According to the document I should use :rules="fieldSchema" in the field but in my case it is not working.

My code

<FormField
  v-model="localFormData.about_me"
  :field-type="'textarea'"
  :field-info-on-top="true"
  :input-style="{ height: '10vh' }"
  :rules="fieldSchema"
/>
```
<p>and the schema</p>
<pre class="lang-js prettyprint-override"><code>const fieldSchema = toFieldValidator(
  zod.string().min(2).nonempty("this field is required")
);
</code>```

but it didn't work.

I expect result as the picture

Here when I will type in the field and if the field is empty the error will show.

ContentLicense: CC BY-SA 4.0

Body:
I am trying to implement field level validation in my form but it is not working.
here are npm docment fot this. According to the document I should use :rules="fieldSchema" in the field but in my case it is not working.

My code

<FormField
  v-model="localFormData.about_me"
  :field-type="'textarea'"
  :field-info-on-top="true"
  :input-style="{ height: '10vh' }"
  :rules="fieldSchema"
/>

and the schema

const fieldSchema = toFieldValidator(
  zod.string().min(2).nonempty("this field is required")
);

but it didn't work.

I expect result as the picture

Here when I will type in the field and if the field is empty the error will show.


问:
Including dependent non python file as part of setup.py
I'm building a Python application which I'm packaging with setuptools, so when it is installed I would like it to be available as command line tool as mentioned https://python-packaging.readthedocs.io/en/latest/command-line-scripts.html

This application is dependent on few files (both python and non-python file like yml). Currently, I'm adding these also as part of "scripts" keyword in setup.py. Is there any better way of handling this?

I'm using "scripts" keyword in setup.py so that when we install the package, setuptools will copy the script to our PATH and make it available for general use

```<code>setup(name='python-app',
      version='0.1.0',
      description='Python App',
      python_requires='>=3.9',
      packages=find_packages(),
      scripts=['python-app.py', 'dependent-python.py', 'dependent-yaml.yml']
     )
</code>```

This works just fine but I see dependent files are also available for general use at system level. Is there any better way of doing it?

Body:
I'm building a Python application which I'm packaging with setuptools, so when it is installed I would like it to be available as command line tool as mentioned https://python-packaging.readthedocs.io/en/latest/command-line-scripts.html

This application is dependent on few files (both python and non-python file like yml). Currently, I'm adding these also as part of "scripts" keyword in setup.py. Is there any better way of handling this?

I'm using "scripts" keyword in setup.py so that when we install the package, setuptools will copy the script to our PATH and make it available for general use

setup(name='python-app',
      version='0.1.0',
      description='Python App',
      python_requires='>=3.9',
      packages=find_packages(),
      scripts=['python-app.py', 'dependent-python.py', 'dependent-yaml.yml']
     )

This works just fine but I see dependent files are also available for general use at system level. Is there any better way of doing it?


问:
Flutter posting values for check and retrieving the results for next screen form api MSQL
I'm attempting to make a basic checking app using flutter and rest api, passing two distinct values over the api to see if they match some data and then getting the result from the searched api to pass the json response data on to the next page.

I want to send the selected data to an api so that it can be checked and retrieved with results based on the findings. This is the data I'm currently getting on my dropdown.

```<code>List routeFrom = [];
String? _routeFromSelected;
Future getStateList() async {
  var baseUrl = "API_HERE";

  http.Response response = await http.get(Uri.parse(baseUrl));

  if (response.statusCode == 200) {
    var jsonData = json.decode(response.body);
    setState(() {
      routeFrom = jsonData;
    });
  }
}
</code>```

Database Structure

Body:
I'm attempting to make a basic checking app using flutter and rest api, passing two distinct values over the api to see if they match some data and then getting the result from the searched api to pass the json response data on to the next page.

I want to send the selected data to an api so that it can be checked and retrieved with results based on the findings. This is the data I'm currently getting on my dropdown.

List routeFrom = [];
String? _routeFromSelected;
Future getStateList() async {
  var baseUrl = "API_HERE";

  http.Response response = await http.get(Uri.parse(baseUrl));

  if (response.statusCode == 200) {
    var jsonData = json.decode(response.body);
    setState(() {
      routeFrom = jsonData;
    });
  }
}

Database Structure


问:
Using joblib.memory and joblib.parallel together
I have the following code (removing the unnecessary parts):

```<code>location='./cachedir'
memory=Memory(location,verbose=0)

def epstArray_cost(f_array,g_array,b):
    <costly computation>
    return gt_array

epstArray_cost=memory.cache(epstArray_cost)

def epstArray(f_array,g_array,b):
    return epstArray_cost(f_array,g_array,b)

def globalArray(a):
    <do something>
    # Parallel(n_jobs=1)(delayed(epstArray)(f_array,g_array,b) for b in (range(mesh.n_points)))
    for b in range(mesh.n_points):
        g_array[b]=epstArray_cost(f_array,g_array,b)
    et=time.time()
    print('t:',et-st)
    <do something else>

<do something>

curpath=pathlib.Path(__file__).parent.absolute()
dirname=os.path.basename(curpath)
sup_dirpath=os.path.abspath(os.path.join(os.getcwd(), os.pardir))
mypath=join(curpath)

# Create temporary files for writing
tmp_dir = tempfile.mkdtemp()
values_fname_memmap = pathlib.Path(tmp_dir).joinpath("g_array")
f_array_fname_memmap = pathlib.Path(tmp_dir).joinpath("f_array")
mesh=pv.read(filelist[1])
g_array = np.memmap(values_fname_memmap.as_posix(),dtype=np.float32,shape=(mesh.n_points,12),mode='w+')
f_array = np.memmap(values_fname_memmap.as_posix(),dtype=np.float32,shape=(mesh.n_points,4),mode='w+')

Parallel(n_jobs=1)(delayed(globalArray)(a) for a in tqdm(range(len(filelist))))
</code>```

As you can see above I have 2 functions I want to run in parallel - globalArray and epstArray. epstArray is a costly computation and mostly repetitive, so I believe cached memory can be used. But the above code results in a Bus error. (n_jobs=1 is just a placeholder)

Is there any mistake I am making in this implementation? Also, please comment if the efficiency of the code can be increased in any fashion.

To give context, each of f_array and g_array has 16 million rows and 4 and 12 columns respectively.

Body:
I have the following code (removing the unnecessary parts):

location='./cachedir'
memory=Memory(location,verbose=0)

def epstArray_cost(f_array,g_array,b):
    <costly computation>
    return gt_array

epstArray_cost=memory.cache(epstArray_cost)

def epstArray(f_array,g_array,b):
    return epstArray_cost(f_array,g_array,b)

def globalArray(a):
    <do something>
    # Parallel(n_jobs=1)(delayed(epstArray)(f_array,g_array,b) for b in (range(mesh.n_points)))
    for b in range(mesh.n_points):
        g_array[b]=epstArray_cost(f_array,g_array,b)
    et=time.time()
    print('t:',et-st)
    <do something else>

<do something>

curpath=pathlib.Path(__file__).parent.absolute()
dirname=os.path.basename(curpath)
sup_dirpath=os.path.abspath(os.path.join(os.getcwd(), os.pardir))
mypath=join(curpath)

# Create temporary files for writing
tmp_dir = tempfile.mkdtemp()
values_fname_memmap = pathlib.Path(tmp_dir).joinpath("g_array")
f_array_fname_memmap = pathlib.Path(tmp_dir).joinpath("f_array")
mesh=pv.read(filelist[1])
g_array = np.memmap(values_fname_memmap.as_posix(),dtype=np.float32,shape=(mesh.n_points,12),mode='w+')
f_array = np.memmap(values_fname_memmap.as_posix(),dtype=np.float32,shape=(mesh.n_points,4),mode='w+')

Parallel(n_jobs=1)(delayed(globalArray)(a) for a in tqdm(range(len(filelist))))

As you can see above I have 2 functions I want to run in parallel - globalArray and epstArray. epstArray is a costly computation and mostly repetitive, so I believe cached memory can be used. But the above code results in a Bus error. (n_jobs=1 is just a placeholder)

Is there any mistake I am making in this implementation? Also, please comment if the efficiency of the code can be increased in any fashion.

To give context, each of f_array and g_array has 16 million rows and 4 and 12 columns respectively.


问:
SQLSTATE[HY093]: Invalid parameter number : Laravel
can some one help me. I have this error when I try to login a admin.

SQLSTATE[HY093]: Invalid parameter number (SQL: select users.firstname, users.lastname, clients.id as client_id from clients inner join users on clients.user_id = users.id inner join jobs on clients.id = jobs.client_id where clients.id = 1 and jobs.id = ? limit 1)

```<code>public function getSelectedClient($id)
{
    return $this
        ->model
        ->join('users', 'clients.user_id', '=', 'users.id')
        ->join('jobs','clients.id','=','jobs.client_id')
        ->select('users.firstname','users.lastname', 'clients.id as client_id')
        ->where('clients.id', $id)
        ->where('jobs.id',1)
        ->first();
}
</code>```

Can someone help me why i am experiencing this error. thank you in advance.

Body:
can some one help me. I have this error when I try to login a admin.

SQLSTATE[HY093]: Invalid parameter number (SQL: select users.firstname, users.lastname, clients.id as client_id from clients inner join users on clients.user_id = users.id inner join jobs on clients.id = jobs.client_id where clients.id = 1 and jobs.id = ? limit 1)

public function getSelectedClient($id)
{
    return $this
        ->model
        ->join('users', 'clients.user_id', '=', 'users.id')
        ->join('jobs','clients.id','=','jobs.client_id')
        ->select('users.firstname','users.lastname', 'clients.id as client_id')
        ->where('clients.id', $id)
        ->where('jobs.id',1)
        ->first();
}

Can someone help me why i am experiencing this error. thank you in advance.


问:
How to do Schema validation in Core WCF
Core WCF is new buzz in town.And support available there is limited.

I have existing webserive in framework 4.6 which i want to migrate to dot net 6 core WCF. i have having trouble with performing schema validation
Can anyone plese guide me here.

Thanks

Title: How to do Schema validation in Core WCF


问:
How to do transformation between two cameras (RGB and Thermal?
I have two cameras including RGB (raspberry pi high quality with lens(6mm, FOV 63)) and Thermla camera (MLX90640 (FOV 110)).

Current view

How to do transformation? like calibration of FOV. Images of two cameras should be exact same. Please see the expected result.

After transformation

I tried OpenCV transformation, But it doesn't work well depending on different Field of view in two cameras.

Here is arrangement of cameras in hardware enter image description here


问:
Chart JS, Crosshair drawing make memory excessive usage, What I've done wrong
I visualized almost 9000 data points in Bar type chart.

Using react-chartjs-2 librarry

my ctx drawing crosshair line code is right here

```<code>const crosshair = event => {
  ref.current.update('none');
  const x = event.nativeEvent.offsetX;
  const y = event.nativeEvent.offsetY;
  const {
    ctx,
    chartArea: { top, bottom, left, right, width, height },
  } = ref.current;
  ctx.save();

  ctx.strokeStyle = '#ffffff';
  ctx.lineWidth = 1;
  if (
    event.nativeEvent.offsetX >= left &&
    event.nativeEvent.offsetX <= right
  ) {
    ctx.beginPath();
    ctx.moveTo(left, event.nativeEvent.offsetY);
    ctx.lineTo(right, event.nativeEvent.offsetY);
    ctx.stroke();
    ctx.closePath();
    ctx.beginPath();
    ctx.moveTo(event.nativeEvent.offsetX, top);
    ctx.lineTo(event.nativeEvent.offsetX, bottom);
    ctx.stroke();
    ctx.closePath();
  }
};

<Bar ref={ref} data={chartData} options={options} onMouseMove={crosshair} />
</code>```

And
I checked chrome's devTool memory catagory.
JS heap memory usage increased almost 150MB when moving mouse move on chart.

The Big problem is...
CrossHair line does disappear right after moving mouse cursor few pixels.
Just a moment only crosshair visible and disappear soon.
If I turned off animation option (animation: flase), and moving mouse cursor very slowly then! crosshair is visible not disappear.
This is why i think memory usage is the cause.

Do you have any advise or tips for this situation??
Help...
Or have to know more information about my code? tell me~

Body:
I visualized almost 9000 data points in Bar type chart.

Using react-chartjs-2 librarry

my ctx drawing crosshair line code is right here

const crosshair = event => {
  ref.current.update('none');
  const x = event.nativeEvent.offsetX;
  const y = event.nativeEvent.offsetY;
  const {
    ctx,
    chartArea: { top, bottom, left, right, width, height },
  } = ref.current;
  ctx.save();

  ctx.strokeStyle = '#ffffff';
  ctx.lineWidth = 1;
  if (
    event.nativeEvent.offsetX >= left &&
    event.nativeEvent.offsetX <= right
  ) {
    ctx.beginPath();
    ctx.moveTo(left, event.nativeEvent.offsetY);
    ctx.lineTo(right, event.nativeEvent.offsetY);
    ctx.stroke();
    ctx.closePath();
    ctx.beginPath();
    ctx.moveTo(event.nativeEvent.offsetX, top);
    ctx.lineTo(event.nativeEvent.offsetX, bottom);
    ctx.stroke();
    ctx.closePath();
  }
};

<Bar ref={ref} data={chartData} options={options} onMouseMove={crosshair} />

And
I checked chrome's devTool memory catagory.
JS heap memory usage increased almost 150MB when moving mouse move on chart.

The Big problem is...
CrossHair line does disappear right after moving mouse cursor few pixels.
Just a moment only crosshair visible and disappear soon.
If I turned off animation option (animation: flase), and moving mouse cursor very slowly then! crosshair is visible not disappear.
This is why i think memory usage is the cause.

Do you have any advise or tips for this situation??
Help...
Or have to know more information about my code? tell me~


问:
I can't draw on the canvas
```<code><canvas id="myCanvas" width="300" height="300" style="border:1px solid #d3d3d3;">
</code>```

Mouse over <canvas> does not draw.

var TILE_WIDTH = 30;
var TILE_HEIGHT = 30;

document.getElementById("input").onchange = function() {
  var reader = new FileReader();
  reader.onload = function(e) {
    // get loaded data and render thumbnail.
    document.getElementById("image").src = e.target.result;
  };
  // read the image file as a data URL.
  reader.readAsDataURL(this.files[0]);
};

// The first function call to create photomosaic
function photomosaic(image) {

  // Dimensions of each tile
  var tileWidth = TILE_WIDTH;
  var tileHeight = TILE_HEIGHT;

  // creating the canvas for photomosaic
  var canvas = document.createElement('canvas');
  var context = canvas.getContext("2d");
  canvas.height = image.height;
  canvas.width = image.width;

  var imageData = context.getImageData(0, 0, image.width, image.height);
  var pixels = imageData.data;

  // The Number of mosaic tiles
  var numTileRows = image.width / tileWidth;
  var numTileCols = image.height / tileHeight;

  // The canvas copy of image
  var imageCanvas = document.createElement('canvas');
  var imageCanvasContext = canvas.getContext('2d');
  imageCanvas.height = image.height;
  imageCanvas.width = image.width;
  imageCanvasContext.drawImage(image, 0, 0);

  // A function for finding the average color
  function averageColor(row, column) {
    var blockSize = 1, // we can set how many pixels to skip

      data, width, height,
      i = -4,
      length,
      rgb = {
        r: 0,
        g: 0,
        b: 0
      },
      count = 0;

    try {
      data = imageCanvasContext.getImageData(column * TILE_WIDTH, row * TILE_HEIGHT, TILE_HEIGHT, TILE_WIDTH);
    } catch (e) {
      alert('Not happening this time!');
      return rgb;
    }

    length = data.data.length;

    while ((i += blockSize * 4) < length) {
      ++count;
      rgb.r += data.data[i];
      rgb.g += data.data[i + 1];
      rgb.b += data.data[i + 2];
    }

    // ~~ used to floor values
    rgb.r = ~~(rgb.r / count);
    rgb.g = ~~(rgb.g / count);
    rgb.b = ~~(rgb.b / count);

    return rgb;

  }

  // Loop through each tile
  for (var r = 0; r < numTileRows; r++) {
    for (var c = 0; c < numTileCols; c++) {
      // Set the pixel values for each tile
      var rgb = averageColor(r, c)
      var red = rgb.r;
      var green = rgb.g;
      var blue = rgb.b;

      // Loop through each tile pixel
      for (var tr = 0; tr < tileHeight; tr++) {
        for (var tc = 0; tc < tileWidth; tc++) {

          // Calculate the true position of the tile pixel
          var trueRow = (r * tileHeight) + tr;
          var trueCol = (c * tileWidth) + tc;

          // Calculate the position of the current pixel in the array
          var pos = (trueRow * (imageData.width * 4)) + (trueCol * 4);

          // Assign the colour to each pixel
          pixels[pos + 0] = red;
          pixels[pos + 1] = green;
          pixels[pos + 2] = blue;
          pixels[pos + 3] = 255;
        };
      };
    };
  };

  // Draw image data to the canvas
  context.putImageData(imageData, 0, 0);
  return canvas;
}

function create() {
  var image = document.getElementById('image');
  var canvas = photomosaic(image);
  document.getElementById("output").appendChild(canvas);
};```
<pre class="snippet-code-css lang-css prettyprint-override"><code>#output,
.container {
  text-align: center;
}

.inputDiv {
  margin: 20px 0px;
}

#image {
  width: 300px;
}</code>```

<!DOCTYPE html>

  <meta charset="utf-8">
  <title>test</title>

      <input id="input" type="file" accept="image/*">
      <button onclick="create()">create</button>

    <canvas id="myCanvas" width="300" height="300" style="border:1px solid #d3d3d3;">
  </canvas>

```

How do I create a circle when I touch the mouse? I'm sorry for the poor translation. This is the only place to ask. I'm also sorry that the code is very long. Not applicable to script ...

Title: I can't draw on the canvas

Body:
<canvas id="myCanvas" width="300" height="300" style="border:1px solid #d3d3d3;">

Mouse over <canvas> does not draw.

var TILE_WIDTH = 30;
var TILE_HEIGHT = 30;

document.getElementById("input").onchange = function() {
  var reader = new FileReader();
  reader.onload = function(e) {
    // get loaded data and render thumbnail.
    document.getElementById("image").src = e.target.result;
  };
  // read the image file as a data URL.
  reader.readAsDataURL(this.files[0]);
};

// The first function call to create photomosaic
function photomosaic(image) {

  // Dimensions of each tile
  var tileWidth = TILE_WIDTH;
  var tileHeight = TILE_HEIGHT;

  // creating the canvas for photomosaic
  var canvas = document.createElement('canvas');
  var context = canvas.getContext("2d");
  canvas.height = image.height;
  canvas.width = image.width;

  var imageData = context.getImageData(0, 0, image.width, image.height);
  var pixels = imageData.data;

  // The Number of mosaic tiles
  var numTileRows = image.width / tileWidth;
  var numTileCols = image.height / tileHeight;

  // The canvas copy of image
  var imageCanvas = document.createElement('canvas');
  var imageCanvasContext = canvas.getContext('2d');
  imageCanvas.height = image.height;
  imageCanvas.width = image.width;
  imageCanvasContext.drawImage(image, 0, 0);

  // A function for finding the average color
  function averageColor(row, column) {
    var blockSize = 1, // we can set how many pixels to skip

      data, width, height,
      i = -4,
      length,
      rgb = {
        r: 0,
        g: 0,
        b: 0
      },
      count = 0;

    try {
      data = imageCanvasContext.getImageData(column * TILE_WIDTH, row * TILE_HEIGHT, TILE_HEIGHT, TILE_WIDTH);
    } catch (e) {
      alert('Not happening this time!');
      return rgb;
    }

    length = data.data.length;

    while ((i += blockSize * 4) < length) {
      ++count;
      rgb.r += data.data[i];
      rgb.g += data.data[i + 1];
      rgb.b += data.data[i + 2];
    }

    // ~~ used to floor values
    rgb.r = ~~(rgb.r / count);
    rgb.g = ~~(rgb.g / count);
    rgb.b = ~~(rgb.b / count);

    return rgb;

  }

  // Loop through each tile
  for (var r = 0; r < numTileRows; r++) {
    for (var c = 0; c < numTileCols; c++) {
      // Set the pixel values for each tile
      var rgb = averageColor(r, c)
      var red = rgb.r;
      var green = rgb.g;
      var blue = rgb.b;

      // Loop through each tile pixel
      for (var tr = 0; tr < tileHeight; tr++) {
        for (var tc = 0; tc < tileWidth; tc++) {

          // Calculate the true position of the tile pixel
          var trueRow = (r * tileHeight) + tr;
          var trueCol = (c * tileWidth) + tc;

          // Calculate the position of the current pixel in the array
          var pos = (trueRow * (imageData.width * 4)) + (trueCol * 4);

          // Assign the colour to each pixel
          pixels[pos + 0] = red;
          pixels[pos + 1] = green;
          pixels[pos + 2] = blue;
          pixels[pos + 3] = 255;
        };
      };
    };
  };

  // Draw image data to the canvas
  context.putImageData(imageData, 0, 0);
  return canvas;
}

function create() {
  var image = document.getElementById('image');
  var canvas = photomosaic(image);
  document.getElementById("output").appendChild(canvas);
};

#output,
.container {
  text-align: center;
}

.inputDiv {
  margin: 20px 0px;
}

#image {
  width: 300px;
}

<!DOCTYPE html>

  <meta charset="utf-8">
  <title>test</title>

      <input id="input" type="file" accept="image/*">
      <button onclick="create()">create</button>

    <canvas id="myCanvas" width="300" height="300" style="border:1px solid #d3d3d3;">
  </canvas>

How do I create a circle when I touch the mouse? I'm sorry for the poor translation. This is the only place to ask. I'm also sorry that the code is very long. Not applicable to script ...


问:
client certificate authentication through Tomcat And Spring shows certificate as null in X509AuthenticationFilter
I know there are similar posts as to why the certificate - certs variable blow -  in Spring Filter in X509AuthenticationFilter.java comes out null

```<code>X509Certificate[] certs = (X509Certificate[])((X509Certificate[])request.getAttribute("javax.servlet.request.X509Certificate"));
</code>```

By reading this SO answer, I realized that I could print the TLS handshake and get details into what is going wrong. Prima Facie, I am of the opinion that the client is not sending the certificate. If I am not wrong, then at this point

```<code> Cert Authorities:
<CN=*.mycompanyname.com>
*** ServerHelloDone
https-jsse-nio-8443-exec-4, WRITE: TLSv1.2 Handshake, length = 4972
https-jsse-nio-8443-exec-5, READ: TLSv1.2 Handshake, length = 7
*** Certificate chain
<Empty>
***
</code>```

instead of empty, accordting to this blog - how to analyse Java SSL errors, if the client would have sent the client certificate, it would have a response something like

```<code>*** Certificate chain
chain [0] = [
[
  Version: V1
  Subject: CN=Application 3, OU=Smartjava, O=Smartjava, L=NL, ST=ZH, C=NL
  Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5

  Key:  Sun RSA public key, 1024 bits
  modulus: 90655907749318585147523875906892969031300830816947226352221659107570169820452561428696751943383590982109524990627182456571533992582229229163232831159652561902456847954385746762477844009336466314872376131553489447601649924116778337873632641536164462534398137791450495316700015095054427027256393580022887087767
  public exponent: 65537
  Validity: [From: Mon Mar 12 15:13:24 CET 2012,
               To: Tue Mar 12 15:13:24 CET 2013]
  Issuer: CN=Application CA, OU=Smartjava, O=Smartjava, L=Maasland, ST=ZH, C=NL
  SerialNumber: [    b247ffb2 ce060768]

]

</code>```

As there are lots of pieces of gettin this right (trust store, keystore, tomcat configuration, creating the certificates well, knowing where to place what artifacts), it seems to me to have an initial heavy lifting before getting this right. Not to mention there being two strategies to do this - a) No neccessity to keep client ceritifcates in trust store rather only keeping CA authority certificate in trust store and only using it to sign client certificates and b) placing all client certificates in the trust store

I have followed the first approach presented in this blog post X.509 client certificates with Spring Security

What I have done?
I have a CA certifite issued by GoGetSSL RSA DV CA, O=GoGetSSL, L=Riga, C=LV

I am using it as my CA authority that will sign client certificates. Hence I have placed this in the trust store. I placed it in the truststore by doing

keytool -import -file servercert_2022.crt -alias serverCA -keystore truststore.jks

It looks like

```<code>Keystore provider: SUN

Your keystore contains 1 entry

Alias name: serverca
Creation date: Dec 9, 2022
Entry type: trustedCertEntry

Owner: CN=*.mycompanyname.com
Issuer: CN=GoGetSSL RSA DV CA, O=GoGetSSL, L=Riga, C=LV
Serial number: 2a49d139988338b92dee3274c70e8428
Valid from: Tue Nov 29 05:30:00 IST 2022 until: Sat Dec 30 05:29:59 IST 2023
Certificate fingerprints:
         MD5:  82:4D:8C:61:CD:D8:65:60:99:78:F3:D2:7E:B3:73:30
         SHA1: 4D:DC:24:25:5A:67:41:E7:4D:FF:1A:B3:F8:B6:7E:A1:17:B0:58:A0
         SHA256: 2E:24:AF:0A:8C:25:B7:D5:89:06:3E:DC:08:FA:2D:69:A4:DF:58:8F:E4:                                                                                08:AB:DD:EB:EE:2C:1D:2B:EA:EC:DD
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3

Extensions:

#1: ObjectId: 1.3.6.1.4.1.11129.2.4.2 Criticality=false
0000: 04 82 01 69 01 67 00 75   00 AD F7 BE FA 7C FF 10  ...i.g.u........
0010: C8 8B 9D 3D 9C 1E 3E 18   6A B4 67 29 5D CF B1 0C  ...=..>.j.g)]...

#2: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
  [
   accessMethod: caIssuers
   accessLocation: URIName: http://crt.usertrust.com/GoGetSSLRCA.crt
,
   accessMethod: ocsp
   accessLocation: URIName: http://ocsp.usertrust.com
]
]

#3: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: F9 FB 50 C4 8B 67 BB 67   64 FE 83 21 A6 A9 CE 3F  ..P..g.gd..!...?
0010: 55 84 93 99                                        U...
]
]

#4: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:false
  PathLen: undefined
]

#5: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://crl.usertrust.com/GoGetSSLRSCA.crl]
]]

#6: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [1.3.6.1.2.2.64]
[PolicyQualifierInfo: [
  qualifierID: 1.3.6.1.5.5.7.2.1
  qualifier: 0000: 16 19 68 74 74 70 73 3A   2F 2F 63 70 73 2E 75 73  ..https://                                                                                cps.us
0010: 65 72 74 72 75 73 74 2E   63 6F 6D                 ertrust.com

]]  ]
  [CertificatePolicyId: [2.23.140.1.2.1]
[]  ]
]

#7: ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
  serverAuth
  clientAuth
]

#8: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_Encipherment
]

#9: ObjectId: 2.5.29.17 Criticality=false
SubjectAlternativeName [
  DNSName: *.mycompanyname.com
  DNSName: mycompanyname.com
]

#10: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 84 D5  F7 50 98 94 E8  .......G..d.P...
0010: B8 63 D4 B5                                        .c..
]
]
</code>```

I added my certificate-key to keystore by

My key is a in keystore.p12 file. I read that the key along with server certificate can be placed in the keystore by doing this

```<code>winpty openssl pkcs12 -export -in servercert_2022.crt -inkey private.pem -certfile servercert_2022.crt -out keystore.p12
</code>```

Keystore looks like this

```<code>Keystore type: jks
Keystore provider: SUN

Your keystore contains 1 entry

Alias name: 1
Creation date: Dec 9, 2022
Entry type: PrivateKeyEntry
Certificate chain length: 3
Certificate[1]:
Owner: CN=*.mycompanyname.com
Issuer: CN=GoGetSSL
Serial number: 2a0e8428
Valid from: Tue Nov 29 05:30:00 IST 2022 until: Sat Dec 30 05:29:59 IST 2023
Certificate fingerprints:
         MD5:  82:4D:8C:61:CD:D8:65:60:99:78:F3:D2:7E:B3:73:30
         SHA1: 4D:DC:24:25:5A:67:41:E7:4D:FF:1A:B3:F8:B6:7E:A1:17:B0:58:A0
         SHA256: 2E:24:AF:0A:8C:25:B7:D5:89:06:3E:DC:08:FA:2D:69:A4:DF:58:8F:E4:08:AB:DD:EB:EE:2C:1D:2B:EA:EC:DD
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3

Extensions:

#1: ObjectId: 1.3.6.1.4.1.11129.2.4.2 Criticality=false
0000: 04 82 01 69 01 67 00 75   00 AD F7 BE FA 7C FF 10  ...i.g.u......
0160: 16 84 D3 72 78 21 62 96   FA 96 A7 55 D5           ...rx!b....U.

#2: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
  [
   accessMethod: caIssuers
   accessLocation: URIName: http://crt.usertrust.com/GoGetSSLADVCA.crt
,
   accessMethod: ocsp
   accessLocation: URIName: http://ocsp.usertrust.com
]
]

#3: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: F9 FB 50 C4 8B 67 BB 67   64 FE 83 21 A6 A9 CE 3F  ..P..g.gd..!...?
0010: 55 84 93 99                                        U...
]
]

#4: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:false
  PathLen: undefined
]

#5: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://crl.usertrust.com/GoGetSSLADVCA.crl]
]]

#6: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [1.3.6.1.4.1.6449.1.2.2.64]
[PolicyQualifierInfo: [
  qualifierID: 1.3.6.1.5.5.7.2.1
  qualifier: 0000: 16 19 68 74 74 70 73 3A   2F 2F 63 70 73 2E 75 73  ..https://cps.us
0010: 65 72 74 72 75 73 74 2E   63 6F 6D                 ertrust.com

]]  ]
  [CertificatePolicyId: [2.23.140.1.2.1]
[]  ]
]

#7: ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
  serverAuth
  clientAuth
]

#8: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_Encipherment
]

#9: ObjectId: 2.5.29.17 Criticality=false
SubjectAlternativeName [
  DNSName: *.mycompanyname.com
  DNSName: mycompanyname.com
]

#10: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 84 D5 11 9F 12 AB 0A 47   D3 DD 64 F7 50 98 94 E8  .......G..d.P...
0010: B8 63 D4 B5                                        .c..
]
]

Certificate[2]:
Owner: CN=GoGetSSL RSA DV CA, O=GoGetSSL, L=Riga, C=LV
Issuer: CN=USERTrust RSA Certification Authority, O=The USERTRUST Network, L=Jersey City, ST=New Jersey, C=US
Serial number: 938bb08e62987b4f75f98cb6a5045c96
Valid from: Thu Sep 06 05:30:00 IST 2018 until: Wed Sep 06 05:29:59 IST 2028
Certificate fingerprints:
         MD5:  4E:81:90:9E:43:B3:18:66
         SHA1: 07:0A:72:6C:6E:44:18:DC:F
         SHA256: 43:CA:C3:1E:F8:E8:BA:1B:4B:16:B8:20:6E:4C:0A:26:C5:BA:D:C2:FD:64
Signature algorithm name: SHA384withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3

Extensions:

#1: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
  [
   accessMethod: caIssuers
   accessLocation: URIName: http://crt.usertrust.com/USERTrustRSAAddTrustCA.crt
,
   accessMethod: ocsp
   accessLocation: URIName: http://ocsp.usertrust.com
]
]

#2: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: 53 79 BF 5A AA 2B 4A CF   54 80 E1 D8 9B C0 9D F2  Sy.Z.+J.T.......
0010: B2 03 66 CB                                        ..f.
]
]

#3: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:true
  PathLen:0
]

#4: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://crl.usertrust.com/USERTrustRSACertificationAuthority.crl]
]]

#5: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [1.3..2.2.64]
[]  ]
  [CertificatePolicyId: [2.23.140.1.2.1]
[]  ]
]

#6: ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
  serverAuth
  clientAuth
]

#7: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_CertSign
  Crl_Sign
]

#8: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: F9 FB 50 C4 8B 67 BB 67   64 FE 83 21 A6 A9 CE 3F  ..P..g.gd..!...?
0010: 55 84 93 99                                        U...
]
]

Certificate[3]:
Owner: CN=USERTrust RSA Certification Authority, O=The USERTRUST Network, L=Jersey City, ST=New Jersey, C=US
Issuer: CN=AAA Certificate Services, O=Comodo CA Limited, L=Salford, ST=Greater Manchester, C=GB
Serial number: 3972443af922b751d7d36c10dd313595
Valid from: Tue Mar 12 05:30:00 IST 2019 until: Mon Jan 01 05:29:59 IST 2029
Certificate fingerprints:
         MD5:  28:5E:C9:09:C4:AB:0D:2D:57:F5:08:6B:22:57:99:AA
         SHA1: D8:9E:3B:D4:3D:5D:90:9B:47:A1:89:77:AA:9D:5C:E3:6C:EE:18:4C
         SHA256: 68:B9:C7:61:21:9A:5B:1F:01:31:78:44:74:66:5D:B6:1B:BD:B1:09:E0:0F:05:CA:9F:74:24:4E:E5:F5:F5:2B
Signature algorithm name: SHA384withRSA
Subject Public Key Algorithm: 4096-bit RSA key
Version: 3

Extensions:

#1: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
  [
   accessMethod: ocsp
   accessLocation: URIName: http://ocsp.comodoca.com
]
]

#2: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: A0 11 0A 23 3E 96 F1 07   EC E2 AF 29 EF 82 A5 7F  ...#>......)....
0010: D0 30 A4 B4                                        .0..
]
]

#3: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:true
  PathLen:2147483647
]

#4: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://crl.comodoca.com/AAACertificateServices.crl]
]]

#5: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [2.5.29.32.0]
[]  ]
]

#6: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_CertSign
  Crl_Sign
]

#7: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 53 79 BF 5A AA 2B 4A CF   54 80 E1 D8 9B C0 9D F2  Sy.Z.+J.T.......
0010: B2 03 66 CB                                        ..f.
]
]

*******************************************
</code>```

My tomcat connector looks like this

```<code><Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" scheme="https" secure="true"
            clientAuth="want" sslProtocol="TLS"
            keystoreFile="C:\Company\keys\keystore.p12"
            keystoreType="PKCS12" keystorePass="password"
            truststoreFile="C:\Company\keys\truststore.jks"
            truststoreType="JKS" truststorePass="password"/>
</code>```

My spring security configuration looks like this

```<code><http pattern="/api/mutualauthenticationtest"  create-session="never"
          authentication-manager-ref="authenticationManager"
          entry-point-ref="oauthAuthenticationEntryPoint"
          access-decision-manager-ref="accessDecisionManager"
          xmlns="http://www.springframework.org/schema/security"

          use-expressions="true">

        <csrf disabled="true"/>
        <x509 subject-principal-regex="CN=(.*?)," />

    </http>
</code>```

With the above configuration the debugger is able to reach inside the X509AuthenticationFilter.java class at this place at the line with variable certs

```<code>private X509Certificate extractClientCertificate(HttpServletRequest request) {
        X509Certificate[] certs = (X509Certificate[])((X509Certificate[])request.getAttribute("javax.servlet.request.X509Certificate"));
        if (certs != null && certs.length > 0) {
            if (this.logger.isDebugEnabled()) {
                this.logger.debug("X.509 client authentication certificate:" + certs[0]);
            }

            return certs[0];
        } else {
            if (this.logger.isDebugEnabled()) {
                this.logger.debug("No client certificate found in request.");
            }

            return null;
        }
    }
</code>```

for the API curl API request that I make to this API. The curl request has my client certificate attached

```<code>curl -k --location --request POST 'https://localhost:8443/api/mutualauthenticationtest' \

--header 'clientid: 3' \
--header 'Content-Type: application/json' \
--header 'Cookie: JSESSIONID=464646778768678678676' \
--cert client.crt \
--key clientprivate.key \
--data-raw '{"userID":"someuserid"}'
</code>```

The client.crt in the curl request was generated with the help of client.csr (signing request), client private key and signed by the server certificate and server private key.

client private key

```<code> Cert Authorities:
<CN=*.mycompanyname.com>
*** ServerHelloDone
https-jsse-nio-8443-exec-4, WRITE: TLSv1.2 Handshake, length = 4972
https-jsse-nio-8443-exec-5, READ: TLSv1.2 Handshake, length = 7
*** Certificate chain
<Empty>
***
</code>```0

client csr

```<code> Cert Authorities:
<CN=*.mycompanyname.com>
*** ServerHelloDone
https-jsse-nio-8443-exec-4, WRITE: TLSv1.2 Handshake, length = 4972
https-jsse-nio-8443-exec-5, READ: TLSv1.2 Handshake, length = 7
*** Certificate chain
<Empty>
***
</code>```1

Initially, I had created my own CA server certificate with CN localhost. But after reading some comments on SO, I used a genuine Server certificate with CN:mycompanyname.com. I also created  the client CSR with the CN=somesubdomain.mycompanyname.com so that it matches the domain *.mycompanyname.com

Here's how the  client certificate was created

```<code> Cert Authorities:
<CN=*.mycompanyname.com>
*** ServerHelloDone
https-jsse-nio-8443-exec-4, WRITE: TLSv1.2 Handshake, length = 4972
https-jsse-nio-8443-exec-5, READ: TLSv1.2 Handshake, length = 7
*** Certificate chain
<Empty>
***
</code>```2

Placing below the entire handshake if it helps someone help me get to the bottom of this.

```<code>    https-jsse-nio-8443-exec-4, READ: TLSv1 Handshake, length = 512
*** ClientHello, TLSv1.2
RandomCookie:  GMT: -2129767729 bytes = { 47, 24, 48, 232, 111, 34, 57, 141, 51, 1, 246, 45, 164, 70, 153, 138, 39, 181, 40, 12, 168, 95, 109, 1, 194, 50, 38, 131 }
Session ID:  {}

*** Certificate chain
chain [0] = [
[
  Version: V3
  Subject: CN=*.mycompanyname.com
  Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11

  Key:  Sun RSA public key, 2048 bits
  modulus: 2622705370403332787775762243661727944626694756503406987897017427384873636985758217173690153198533118362188933540538596405165697331
  public exponent: 65537
  Validity: [From: Tue Nov 29 00:00:00 UTC 2022,
               To: Fri Dec 29 23:59:59 UTC 2023]
  Issuer: CN=GoGetSSL RSA DV CA, O=GoGetSSL, L=Riga, C=LV
  SerialNumber: [    2a49d139 988338b9 2dee3274 c70e8428]

Certificate Extensions: 10
[3]: ObjectId: 1.3.6.1.4.1.11129.2.4.2 Criticality=false
Extension unknown: DER encoded OCTET string =
0000: 04 82 01 6D 04 82 01 69   01 67 00 75 00 AD F7 BE  ...m...i.g.u....
0010: FA 7C FF 10 C8 8B 9D 3D   9C 1E 3E 18 6A B4 67 29  .......=..>.j.g)

0170: D5                                                 .

[3]: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
  [
   accessMethod: caIssuers
   accessLocation: URIName: http://crt.usertrust.com/GoGetSSLRSADVCA.crt
,
   accessMethod: ocsp
   accessLocation: URIName: http://ocsp.usertrust.com
]
]

[3]: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: F9 FB 50 C4 8B 67 BB 67   64 FE 83 21 A6 A9 CE 3F  ..P..g.gd..!...?
0010: 55 84 93 99                                        U...
]
]

[4]: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:false
  PathLen: undefined
]

[5]: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://crl.usertrust.com/GoGetSSLRSADVCA.crl]
]]

[6]: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [1.3.6.1.4.1.6449.1.2.2.64]
[PolicyQualifierInfo: [
  qualifierID: 1.3.6.1.5.5.7.2.1
  qualifier: 0000: 16 19 68 74 74 70 73 3A   2F 2F 63 70 73 2E 75 73  ..https://cps.us
0010: 65 72 74 72 75 73 74 2E   63 6F 6D                 ertrust.com

]]  ]
  [CertificatePolicyId: [2.23.140.1.2.1]
[]  ]
]

[7]: ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
  serverAuth
  clientAuth
]

[8]: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_Encipherment
]

[9]: ObjectId: 2.5.29.17 Criticality=false
SubjectAlternativeName [
  DNSName: *.mycompanyname.com
  DNSName: mycompanyname.com
]

[10]: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 84 D5 11 9F 12 AB 0A 47   D3 DD 64 F7 50 98 94 E8  .......G..d.P...
0010: B8 63 D4 B5                                        .c..
]
]

]
  Algorithm: [SHA256withRSA]
  Signature:
0000: 41 55 D9 6E D1 C1 7E E1   CE D9 DA 01 D6 83 94 7C  AU.n............
0010: EF 9E 27 3A 46 9C B1 32   9A E9 C3 1E 36 8E 1C 71  ..':F..2....6..q

]
chain [3] = [
[
  Version: V3
  Subject: CN=GoGetSSL
  Signature Algorithm: SHA384withRSA, OID = 1.2.840.113549.1.1.12

  Key:  Sun RSA public key, 2048 bits
  modulus: 2016675053399680968778139946606275282233371636099081255780548426567610365288242376854592612489780940673622601461569960956302879926833060318530351
  public exponent: 65537
  Validity: [From: Thu Sep 06 00:00:00 UTC 2018,
               To: Tue Sep 05 23:59:59 UTC 2028]
  Issuer: CN=USERTrust RSA Certification Authority, O=The USERTRUST Network, L=Jersey City, ST=New Jersey, C=US
  SerialNumber: [    938bb08e 62987b4f 75f98cb6 a5045c96]

Certificate Extensions: 8
[3]: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
  [
   accessMethod: caIssuers
   accessLocation: URIName: http://crt.usertrust.com/USERTrustRSAAddTrustCA.crt
,
   accessMethod: ocsp
   accessLocation: URIName: http://ocsp.usertrust.com
]
]

[3]: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: 53 79 BF 5A AA 2B 4A CF   54 80 E1 D8 9B C0 9D F2  Sy.Z.+J.T.......
0010: B2 03 66 CB                                        ..f.
]
]

[3]: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:true
  PathLen:0
]

[4]: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://crl.usertrust.com/USERTrustRSACertificationAuthority.crl]
]]

[5]: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [1.3.6.1.4.1.6449.1.2.2.64]
[]  ]
  [CertificatePolicyId: [2.23.140.1.2.1]
[]  ]
]

[6]: ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
  serverAuth
  clientAuth
]

[7]: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_CertSign
  Crl_Sign
]

[8]: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: F9 FB 50 C4 8B 67 BB 67   64 FE 83 21 A6 A9 CE 3F  ..P..g.gd..!...?
0010: 55 84 93 99                                        U...
]
]

]
  Algorithm: [SHA384withRSA]
  Signature:
0000: 5D 74 43 28 78 80 E4 33   A1 34 AB 33 B7 06 B2 73  ]tC(x..3.4.3...s

01F0: 3C 4D 84 C0 E6 21 79 E3   11 E5 AB 16 F0 19 42 19  <M...!y.......B.

]
chain [3] = [
[
  Version: V3
  Subject: CN=USERTrust RSA Certification Authority, O=The USERTRUST Network, L=Jersey City, ST=New Jersey, C=US
  Signature Algorithm: SHA384withRSA, OID = 1.2.840.113549.1.1.12

  Key:  Sun RSA public key, 4096 bits
  modulus: 52248758361752507534246388533722547304608772308115673058706321503049610972993225326579926576629493740386532378470836364707455134729548367373189550921756904777340153719441907345834660183638543
  public exponent: 65537
  Validity: [From: Tue Mar 12 00:00:00 UTC 2019,
               To: Sun Dec 31 23:59:59 UTC 2028]
  Issuer: CN=AAA Certificate Services, O=Comodo CA Limited, L=Salford, ST=Greater Manchester, C=GB
  SerialNumber: [    3972443a f922b751 d7d36c10 dd313595]

Certificate Extensions: 7
[3]: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
  [
   accessMethod: ocsp
   accessLocation: URIName: http://ocsp.comodoca.com
]
]

[3]: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: A0 11 0A 23 3E 96 F1 07   EC E2 AF 29 EF 82 A5 7F  ...#>......)....
0010: D0 30 A4 B4                                        .0..
]
]

[3]: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:true
  PathLen:2147483647
]

[4]: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://crl.comodoca.com/AAACertificateServices.crl]
]]

[5]: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [2.5.29.32.0]
[]  ]
]

[6]: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_CertSign
  Crl_Sign
]

[7]: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 53 79 BF 5A AA 2B 4A CF   54 80 E1 D8 9B C0 9D F2  Sy.Z.+J.T.......
0010: B2 03 66 CB                                        ..f.
]
]

]
  Algorithm: [SHA384withRSA]
  Signature:
0000: 18 87 51 DC 74 21 3D 9C   8A E0 27 B7 33 D0 2E CC  ..Q.t!=...'.3...

00F0: 7F 8E 76 72 99 0C 9D FE   D7 91 08 16 A1 A3 5F 95  ..vr.........._.

]
***
*** ECDH ServerKeyExchange
Signature Algorithm SHA512withRSA
Server key: Sun EC public key, 256 bits
  public x coord: 19352321750303628830904646093808624566974313423482165871643805927488532053250
  public y coord: 45496769771360840433108417226772017731510614660888440135094323373501113499217
  parameters: secp256r1 [NIST P-256, X9.62 prime256v1] (1.2.840.10045.3.1.7)
*** CertificateRequest
Cert Types: RSA, DSS, ECDSA
Supported Signature Algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA256withDSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA
Cert Authorities:
<CN=*.mycompanyname.com>
*** ServerHelloDone
https-jsse-nio-8443-exec-4, WRITE: TLSv1.2 Handshake, length = 4972
https-jsse-nio-8443-exec-5, READ: TLSv1.2 Handshake, length = 7
*** Certificate chain
<Empty>
***
https-jsse-nio-8443-exec-5, READ: TLSv1.2 Handshake, length = 70
*** ECDHClientKeyExchange
ECDH Public value:  { 4, 53, 247, 204, 77, 62, 51, 36, 140, 49, 178, 158, 159, 179, 238, 225, 234, 153, 124, 198, 178, 83, 148, 252, 78, 0, 17, 70, 200, 87, 141, 60, 255, 50, 144, 12, 181, 38, 254, 238, 59, 9, 254, 105, 34, 65, 212, 57, 27, 115, 17, 41, 88, 128, 128, 253, 149, 157, 18, 174, 252, 114, 131, 231, 6 }
SESSION KEYGEN:
PreMaster Secret:
0000: BE E4 A9 B5 9D A7 F6 60   18 98 9B E6 CA 24 4D FA  .......`.....$M.
0010: 91 B6 4A 02 37 D1 C1 F3   2D 74 30 EF 64 05 AC 35  ..J.7...-t0.d..5
CONNECTION KEYGEN:
Client Nonce:
0000: 81 0E 53 CF 2F 18 30 E8   6F 22 39 8D 33 01 F6 2D  ..S./.0.o"9.3..-
0010: A4 46 99 8A 27 B5 28 0C   A8 5F 6D 01 C2 32 26 83  .F..'.(.._m..2&.
Server Nonce:
0000: 63 92 B1 A6 7F 81 DC C2   3B E7 19 A6 A4 FC 5F D8  c.......;....._.
0010: AC 17 FC 60 C9 3D E8 A2   A7 C0 CE 82 62 0F F4 21  ...`.=......b..!
Master Secret:
0000: 7E 20 23 1F 02 34 2E 40   73 18 5F 5A 09 F4 B6 28  . #..4.@s._Z...(
0010: 1B 30 D2 F3 2E A8 85 BA   72 2F FC 79 57 2C F3 5B  .0......r/.yW,.[
0020: 70 E8 81 50 90 D4 DB 3C   4E 7D 89 A8 A1 68 EC DC  p..P...<N....h..
... no MAC keys used for this cipher
0000: A8 B8 56 36                                        ..V6
Server write IV:
0000: 5F 42 7E 2E
</code>```

What could I be possibly doing wrong that the client is unable to send the certificate (if my conjecture is right) or simply, why the certs variable is null when the certificate is being read from inside the request.getAttribute() mentioned in the very first line of this post? Any help will be immensely appreciated.

Body:
I know there are similar posts as to why the certificate - certs variable blow -  in Spring Filter in X509AuthenticationFilter.java comes out null

X509Certificate[] certs = (X509Certificate[])((X509Certificate[])request.getAttribute("javax.servlet.request.X509Certificate"));

By reading this SO answer, I realized that I could print the TLS handshake and get details into what is going wrong. Prima Facie, I am of the opinion that the client is not sending the certificate. If I am not wrong, then at this point

 Cert Authorities:
<CN=*.mycompanyname.com>
*** ServerHelloDone
https-jsse-nio-8443-exec-4, WRITE: TLSv1.2 Handshake, length = 4972
https-jsse-nio-8443-exec-5, READ: TLSv1.2 Handshake, length = 7
*** Certificate chain
<Empty>
***

instead of empty, accordting to this blog - how to analyse Java SSL errors, if the client would have sent the client certificate, it would have a response something like

*** Certificate chain
chain [0] = [
[
  Version: V1
  Subject: CN=Application 3, OU=Smartjava, O=Smartjava, L=NL, ST=ZH, C=NL
  Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5

  Key:  Sun RSA public key, 1024 bits
  modulus: 90655907749318585147523875906892969031300830816947226352221659107570169820452561428696751943383590982109524990627182456571533992582229229163232831159652561902456847954385746762477844009336466314872376131553489447601649924116778337873632641536164462534398137791450495316700015095054427027256393580022887087767
  public exponent: 65537
  Validity: [From: Mon Mar 12 15:13:24 CET 2012,
               To: Tue Mar 12 15:13:24 CET 2013]
  Issuer: CN=Application CA, OU=Smartjava, O=Smartjava, L=Maasland, ST=ZH, C=NL
  SerialNumber: [    b247ffb2 ce060768]

]

As there are lots of pieces of gettin this right (trust store, keystore, tomcat configuration, creating the certificates well, knowing where to place what artifacts), it seems to me to have an initial heavy lifting before getting this right. Not to mention there being two strategies to do this - a) No neccessity to keep client ceritifcates in trust store rather only keeping CA authority certificate in trust store and only using it to sign client certificates and b) placing all client certificates in the trust store

I have followed the first approach presented in this blog post X.509 client certificates with Spring Security

What I have done?
I have a CA certifite issued by GoGetSSL RSA DV CA, O=GoGetSSL, L=Riga, C=LV

I am using it as my CA authority that will sign client certificates. Hence I have placed this in the trust store. I placed it in the truststore by doing

keytool -import -file servercert_2022.crt -alias serverCA -keystore truststore.jks

It looks like

Keystore provider: SUN

Your keystore contains 1 entry

Alias name: serverca
Creation date: Dec 9, 2022
Entry type: trustedCertEntry

Owner: CN=*.mycompanyname.com
Issuer: CN=GoGetSSL RSA DV CA, O=GoGetSSL, L=Riga, C=LV
Serial number: 2a49d139988338b92dee3274c70e8428
Valid from: Tue Nov 29 05:30:00 IST 2022 until: Sat Dec 30 05:29:59 IST 2023
Certificate fingerprints:
         MD5:  82:4D:8C:61:CD:D8:65:60:99:78:F3:D2:7E:B3:73:30
         SHA1: 4D:DC:24:25:5A:67:41:E7:4D:FF:1A:B3:F8:B6:7E:A1:17:B0:58:A0
         SHA256: 2E:24:AF:0A:8C:25:B7:D5:89:06:3E:DC:08:FA:2D:69:A4:DF:58:8F:E4:                                                                                08:AB:DD:EB:EE:2C:1D:2B:EA:EC:DD
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3

Extensions:

#1: ObjectId: 1.3.6.1.4.1.11129.2.4.2 Criticality=false
0000: 04 82 01 69 01 67 00 75   00 AD F7 BE FA 7C FF 10  ...i.g.u........
0010: C8 8B 9D 3D 9C 1E 3E 18   6A B4 67 29 5D CF B1 0C  ...=..>.j.g)]...

#2: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
  [
   accessMethod: caIssuers
   accessLocation: URIName: http://crt.usertrust.com/GoGetSSLRCA.crt
,
   accessMethod: ocsp
   accessLocation: URIName: http://ocsp.usertrust.com
]
]

#3: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: F9 FB 50 C4 8B 67 BB 67   64 FE 83 21 A6 A9 CE 3F  ..P..g.gd..!...?
0010: 55 84 93 99                                        U...
]
]

#4: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:false
  PathLen: undefined
]

#5: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://crl.usertrust.com/GoGetSSLRSCA.crl]
]]

#6: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [1.3.6.1.2.2.64]
[PolicyQualifierInfo: [
  qualifierID: 1.3.6.1.5.5.7.2.1
  qualifier: 0000: 16 19 68 74 74 70 73 3A   2F 2F 63 70 73 2E 75 73  ..https://                                                                                cps.us
0010: 65 72 74 72 75 73 74 2E   63 6F 6D                 ertrust.com

]]  ]
  [CertificatePolicyId: [2.23.140.1.2.1]
[]  ]
]

#7: ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
  serverAuth
  clientAuth
]

#8: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_Encipherment
]

#9: ObjectId: 2.5.29.17 Criticality=false
SubjectAlternativeName [
  DNSName: *.mycompanyname.com
  DNSName: mycompanyname.com
]

#10: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 84 D5  F7 50 98 94 E8  .......G..d.P...
0010: B8 63 D4 B5                                        .c..
]
]

I added my certificate-key to keystore by

My key is a in keystore.p12 file. I read that the key along with server certificate can be placed in the keystore by doing this

winpty openssl pkcs12 -export -in servercert_2022.crt -inkey private.pem -certfile servercert_2022.crt -out keystore.p12

Keystore looks like this

Keystore type: jks
Keystore provider: SUN

Your keystore contains 1 entry

Alias name: 1
Creation date: Dec 9, 2022
Entry type: PrivateKeyEntry
Certificate chain length: 3
Certificate[1]:
Owner: CN=*.mycompanyname.com
Issuer: CN=GoGetSSL
Serial number: 2a0e8428
Valid from: Tue Nov 29 05:30:00 IST 2022 until: Sat Dec 30 05:29:59 IST 2023
Certificate fingerprints:
         MD5:  82:4D:8C:61:CD:D8:65:60:99:78:F3:D2:7E:B3:73:30
         SHA1: 4D:DC:24:25:5A:67:41:E7:4D:FF:1A:B3:F8:B6:7E:A1:17:B0:58:A0
         SHA256: 2E:24:AF:0A:8C:25:B7:D5:89:06:3E:DC:08:FA:2D:69:A4:DF:58:8F:E4:08:AB:DD:EB:EE:2C:1D:2B:EA:EC:DD
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3

Extensions:

#1: ObjectId: 1.3.6.1.4.1.11129.2.4.2 Criticality=false
0000: 04 82 01 69 01 67 00 75   00 AD F7 BE FA 7C FF 10  ...i.g.u......
0160: 16 84 D3 72 78 21 62 96   FA 96 A7 55 D5           ...rx!b....U.

#2: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
  [
   accessMethod: caIssuers
   accessLocation: URIName: http://crt.usertrust.com/GoGetSSLADVCA.crt
,
   accessMethod: ocsp
   accessLocation: URIName: http://ocsp.usertrust.com
]
]

#3: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: F9 FB 50 C4 8B 67 BB 67   64 FE 83 21 A6 A9 CE 3F  ..P..g.gd..!...?
0010: 55 84 93 99                                        U...
]
]

#4: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:false
  PathLen: undefined
]

#5: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://crl.usertrust.com/GoGetSSLADVCA.crl]
]]

#6: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [1.3.6.1.4.1.6449.1.2.2.64]
[PolicyQualifierInfo: [
  qualifierID: 1.3.6.1.5.5.7.2.1
  qualifier: 0000: 16 19 68 74 74 70 73 3A   2F 2F 63 70 73 2E 75 73  ..https://cps.us
0010: 65 72 74 72 75 73 74 2E   63 6F 6D                 ertrust.com

]]  ]
  [CertificatePolicyId: [2.23.140.1.2.1]
[]  ]
]

#7: ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
  serverAuth
  clientAuth
]

#8: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_Encipherment
]

#9: ObjectId: 2.5.29.17 Criticality=false
SubjectAlternativeName [
  DNSName: *.mycompanyname.com
  DNSName: mycompanyname.com
]

#10: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 84 D5 11 9F 12 AB 0A 47   D3 DD 64 F7 50 98 94 E8  .......G..d.P...
0010: B8 63 D4 B5                                        .c..
]
]

Certificate[2]:
Owner: CN=GoGetSSL RSA DV CA, O=GoGetSSL, L=Riga, C=LV
Issuer: CN=USERTrust RSA Certification Authority, O=The USERTRUST Network, L=Jersey City, ST=New Jersey, C=US
Serial number: 938bb08e62987b4f75f98cb6a5045c96
Valid from: Thu Sep 06 05:30:00 IST 2018 until: Wed Sep 06 05:29:59 IST 2028
Certificate fingerprints:
         MD5:  4E:81:90:9E:43:B3:18:66
         SHA1: 07:0A:72:6C:6E:44:18:DC:F
         SHA256: 43:CA:C3:1E:F8:E8:BA:1B:4B:16:B8:20:6E:4C:0A:26:C5:BA:D:C2:FD:64
Signature algorithm name: SHA384withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3

Extensions:

#1: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
  [
   accessMethod: caIssuers
   accessLocation: URIName: http://crt.usertrust.com/USERTrustRSAAddTrustCA.crt
,
   accessMethod: ocsp
   accessLocation: URIName: http://ocsp.usertrust.com
]
]

#2: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: 53 79 BF 5A AA 2B 4A CF   54 80 E1 D8 9B C0 9D F2  Sy.Z.+J.T.......
0010: B2 03 66 CB                                        ..f.
]
]

#3: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:true
  PathLen:0
]

#4: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://crl.usertrust.com/USERTrustRSACertificationAuthority.crl]
]]

#5: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [1.3..2.2.64]
[]  ]
  [CertificatePolicyId: [2.23.140.1.2.1]
[]  ]
]

#6: ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
  serverAuth
  clientAuth
]

#7: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_CertSign
  Crl_Sign
]

#8: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: F9 FB 50 C4 8B 67 BB 67   64 FE 83 21 A6 A9 CE 3F  ..P..g.gd..!...?
0010: 55 84 93 99                                        U...
]
]

Certificate[3]:
Owner: CN=USERTrust RSA Certification Authority, O=The USERTRUST Network, L=Jersey City, ST=New Jersey, C=US
Issuer: CN=AAA Certificate Services, O=Comodo CA Limited, L=Salford, ST=Greater Manchester, C=GB
Serial number: 3972443af922b751d7d36c10dd313595
Valid from: Tue Mar 12 05:30:00 IST 2019 until: Mon Jan 01 05:29:59 IST 2029
Certificate fingerprints:
         MD5:  28:5E:C9:09:C4:AB:0D:2D:57:F5:08:6B:22:57:99:AA
         SHA1: D8:9E:3B:D4:3D:5D:90:9B:47:A1:89:77:AA:9D:5C:E3:6C:EE:18:4C
         SHA256: 68:B9:C7:61:21:9A:5B:1F:01:31:78:44:74:66:5D:B6:1B:BD:B1:09:E0:0F:05:CA:9F:74:24:4E:E5:F5:F5:2B
Signature algorithm name: SHA384withRSA
Subject Public Key Algorithm: 4096-bit RSA key
Version: 3

Extensions:

#1: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
  [
   accessMethod: ocsp
   accessLocation: URIName: http://ocsp.comodoca.com
]
]

#2: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: A0 11 0A 23 3E 96 F1 07   EC E2 AF 29 EF 82 A5 7F  ...#>......)....
0010: D0 30 A4 B4                                        .0..
]
]

#3: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:true
  PathLen:2147483647
]

#4: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://crl.comodoca.com/AAACertificateServices.crl]
]]

#5: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [2.5.29.32.0]
[]  ]
]

#6: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_CertSign
  Crl_Sign
]

#7: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 53 79 BF 5A AA 2B 4A CF   54 80 E1 D8 9B C0 9D F2  Sy.Z.+J.T.......
0010: B2 03 66 CB                                        ..f.
]
]

*******************************************

My tomcat connector looks like this

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" scheme="https" secure="true"
            clientAuth="want" sslProtocol="TLS"
            keystoreFile="C:\Company\keys\keystore.p12"
            keystoreType="PKCS12" keystorePass="password"
            truststoreFile="C:\Company\keys\truststore.jks"
            truststoreType="JKS" truststorePass="password"/>

My spring security configuration looks like this

<http pattern="/api/mutualauthenticationtest"  create-session="never"
          authentication-manager-ref="authenticationManager"
          entry-point-ref="oauthAuthenticationEntryPoint"
          access-decision-manager-ref="accessDecisionManager"
          xmlns="http://www.springframework.org/schema/security"

          use-expressions="true">

        <csrf disabled="true"/>
        <x509 subject-principal-regex="CN=(.*?)," />

    </http>

With the above configuration the debugger is able to reach inside the X509AuthenticationFilter.java class at this place at the line with variable certs

private X509Certificate extractClientCertificate(HttpServletRequest request) {
        X509Certificate[] certs = (X509Certificate[])((X509Certificate[])request.getAttribute("javax.servlet.request.X509Certificate"));
        if (certs != null && certs.length > 0) {
            if (this.logger.isDebugEnabled()) {
                this.logger.debug("X.509 client authentication certificate:" + certs[0]);
            }

            return certs[0];
        } else {
            if (this.logger.isDebugEnabled()) {
                this.logger.debug("No client certificate found in request.");
            }

            return null;
        }
    }

for the API curl API request that I make to this API. The curl request has my client certificate attached

curl -k --location --request POST 'https://localhost:8443/api/mutualauthenticationtest' \

--header 'clientid: 3' \
--header 'Content-Type: application/json' \
--header 'Cookie: JSESSIONID=464646778768678678676' \
--cert client.crt \
--key clientprivate.key \
--data-raw '{"userID":"someuserid"}'

The client.crt in the curl request was generated with the help of client.csr (signing request), client private key and signed by the server certificate and server private key.

client private key

openssl genrsa -aes256 -out clientprivate.key -passout pass:someclientpassword 2048

client csr

winpty openssl req -new -key clientprivate.key -out client.csr

Initially, I had created my own CA server certificate with CN localhost. But after reading some comments on SO, I used a genuine Server certificate with CN:mycompanyname.com. I also created  the client CSR with the CN=somesubdomain.mycompanyname.com so that it matches the domain *.mycompanyname.com

Here's how the  client certificate was created

winpty openssl x509 -req -in client.csr -CA servercert_2022.crt -CAkey private.pem -CAcreateserial -out client.crt -days 365 -sha256

Placing below the entire handshake if it helps someone help me get to the bottom of this.

    https-jsse-nio-8443-exec-4, READ: TLSv1 Handshake, length = 512
*** ClientHello, TLSv1.2
RandomCookie:  GMT: -2129767729 bytes = { 47, 24, 48, 232, 111, 34, 57, 141, 51, 1, 246, 45, 164, 70, 153, 138, 39, 181, 40, 12, 168, 95, 109, 1, 194, 50, 38, 131 }
Session ID:  {}

*** Certificate chain
chain [0] = [
[
  Version: V3
  Subject: CN=*.mycompanyname.com
  Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11

  Key:  Sun RSA public key, 2048 bits
  modulus: 2622705370403332787775762243661727944626694756503406987897017427384873636985758217173690153198533118362188933540538596405165697331
  public exponent: 65537
  Validity: [From: Tue Nov 29 00:00:00 UTC 2022,
               To: Fri Dec 29 23:59:59 UTC 2023]
  Issuer: CN=GoGetSSL RSA DV CA, O=GoGetSSL, L=Riga, C=LV
  SerialNumber: [    2a49d139 988338b9 2dee3274 c70e8428]

Certificate Extensions: 10
[3]: ObjectId: 1.3.6.1.4.1.11129.2.4.2 Criticality=false
Extension unknown: DER encoded OCTET string =
0000: 04 82 01 6D 04 82 01 69   01 67 00 75 00 AD F7 BE  ...m...i.g.u....
0010: FA 7C FF 10 C8 8B 9D 3D   9C 1E 3E 18 6A B4 67 29  .......=..>.j.g)

0170: D5                                                 .

[3]: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
  [
   accessMethod: caIssuers
   accessLocation: URIName: http://crt.usertrust.com/GoGetSSLRSADVCA.crt
,
   accessMethod: ocsp
   accessLocation: URIName: http://ocsp.usertrust.com
]
]

[3]: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: F9 FB 50 C4 8B 67 BB 67   64 FE 83 21 A6 A9 CE 3F  ..P..g.gd..!...?
0010: 55 84 93 99                                        U...
]
]

[4]: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:false
  PathLen: undefined
]

[5]: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://crl.usertrust.com/GoGetSSLRSADVCA.crl]
]]

[6]: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [1.3.6.1.4.1.6449.1.2.2.64]
[PolicyQualifierInfo: [
  qualifierID: 1.3.6.1.5.5.7.2.1
  qualifier: 0000: 16 19 68 74 74 70 73 3A   2F 2F 63 70 73 2E 75 73  ..https://cps.us
0010: 65 72 74 72 75 73 74 2E   63 6F 6D                 ertrust.com

]]  ]
  [CertificatePolicyId: [2.23.140.1.2.1]
[]  ]
]

[7]: ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
  serverAuth
  clientAuth
]

[8]: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_Encipherment
]

[9]: ObjectId: 2.5.29.17 Criticality=false
SubjectAlternativeName [
  DNSName: *.mycompanyname.com
  DNSName: mycompanyname.com
]

[10]: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 84 D5 11 9F 12 AB 0A 47   D3 DD 64 F7 50 98 94 E8  .......G..d.P...
0010: B8 63 D4 B5                                        .c..
]
]

]
  Algorithm: [SHA256withRSA]
  Signature:
0000: 41 55 D9 6E D1 C1 7E E1   CE D9 DA 01 D6 83 94 7C  AU.n............
0010: EF 9E 27 3A 46 9C B1 32   9A E9 C3 1E 36 8E 1C 71  ..':F..2....6..q

]
chain [3] = [
[
  Version: V3
  Subject: CN=GoGetSSL
  Signature Algorithm: SHA384withRSA, OID = 1.2.840.113549.1.1.12

  Key:  Sun RSA public key, 2048 bits
  modulus: 2016675053399680968778139946606275282233371636099081255780548426567610365288242376854592612489780940673622601461569960956302879926833060318530351
  public exponent: 65537
  Validity: [From: Thu Sep 06 00:00:00 UTC 2018,
               To: Tue Sep 05 23:59:59 UTC 2028]
  Issuer: CN=USERTrust RSA Certification Authority, O=The USERTRUST Network, L=Jersey City, ST=New Jersey, C=US
  SerialNumber: [    938bb08e 62987b4f 75f98cb6 a5045c96]

Certificate Extensions: 8
[3]: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
  [
   accessMethod: caIssuers
   accessLocation: URIName: http://crt.usertrust.com/USERTrustRSAAddTrustCA.crt
,
   accessMethod: ocsp
   accessLocation: URIName: http://ocsp.usertrust.com
]
]

[3]: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: 53 79 BF 5A AA 2B 4A CF   54 80 E1 D8 9B C0 9D F2  Sy.Z.+J.T.......
0010: B2 03 66 CB                                        ..f.
]
]

[3]: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:true
  PathLen:0
]

[4]: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://crl.usertrust.com/USERTrustRSACertificationAuthority.crl]
]]

[5]: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [1.3.6.1.4.1.6449.1.2.2.64]
[]  ]
  [CertificatePolicyId: [2.23.140.1.2.1]
[]  ]
]

[6]: ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
  serverAuth
  clientAuth
]

[7]: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_CertSign
  Crl_Sign
]

[8]: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: F9 FB 50 C4 8B 67 BB 67   64 FE 83 21 A6 A9 CE 3F  ..P..g.gd..!...?
0010: 55 84 93 99                                        U...
]
]

]
  Algorithm: [SHA384withRSA]
  Signature:
0000: 5D 74 43 28 78 80 E4 33   A1 34 AB 33 B7 06 B2 73  ]tC(x..3.4.3...s

01F0: 3C 4D 84 C0 E6 21 79 E3   11 E5 AB 16 F0 19 42 19  <M...!y.......B.

]
chain [3] = [
[
  Version: V3
  Subject: CN=USERTrust RSA Certification Authority, O=The USERTRUST Network, L=Jersey City, ST=New Jersey, C=US
  Signature Algorithm: SHA384withRSA, OID = 1.2.840.113549.1.1.12

  Key:  Sun RSA public key, 4096 bits
  modulus: 52248758361752507534246388533722547304608772308115673058706321503049610972993225326579926576629493740386532378470836364707455134729548367373189550921756904777340153719441907345834660183638543
  public exponent: 65537
  Validity: [From: Tue Mar 12 00:00:00 UTC 2019,
               To: Sun Dec 31 23:59:59 UTC 2028]
  Issuer: CN=AAA Certificate Services, O=Comodo CA Limited, L=Salford, ST=Greater Manchester, C=GB
  SerialNumber: [    3972443a f922b751 d7d36c10 dd313595]

Certificate Extensions: 7
[3]: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
  [
   accessMethod: ocsp
   accessLocation: URIName: http://ocsp.comodoca.com
]
]

[3]: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: A0 11 0A 23 3E 96 F1 07   EC E2 AF 29 EF 82 A5 7F  ...#>......)....
0010: D0 30 A4 B4                                        .0..
]
]

[3]: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:true
  PathLen:2147483647
]

[4]: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://crl.comodoca.com/AAACertificateServices.crl]
]]

[5]: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
  [CertificatePolicyId: [2.5.29.32.0]
[]  ]
]

[6]: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
  DigitalSignature
  Key_CertSign
  Crl_Sign
]

[7]: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 53 79 BF 5A AA 2B 4A CF   54 80 E1 D8 9B C0 9D F2  Sy.Z.+J.T.......
0010: B2 03 66 CB                                        ..f.
]
]

]
  Algorithm: [SHA384withRSA]
  Signature:
0000: 18 87 51 DC 74 21 3D 9C   8A E0 27 B7 33 D0 2E CC  ..Q.t!=...'.3...

00F0: 7F 8E 76 72 99 0C 9D FE   D7 91 08 16 A1 A3 5F 95  ..vr.........._.

]
***
*** ECDH ServerKeyExchange
Signature Algorithm SHA512withRSA
Server key: Sun EC public key, 256 bits
  public x coord: 19352321750303628830904646093808624566974313423482165871643805927488532053250
  public y coord: 45496769771360840433108417226772017731510614660888440135094323373501113499217
  parameters: secp256r1 [NIST P-256, X9.62 prime256v1] (1.2.840.10045.3.1.7)
*** CertificateRequest
Cert Types: RSA, DSS, ECDSA
Supported Signature Algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA256withDSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA
Cert Authorities:
<CN=*.mycompanyname.com>
*** ServerHelloDone
https-jsse-nio-8443-exec-4, WRITE: TLSv1.2 Handshake, length = 4972
https-jsse-nio-8443-exec-5, READ: TLSv1.2 Handshake, length = 7
*** Certificate chain
<Empty>
***
https-jsse-nio-8443-exec-5, READ: TLSv1.2 Handshake, length = 70
*** ECDHClientKeyExchange
ECDH Public value:  { 4, 53, 247, 204, 77, 62, 51, 36, 140, 49, 178, 158, 159, 179, 238, 225, 234, 153, 124, 198, 178, 83, 148, 252, 78, 0, 17, 70, 200, 87, 141, 60, 255, 50, 144, 12, 181, 38, 254, 238, 59, 9, 254, 105, 34, 65, 212, 57, 27, 115, 17, 41, 88, 128, 128, 253, 149, 157, 18, 174, 252, 114, 131, 231, 6 }
SESSION KEYGEN:
PreMaster Secret:
0000: BE E4 A9 B5 9D A7 F6 60   18 98 9B E6 CA 24 4D FA  .......`.....$M.
0010: 91 B6 4A 02 37 D1 C1 F3   2D 74 30 EF 64 05 AC 35  ..J.7...-t0.d..5
CONNECTION KEYGEN:
Client Nonce:
0000: 81 0E 53 CF 2F 18 30 E8   6F 22 39 8D 33 01 F6 2D  ..S./.0.o"9.3..-
0010: A4 46 99 8A 27 B5 28 0C   A8 5F 6D 01 C2 32 26 83  .F..'.(.._m..2&.
Server Nonce:
0000: 63 92 B1 A6 7F 81 DC C2   3B E7 19 A6 A4 FC 5F D8  c.......;....._.
0010: AC 17 FC 60 C9 3D E8 A2   A7 C0 CE 82 62 0F F4 21  ...`.=......b..!
Master Secret:
0000: 7E 20 23 1F 02 34 2E 40   73 18 5F 5A 09 F4 B6 28  . #..4.@s._Z...(
0010: 1B 30 D2 F3 2E A8 85 BA   72 2F FC 79 57 2C F3 5B  .0......r/.yW,.[
0020: 70 E8 81 50 90 D4 DB 3C   4E 7D 89 A8 A1 68 EC DC  p..P...<N....h..
... no MAC keys used for this cipher
0000: A8 B8 56 36                                        ..V6
Server write IV:
0000: 5F 42 7E 2E

What could I be possibly doing wrong that the client is unable to send the certificate (if my conjecture is right) or simply, why the certs variable is null when the certificate is being read from inside the request.getAttribute() mentioned in the very first line of this post? Any help will be immensely appreciated.


问:
Can I import a function dynamically from different .py files based a condition through command "from <root.fold1.fold2.{dynamic name}> import module"
Scenario:
I have a function which is going to instantiated in different test_.py files

```<code>EX:
test_name1.py
test_name2.py
test_name3.py
</code>```

instance name is tools.py and will be created in with same name in all of the above test files.

now I would need to import this instance in another file (Ex: utils.py).
For ex, if I run the test_name1.py, instance from this file should get imported to utils.py and
if I run the test_name2.py, instance from this file should get imported to utils.py. like this

I want to achieve some thing like

test_file == "test_name1.py":
from root.fold1.fold2.{test_file} import tools
```

Is there a way to achieve this ?

Body:
Scenario:
I have a function which is going to instantiated in different test_.py files

EX:
test_name1.py
test_name2.py
test_name3.py

instance name is tools.py and will be created in with same name in all of the above test files.

now I would need to import this instance in another file (Ex: utils.py).
For ex, if I run the test_name1.py, instance from this file should get imported to utils.py and
if I run the test_name2.py, instance from this file should get imported to utils.py. like this

I want to achieve some thing like

test_file == "test_name1.py":
from root.fold1.fold2.{test_file} import tools

Is there a way to achieve this ?