Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The best key manager implementation depends on the issuer of the certificates you expect to be using.</p> <p>If the certificate on the user's CAC will <em>always</em> be issued by a specific CA, simply store that issuer's certificate and any intermediate certificates further up the chain in a PKCS&nbsp;#7 file. In the <a href="http://java.sun.com/javase/6/docs/api/javax/net/ssl/X509KeyManager.html#getCertificateChain(java.lang.String)" rel="nofollow noreferrer"><code>getCertificateChain()</code></a> method, this collection can be appended blindly to the user's certificate and returned.</p> <p>If things aren't quite that simple, but a complete list of possible issuers can be enumerated, obtain all of their certificates, and <em>their</em> issuer's certificates, and so on, up to the root certificates.</p> <p>Add all of the root certificates to a key store as trusted entries. Bundle the intermediate certificates in a PKCS-#7&ndash;format file.</p> <p>Implement <a href="http://java.sun.com/javase/6/docs/api/javax/net/ssl/X509KeyManager.html" rel="nofollow noreferrer"><code>X509KeyManager</code></a> (or extend <a href="http://java.sun.com/javase/6/docs/api/javax/net/ssl/X509ExtendedKeyManager.html" rel="nofollow noreferrer"><code>X509ExtendedKeyManager</code></a> if you're working with <code>SSLEngine</code>). Specifically, in the <code>getCertificateChain()</code> method, you'll use a <a href="http://java.sun.com/javase/6/docs/api/java/security/cert/CertPathBuilder.html" rel="nofollow noreferrer"><code>CertPathBuilder</code></a> to create a valid chain from the user's certificate to a trusted root. The <a href="http://java.sun.com/javase/6/docs/api/java/security/cert/X509CertSelector.html#setCertificate(java.security.cert.X509Certificate)" rel="nofollow noreferrer">target</a> is the certificate that you load from the user's CAC with the <code>alias</code> parameter. The <a href="http://java.sun.com/javase/6/docs/api/java/security/cert/PKIXBuilderParameters.html#PKIXBuilderParameters(java.security.KeyStore,%20java.security.cert.CertSelector)" rel="nofollow noreferrer">trusted roots</a> are the certificates in trust store that you created; the intermediate certificates can be <a href="http://java.sun.com/javase/6/docs/api/java/security/cert/CertificateFactory.html#generateCertificates(java.io.InputStream)" rel="nofollow noreferrer">loaded</a> from the PKCS&nbsp;#7 file and <a href="http://java.sun.com/javase/6/docs/api/java/security/cert/PKIXParameters.html#addCertStore(java.security.cert.CertStore)" rel="nofollow noreferrer">added to the builder parameters.</a> Once the chain is built, <a href="http://java.sun.com/javase/6/docs/api/java/security/cert/CertPathBuilderResult.html#getCertPath()" rel="nofollow noreferrer">get the certificate path</a> and <a href="http://java.sun.com/javase/6/docs/api/java/security/cert/CertPath.html#getCertificates()" rel="nofollow noreferrer">convert it</a> to an array. This is the result of the <code>getCertificateChain()</code> method.</p> <p>If you can't predict who will be issuing the user's certificate, you might be able to obtain the intermediate certificates at runtime from an LDAP directory or other repository. That's a whole new level of difficulty.</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.
    1. This table or related slice is empty.
    1. VO
      singulars
      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