How to make 'simple SSL' thru Web Services?

后端 未结 5 421
栀梦
栀梦 2020-12-15 01:31

I know how to secure Web Services using certificates. that\'s my client code:

  SSLContext ssl = SSLContext.getInstance(\"SSLv3\");
  KeyManagerFactory kmf =         


        
5条回答
  •  盖世英雄少女心
    2020-12-15 02:27

    If I understand you correctly, then you want to have only server-side authentication much in the same way as if you connected to an https site in your browser, without requiring your clients to manage any certificates.

    Your clients would connect as usual, simply replacing an http for an https in the connection URL. Java manages its own set of "default trusted root CA authorities" in the form of cacerts, a JKS keystore file located in $JRE HOME/lib/security. If you buy a certificate from any CA whose issuing certificate roots in one of the certificates contained in cacerts, then the client's certificate validation will automagically succeed. Google for "SSL/TLS server certificate" and you will find suitable vendors.

    If you would use a self-issued certificate on the other hand, then there's no way to make certificate validation succeed on the client other than importing your self-made certificate in the client's certificate trust store. But that's why a "real" SSL/TLS certificate costs money and your self-issued certificate doesn't - anyone can generate their home-grown certificates, but trusting them is an entirely different story.

提交回复
热议问题