How to import a .cer certificate into a java keystore?

后端 未结 8 927
有刺的猬
有刺的猬 2020-11-22 15:38

During the development of a Java webservice client I ran into a problem. Authentication for the webservice is using a client certificate, a username and a password. The clie

8条回答
  •  渐次进展
    2020-11-22 16:33

    • If you want to authenticate you need the private key - there is no other option.
    • A certificate is a public key with extra properties (like company name, country,...) that is signed by some Certificate authority that guarantees that the attached properties are true.
    • .CER files are certificates and don't have the private key. The private key is provided with a .PFX keystore file normally. If you really authenticate is because you already had imported the private key.
    • You normally can import .CER certificates without any problems with

      keytool -importcert -file certificate.cer -keystore keystore.jks -alias "Alias" 
      

提交回复
热议问题