org.apache.directory.server.core.security
Class TlsKeyGenerator

java.lang.Object
  extended by org.apache.directory.server.core.security.TlsKeyGenerator

public class TlsKeyGenerator
extends java.lang.Object

Generates the default RSA key pair for the server.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Field Summary
static java.lang.String CERTIFICATE_PRINCIPAL_DN
           
static java.lang.String KEY_ALGORITHM_AT
           
static java.lang.String PRIVATE_KEY_AT
           
static java.lang.String PRIVATE_KEY_FORMAT_AT
           
static java.lang.String PUBLIC_KEY_AT
           
static java.lang.String PUBLIC_KEY_FORMAT_AT
           
static java.lang.String TLS_KEY_INFO_OC
           
static java.lang.String USER_CERTIFICATE_AT
           
 
Constructor Summary
TlsKeyGenerator()
           
 
Method Summary
static void addKeyPair(ServerEntry entry)
          Adds a private key pair along with a self signed certificate to an entry making sure it contains the objectClasses and attributes needed to support the additions.
static java.security.cert.X509Certificate getCertificate(ServerEntry entry)
          Gets the certificate associated with the self signed TLS private/public key pair.
static java.security.KeyPair getKeyPair(ServerEntry entry)
          Extracts the public private key pair from the tlsKeyInfo entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TLS_KEY_INFO_OC

public static final java.lang.String TLS_KEY_INFO_OC
See Also:
Constant Field Values

PRIVATE_KEY_AT

public static final java.lang.String PRIVATE_KEY_AT
See Also:
Constant Field Values

PUBLIC_KEY_AT

public static final java.lang.String PUBLIC_KEY_AT
See Also:
Constant Field Values

KEY_ALGORITHM_AT

public static final java.lang.String KEY_ALGORITHM_AT
See Also:
Constant Field Values

PRIVATE_KEY_FORMAT_AT

public static final java.lang.String PRIVATE_KEY_FORMAT_AT
See Also:
Constant Field Values

PUBLIC_KEY_FORMAT_AT

public static final java.lang.String PUBLIC_KEY_FORMAT_AT
See Also:
Constant Field Values

USER_CERTIFICATE_AT

public static final java.lang.String USER_CERTIFICATE_AT
See Also:
Constant Field Values

CERTIFICATE_PRINCIPAL_DN

public static final java.lang.String CERTIFICATE_PRINCIPAL_DN
See Also:
Constant Field Values
Constructor Detail

TlsKeyGenerator

public TlsKeyGenerator()
Method Detail

getCertificate

public static java.security.cert.X509Certificate getCertificate(ServerEntry entry)
                                                         throws javax.naming.NamingException
Gets the certificate associated with the self signed TLS private/public key pair.

Parameters:
entry - the TLS key/cert entry
Returns:
the X509 certificate associated with that entry
Throws:
javax.naming.NamingException - if there are problems accessing or decoding

getKeyPair

public static java.security.KeyPair getKeyPair(ServerEntry entry)
                                        throws javax.naming.NamingException
Extracts the public private key pair from the tlsKeyInfo entry.

Parameters:
entry - an entry of the tlsKeyInfo objectClass
Returns:
the private and public key pair
Throws:
javax.naming.NamingException - if there are format or access issues

addKeyPair

public static void addKeyPair(ServerEntry entry)
                       throws javax.naming.NamingException
Adds a private key pair along with a self signed certificate to an entry making sure it contains the objectClasses and attributes needed to support the additions. This function is intended for creating a TLS key value pair and self signed certificate for use by the server to authenticate itself during SSL handshakes in the course of establishing an LDAPS connection or a secure LDAP connection using StartTLS. Usually this information is added to the administrator user's entry so the administrator (effectively the server) can manage these security concerns.

Parameters:
entry - the entry to add security attributes to
Throws:
javax.naming.NamingException - on problems generating the content in the entry


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.