简体   繁体   English

Java 中的 mTLS X509 身份验证请求

[英]mTLS X509 authenticated request in Java

I'm looking for a way to implement the following mTLS authenticated request in Java:我正在寻找一种在 Java 中实现以下 mTLS 身份验证请求的方法:

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.我正在使用一个用密码加密的 x509 pfx 文件。

For server side, choose framework like Spring.对于服务器端,选择 Spring 这样的框架。 Check Spring Security docs for more.查看 Spring Security 文档了解更多信息。 Here is intro https://www.baeldung.com/x-509-authentication-in-spring-security这是介绍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实现客户端只尝试okHttp,在客户端使用自定义证书通常很麻烦,例如在android的okhttp请求中使用证书

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 https://www.baeldung.com/spring-boot-https-self-signed-certificate

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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