Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to import a .cer certificate into a java keystore?
    primarykey
    data
    text
    <p>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 client certificate I received from the company behind the webservice is in <code>.cer</code> format. When I inspect the file using a text editor, it has the following contents:</p> <pre><code>-----BEGIN CERTIFICATE----- [Some base64 encoded data] -----END CERTIFICATE----- </code></pre> <p>I can import this file as a certificate in Internet Explorer (without having to enter a password!) and use it to authenticate with the webservice.</p> <p>I was able to import this certificate into a keystore by first stripping the first and last line, converting to unix newlines and running a base64-decode. The resulting file can be imported into a keystore (using the <code>keytool</code> command). When I list the entries in the keystore, this entry is of the type <code>trustedCertEntry</code>. Because of this entry type (?) I cannot use this certificate to authenticate with the webservice. I'm beginning to think that the provided certificate is a public certificate which is being used for authentication...</p> <p>A workaround I have found is to import the certificate in IE and export it as a <code>.pfx</code> file. This file can be loaded as a keystore and can be used to authenticate with the webservice. However I cannot expect my clients to perform these steps every time they receive a new certificate. So I would like to load the <code>.cer</code> file directly into Java. Any thoughts?</p> <p>Additional info: the company behind the webservice told me that the certificate should be requested (using IE &amp; the website) from the PC and user that would import the certificate later.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload