public class KSIniFileCreator
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ALG_STRING_3DES |
static java.lang.String |
ALG_STRING_CAST |
static java.lang.String |
ALG_STRING_DES |
static java.lang.String |
ALG_STRING_IDEA |
| Constructor and Description |
|---|
KSIniFileCreator(java.io.InputStream ksIniFile,
SecureStringBuffer password)
Creating a
KSIniFileCreator by reading an already existing
KeyStore-Ini-File. |
KSIniFileCreator(java.lang.String path)
Creating a new
KSIniFileCreator. |
KSIniFileCreator(java.lang.String pkcs11Library,
int slotNr)
Deprecated.
used
KSIniFileCreator(String, long) because a slot
ID is represented by a long in the PKCS#11 specification |
KSIniFileCreator(java.lang.String pkcs11Library,
long slotNr)
Creating a new
KSIniFileCreator. |
KSIniFileCreator(java.lang.String ksIniFile,
SecureStringBuffer password)
Creating a
KSIniFileCreator |
| Modifier and Type | Method and Description |
|---|---|
void |
addReadCertificateStore(java.lang.String path,
SecureStringBuffer password)
Adds a read-only certificate store to this KeyStore-Ini-File.
|
void |
addWriteCertificateStore(java.lang.String path,
SecureStringBuffer password)
Adds a read/write certificate store to this KeyStore-Ini-File.
|
java.lang.String |
getAuthorityAddress()
Returns the IP address of the authority.
|
int |
getAuthorityPort()
Returns the port number of the authority.
|
static LdapDirectory |
getDirectoryFromKeystore(IniFile iniFile)
Reads the Directory Information from the Keystore INI file.
|
static LdapDirectory |
getDirectoryFromKeystore(java.lang.String iniFile)
Reads the Directory Information from the Keystore INI file.
|
int |
getHashCount()
Returns the hash count.
|
java.lang.String |
getLdapAddress()
Returns the IP address of the ldap directory.
|
int |
getLdapPort()
Returns the port number of the ldap directory.
|
static ManagerTransport |
getManagerFromKeystore(IniFile iniFile)
Reads the Manager Information from the Keystore INI file.
|
static ManagerTransport |
getManagerFromKeystore(java.lang.String iniFile)
Reads the Manager Information from the Keystore INI file.
|
java.lang.String |
getProtectionAlgorithm()
Returns the protection algorithm.
|
java.lang.String[] |
getReadCertificateStores()
Returns the full pathnames of the read-only certificate stores.
|
java.lang.String[] |
getWriteCertificateStores()
Returns the full pathnames of the read/write certificate stores.
|
static SecureStringBuffer |
readPasswordFromKeystore(IniFile iniFile)
This is a convenience method that reads the Password bound to the
KeyStore INI file.
|
void |
removeAllReadCertificateStores()
Removes all read-only certificate stores.
|
void |
removeAllWriteCertificateStores()
Removes all read/write certificate stores.
|
void |
removeAuthority()
Removes the authority.
|
void |
removeLdap()
Removes the ldap.
|
void |
removeReadCertificateStore(java.lang.String path)
Removes the read-only certificate store with the given path.
|
void |
removeWriteCertificateStore(java.lang.String path)
Removes the read/write certificate store with the given path.
|
void |
setAuthority(java.lang.String ipAddress,
int portNumber)
Sets a new authority.
|
void |
setAuthorityTunnel(java.lang.String urlString)
Sets a new authority.
|
void |
setHashCount(int hashCount)
Sets the hash count.
|
void |
setLdap(java.lang.String ipAddress,
int portNumber)
Sets a new ldap directory.
|
void |
setLdapTunnel(java.lang.String urlString)
Sets a new authority.
|
void |
setProtectionAlgorithm(java.lang.String protectionAlg)
Sets the protection algorithm.
|
void |
store(java.io.OutputStream ksIniFile,
SecureStringBuffer password)
Stores the current settings to a KeyStore-Ini-file.
|
void |
store(java.io.OutputStream ksIniFile,
java.lang.String ualFile)
Method store.
|
void |
store(java.lang.String ksIniFile,
ProtectedPassword password)
Method store.
|
void |
store(java.lang.String ksIniFile,
SecureStringBuffer password)
Stores the current settings to a KeyStore-Ini-file.
|
void |
store(java.lang.String ksIniFile,
java.lang.String ualFile)
Method store.
|
public static final java.lang.String ALG_STRING_CAST
public static final java.lang.String ALG_STRING_DES
public static final java.lang.String ALG_STRING_3DES
public static final java.lang.String ALG_STRING_IDEA
public KSIniFileCreator(java.lang.String path)
KSIniFileCreator.
This constructor is used to create a KeyStore-Ini-File for either an
Entrust Profile (*.epf), or a PKCS12 (*.p12)
credential store.
NOTE: The KSIniFileCreator does not check if the given
credential store exists.
path - The full pathname to the credential store (*.epf
or *.p12)java.lang.IllegalArgumentException - If path does not point to an *.epf or a
*.p12 file.public KSIniFileCreator(java.lang.String pkcs11Library,
int slotNr)
KSIniFileCreator(String, long) because a slot
ID is represented by a long in the PKCS#11 specificationKSIniFileCreator.
This constructor is used to create a KeyStore-Ini-File for a PKCS11
credential store. Note that the KSIniFileCreator does not
check if the given pkcs11 Library does exist.
pkcs11Library - The pkcs11 library name.slotNr - The slotNr to the tokenpublic KSIniFileCreator(java.lang.String pkcs11Library,
long slotNr)
KSIniFileCreator.
This constructor is used to create a KeyStore-Ini-File for a PKCS11
credential store. Note that the KSIniFileCreator does not
check if the given pkcs11 Library does exist.
pkcs11Library - The pkcs11 library name.slotNr - The slotNr as a longpublic KSIniFileCreator(java.lang.String ksIniFile,
SecureStringBuffer password)
throws java.io.FileNotFoundException,
java.io.IOException,
java.security.NoSuchAlgorithmException
KSIniFileCreator by reading an already existing
KeyStore-Ini-File.
ksIniFile - The full path name to the KeyStore-Ini-file.password - The password that was used to write the KeyStore-Ini-file.java.io.IOException - Thrown if a problem occurs when reading the KeyStore-Ini-file.java.security.NoSuchAlgorithmException - Thrown if one of the needed algorithms is not installed.java.io.FileNotFoundExceptionpublic KSIniFileCreator(java.io.InputStream ksIniFile,
SecureStringBuffer password)
throws java.io.IOException,
java.security.NoSuchAlgorithmException
KSIniFileCreator by reading an already existing
KeyStore-Ini-File.
ksIniFile - An input stream to the KeyStore-Ini-Filepassword - The password used in case the KeyStore-Ini-File contains
protected certificate store passwords.java.lang.IllegalArgumentException - If the pkcs11Library does not point to a *.dlljava.io.IOExceptionjava.security.NoSuchAlgorithmExceptionpublic static LdapDirectory getDirectoryFromKeystore(java.lang.String iniFile) throws java.io.IOException
iniFile - the path to the Keystore INI Filejava.io.IOExceptionpublic static SecureStringBuffer readPasswordFromKeystore(IniFile iniFile) throws java.io.IOException
iniFile - The KeystoreINI filejava.io.IOExceptionpublic static LdapDirectory getDirectoryFromKeystore(IniFile iniFile) throws java.io.IOException
iniFile - The IniFile used to read the Ldap or LdapTunnel informationjava.io.IOExceptionpublic static ManagerTransport getManagerFromKeystore(java.lang.String iniFile) throws java.io.IOException
iniFile - The path to the Keystore IniFile used to read the Authority or AuthorityTunnel informationjava.io.IOExceptionpublic static ManagerTransport getManagerFromKeystore(IniFile iniFile) throws java.io.IOException
iniFile - The IniFile used to read the Authority or AuthorityTunnel informationjava.io.IOExceptionpublic final int getHashCount()
public final void setHashCount(int hashCount)
The hash count must be in the range between 1000 and 10000.
hashCount - The hash countjava.lang.IllegalArgumentException - If the hashCount is not between 1000 and 10000public final java.lang.String getProtectionAlgorithm()
public final void setProtectionAlgorithm(java.lang.String protectionAlg)
The protection algorithm must be one of:
ALG_STRING_CASTALG_STRING_DESALG_STRING_3DESALG_STRING_IDEAprotectionAlg - The protection algorithmjava.lang.IllegalArgumentException - If the delivered protection algorithm is unknown.public final void addWriteCertificateStore(java.lang.String path,
SecureStringBuffer password)
The provided password is the one used to protect this certificate store. If the given certificate store already exists, it will be overwritten.
path - The full pathname to the certificate store (*.p12).java.lang.IllegalArgumentException - If the delivered path does not point to a p12 file.public final void addReadCertificateStore(java.lang.String path,
SecureStringBuffer password)
The provided password is the one used to protect this certificate store. If the given certificate store already exists, it will be overwritten.
path - The full pathname to the certificate store (*.p12).java.lang.IllegalArgumentException - If the delivered path does not point to a p12 file.public final java.lang.String[] getWriteCertificateStores()
public final java.lang.String[] getReadCertificateStores()
public final void removeWriteCertificateStore(java.lang.String path)
If the given certificate store doesn't exist, the method returns without doing anything.
path - The full pathname to the certificate storepublic final void removeAllWriteCertificateStores()
public final void removeReadCertificateStore(java.lang.String path)
If the given certificate store doesn't exist, the method returns without doing anything.
path - The full pathname to the certificate storepublic final void removeAllReadCertificateStores()
public final void setLdap(java.lang.String ipAddress,
int portNumber)
ipAddress - the ip address to the ldap directoryportNumber - the port number to the ldap directorypublic final void setLdapTunnel(java.lang.String urlString)
throws java.net.MalformedURLException
urlString - the URL string referring to the Directory Servlet
that will be used to for tunneling through a firewall.java.net.MalformedURLException - if urlString is not a valid URL.HttpDirectoryServlet}public final void setAuthorityTunnel(java.lang.String urlString)
throws java.net.MalformedURLException
urlString - the URL string referring to the Manager servlet
that will be used to for tunneling through a firewall.java.net.MalformedURLException - if urlString is not a valid URL.HttpManagerServlet}public final java.lang.String getLdapAddress()
public final int getLdapPort()
public final void removeLdap()
public final void setAuthority(java.lang.String ipAddress,
int portNumber)
ipAddress - the ip address to the managerportNumber - the port number to the managerpublic final java.lang.String getAuthorityAddress()
public final int getAuthorityPort()
public final void removeAuthority()
public final void store(java.lang.String ksIniFile,
SecureStringBuffer password)
throws java.io.IOException,
java.security.NoSuchAlgorithmException
Neither the credentialstore, set in the constructor, nor the
given password will be checked when writing the KeyStore-Ini-file.
ksIniFile - The full path name where to store the KeyStore-Ini-filepassword - The password used to protect the certificate store's password.
Use the password that belongs to the credential
store (epf, p11, p12) set in this KeyStore-Ini-file.java.io.IOException - Thrown if a problem occurs when writing the KeyStore-Ini-file.java.security.NoSuchAlgorithmException - Thrown if one of the needed algorithms is not installed.public final void store(java.io.OutputStream ksIniFile,
SecureStringBuffer password)
throws java.io.IOException,
java.security.NoSuchAlgorithmException
Neither the credentialstore, set in the constructor, nor the
given password will be checked when writing the KeyStore-Ini-file.
ksIniFile - The output stream used to store the KeyStore-Ini-filepassword - The password used to protect the certificate store's password.
Use the password that belongs to the credential
store (epf, p11, p12) set in this KeyStore-Ini-file.java.io.IOException - Thrown if a problem occurs when writing the KeyStore-Ini-file.java.security.NoSuchAlgorithmException - Thrown if one of the needed algorithms is not installed.public final void store(java.lang.String ksIniFile,
java.lang.String ualFile)
throws UserFatalException,
java.security.NoSuchAlgorithmException,
java.io.IOException
ksIniFile - the file path where the key-store is written.ualFile - the path of the UAL file used to protect the key-store.UserFatalException - Thrown if it fails decoding the UAL file.java.io.IOException - Thrown if a problem occurs when either reading the UAL file
or writing the KeyStore-Ini-file.java.security.NoSuchAlgorithmException - Thrown if one of the needed algorithms is not installed.public final void store(java.lang.String ksIniFile,
ProtectedPassword password)
throws UserFatalException,
java.security.NoSuchAlgorithmException,
java.io.IOException
ksIniFile - the file path where the key-store is written.password - the ProtectedPassword used to protect the KeystoreUserFatalException - Thrown if the password is null, or if it fails decoding
the UAL filejava.io.IOException - Thrown if a problem occurs when either reading the UAL file
or writing the KeyStore-Ini-file.java.security.NoSuchAlgorithmException - Thrown if one of the needed algorithms is not installed.public final void store(java.io.OutputStream ksIniFile,
java.lang.String ualFile)
throws UserFatalException,
java.security.NoSuchAlgorithmException,
java.io.IOException
ksIniFile - the output stream to which the key-store is written to.ualFile - the path of the UAL file used to protect the key-store.UserFatalException - Thrown if it fails decoding the UAL file.java.io.IOException - Thrown if a problem occurs when either reading the UAL file
or writing the KeyStore-Ini-file.java.security.NoSuchAlgorithmException - Thrown if one of the needed algorithms is not installed.