简体   繁体   中英

mTLS X509 authenticated request in Java

I'm looking for a way to implement the following mTLS authenticated request in Java:

PFX=x509.pfx

curl --location --request POST 'https://example.com/' \
  --cert-type p12 \
  --cert "$PFX:mySecretPassword"

I'm using a x509 pfx file encrypted with a password.

For server side, choose framework like Spring. Check Spring Security docs for more. Here is intro https://www.baeldung.com/x-509-authentication-in-spring-security

To implement client only try okHttp, that is usually troublesome to use custom certificate in client, eg Use a certificate in an okhttp request with android

So state what exactly you want, and raise better question.

As an advise, try to use standard/default configuration as much as possible. https://www.baeldung.com/spring-boot-https-self-signed-certificate

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM