com.helger.security.keystore.EKeyStoreLoadError Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ph-security Show documentation
Show all versions of ph-security Show documentation
Special Java 1.8+ Library with security related functionality
/**
* Copyright (C) 2014-2019 Philip Helger (www.helger.com)
* philip[at]helger[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.helger.security.keystore;
import java.util.Locale;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.helger.commons.annotation.Nonempty;
import com.helger.commons.id.IHasID;
import com.helger.commons.text.display.IHasDisplayTextWithArgs;
/**
* Errors that can occur in {@link KeyStoreHelper}
*
* @author Philip Helger
*/
public enum EKeyStoreLoadError implements IHasID , IHasDisplayTextWithArgs
{
// KeyStore loading
/** No key store path provided. Parameters: none */
KEYSTORE_NO_PATH ("keystore-no-path", EKeyStoreLoadErrorText.KEYSTORE_NO_PATH),
/**
* Key store not existing. Parameters:
*
* - KeyStore path
* - Exception text
*
*/
KEYSTORE_LOAD_ERROR_NON_EXISTING ("keystore-load-error-non-existing",
EKeyStoreLoadErrorText.KEYSTORE_LOAD_ERROR_NON_EXISTING),
/**
* Invalid key store password. Parameters:
*
* - KeyStore path
* - Exception text
*
*/
KEYSTORE_INVALID_PASSWORD ("keystore-invalid-password", EKeyStoreLoadErrorText.KEYSTORE_INVALID_PASSWORD),
/**
* Invalid password or generic error. Parameters:
*
* - KeyStore path
* - Exception text
*
*/
KEYSTORE_LOAD_ERROR_FORMAT_ERROR ("keystore-load-error-format-error",
EKeyStoreLoadErrorText.KEYSTORE_LOAD_ERROR_FORMAT_ERROR),
// Key loading
/**
* No alias specified. Parameters:
*
* - KeyStore path
*
*/
KEY_NO_ALIAS ("key-no-alias", EKeyStoreLoadErrorText.KEY_NO_ALIAS),
/**
* No password specified. Parameters:
*
* - Alias name
* - KeyStore path
*
*/
KEY_NO_PASSWORD ("key-no-password", EKeyStoreLoadErrorText.KEY_NO_PASSWORD),
/**
* Alias does not exist. Parameters:
*
* - Alias name
* - KeyStore path
*
*/
KEY_INVALID_ALIAS ("key-invalid-alias", EKeyStoreLoadErrorText.KEY_INVALID_ALIAS),
/**
* Key is not of expected type. Parameters:
*
* - Alias name
* - KeyStore path
* - Effective technical type name
*
*/
KEY_INVALID_TYPE ("key-invalid-type", EKeyStoreLoadErrorText.KEY_INVALID_TYPE),
/**
* Invalid password for the key. Parameters:
*
* - Alias name
* - KeyStore path
* - Exception message
*
*/
KEY_INVALID_PASSWORD ("key-invalid-password", EKeyStoreLoadErrorText.KEY_INVALID_PASSWORD),
/**
* Generic error loading the key. Parameters:
*
* - Alias name
* - KeyStore path
* - Exception message
*
*/
KEY_LOAD_ERROR ("key-load-error", EKeyStoreLoadErrorText.KEY_LOAD_ERROR);
private final String m_sID;
private final EKeyStoreLoadErrorText m_aDisplayText;
private EKeyStoreLoadError (@Nonnull @Nonempty final String sID, @Nonnull final EKeyStoreLoadErrorText aDisplayText)
{
m_sID = sID;
m_aDisplayText = aDisplayText;
}
@Nonnull
@Nonempty
public String getID ()
{
return m_sID;
}
@Nullable
public String getDisplayText (@Nonnull final Locale aContentLocale)
{
return m_aDisplayText.getDisplayText (aContentLocale);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy