/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
* Portions copyright 2011-2013 ForgeRock AS
*/
/**
* Class used to get the KeyStore that the graphical utilities use.
*
*/
{
UIKeyStore.class.getName());
/**
* This should never be called.
*/
private UIKeyStore()
{
}
/**
* Returns the KeyStore to be used by graphical applications.
* @return the KeyStore to be used by graphical applications.
* @throws IOException if there was a file system access error.
* @throws KeyStoreException if there was a problem while reading the key
* store.
* @throws CertificateException if an error with a certificate occurred.
* @throws NoSuchAlgorithmException if the used algorithm is not supported
* by the system.
*/
{
{
if (!f.exists())
{
keyStorePath = null;
}
else if (f.isDirectory())
{
keyStorePath = null;
}
else if (!f.canRead())
{
keyStorePath = null;
}
else if (!f.canWrite())
{
keyStorePath = null;
}
if (keyStorePath != null)
{
try
{
}
catch (Throwable t)
{
}
}
else
{
}
}
return keyStore;
}
/**
* Updates the Key Store with the provided certificate chain.
* @param chain the certificate chain to be accepted.
* @throws IOException if there was a file system access error.
* @throws KeyStoreException if there was a problem while reading or writing
* to the key store.
* @throws CertificateException if an error with a certificate occurred.
* @throws NoSuchAlgorithmException if the used algorithm is not supported
* by the system.
*/
{
KeyStore k = getInstance();
if (!containsCertificate(aChain, k)) {
int j = 1;
while (k.containsAlias(alias)) {
j++;
}
}
}
if (!f.exists())
{
Utils.createFile(f);
}
}
/**
* Returns the path where we store the keystore for the graphical
* applications.
* @return the path where we store the keystore for the graphical
* applications.
*/
{
}
/**
* Loads the local admin truststore.
* @param keyStore the keystore where the admin truststore will be loaded.
*/
{
if (!f.exists())
{
}
else if (f.isDirectory())
{
}
else if (!f.canRead())
{
}
if (adminTrustStorePath != null)
{
try
{
while (aliases.hasMoreElements())
{
{
}
else
{
}
}
}
catch (Throwable t)
{
adminTrustStorePath, t);
}
finally
{
try
{
{
}
}
catch (Throwable t)
{
adminTrustStorePath, t);
}
}
}
}
/**
* Returns the path where the local admin trust store is.
* @return the path where the local admin trust store is.
*/
{
}
/**
* Returns whether the key store contains the provided certificate or not.
* @param cert the certificate.
* @param keyStore the key store.
* @return whether the key store contains the provided certificate or not.
* @throws KeyStoreException if an error occurs reading the contents of the
* key store.
*/
{
boolean found = false;
{
{
}
}
return found;
}
}