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

  • 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" 

Leave a Comment