简体   繁体   English

将POST请求发送到使用自签名证书的服务器

[英]Sending POST request to a server that uses a self signed certificate

I need to send a POST request to a server that uses some levels of security. 我需要向使用某种安全级别的服务器发送POST请求。 Unfortunately I don't know much about self signed certificates, I never used or studied it. 不幸的是,我对自签名证书了解不多,我从未使用过或研究过它。

In the developer guide of the service it sais that the server uses a "public 1024-bit self signed certificate". 在该服务的开发人员指南中,它说服务器使用“公共1024位自签名证书”。

What does it mean? 这是什么意思? I've to create a certificate or I've to ask for it? 我必须创建证书还是要索取证书? If i've to create a certificate, then how I should use it? 如果我必须创建证书,那么我应该如何使用它? I'm implementing the client in Java 我正在用Java实现客户端

You need to download the certificate eg with your internet browser. 您需要例如使用Internet浏览器下载证书。 Click through the security information and export the certificate. 单击通过安全信息并导出证书。

Then you need to import it into your local java keystore so that the JVM can find it. 然后,您需要将其导入本地Java密钥库中,以便JVM可以找到它。 For import use the keytool which you find in your jre/bin directory. 对于导入,请使用在jre / bin目录中找到的keytool。 Documentation for the keytool: http://docs.oracle.com/javase/1.4.2/docs/tooldocs/windows/keytool.html 密钥工具的文档: http : //docs.oracle.com/javase/1.4.2/docs/tooldocs/windows/keytool.html

The default keystore is jre/lib/security/cacerts . 默认密钥库为jre/lib/security/cacerts

Then you can import the downloaded certificate: jre/bin/keytool -import -keystore jre/lib/security/cacerts -alias mycertificate -file downloads/mycertificate.cer 然后,您可以导入下载的证书: jre/bin/keytool -import -keystore jre/lib/security/cacerts -alias mycertificate -file downloads/mycertificate.cer

Hope this helps. 希望这可以帮助。

PS If it is self signed or verified its not important at this point. PS如果它是自签名的或已验证的,则此时不重要。 Just you (your client) must trust it. 只有您(您的客户)必须信任它。

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

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