- java.lang.Object
-
- org.apache.xml.security.algorithms.JCEMapper
-
- Direct Known Subclasses:
JCEAlgorithmMapper
public class JCEMapper extends java.lang.ObjectThis class maps algorithm identifier URIs to JAVA JCE class names.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJCEMapper.AlgorithmRepresents the Algorithm xml element
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<java.lang.String,JCEMapper.Algorithm>algorithmsMapprivate static java.lang.StringglobalProviderNameprivate static java.lang.System.LoggerLOGprivate static java.lang.ThreadLocal<java.lang.String>threadSpecificProviderName
-
Constructor Summary
Constructors Constructor Description JCEMapper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static JCEMapper.AlgorithmgetAlgorithm(java.lang.String algorithmURI)Method getAlgorithmstatic java.lang.StringgetAlgorithmClassFromURI(java.lang.String algorithmURI)Method getAlgorithmClassFromURIstatic intgetIVLengthFromURI(java.lang.String algorithmURI)static java.lang.StringgetJCEKeyAlgorithmFromURI(java.lang.String algorithmURI)Method getJCEKeyAlgorithmFromURIstatic java.lang.StringgetJCEProviderFromURI(java.lang.String algorithmURI)Method getJCEProviderFromURIstatic intgetKeyLengthFromURI(java.lang.String algorithmURI)Returns the keylength in bits for a particular algorithm.static java.lang.StringgetProviderId()Gets the default Provider for obtaining the security algorithmsstatic voidregister(java.lang.String id, JCEMapper.Algorithm algorithm)Method registerstatic voidregisterDefaultAlgorithms()This method registers the default algorithms.static voidsetProviderId(java.lang.String provider)Sets the default Provider for obtaining the security algorithmsstatic voidsetThreadSpecificProviderName(java.lang.String threadSpecificProviderName)Sets the default Provider for this thread to obtain the security algorithmsstatic java.lang.StringtranslateURItoJCEID(java.lang.String algorithmURI)Method translateURItoJCEID
-
-
-
Field Detail
-
LOG
private static final java.lang.System.Logger LOG
-
algorithmsMap
private static java.util.Map<java.lang.String,JCEMapper.Algorithm> algorithmsMap
-
globalProviderName
private static java.lang.String globalProviderName
-
threadSpecificProviderName
private static final java.lang.ThreadLocal<java.lang.String> threadSpecificProviderName
-
-
Method Detail
-
register
public static void register(java.lang.String id, JCEMapper.Algorithm algorithm)Method register- Parameters:
id-algorithm-- Throws:
java.lang.SecurityException- if a security manager is installed and the caller does not have permission to register the JCE algorithm
-
registerDefaultAlgorithms
public static void registerDefaultAlgorithms()
This method registers the default algorithms.
-
translateURItoJCEID
public static java.lang.String translateURItoJCEID(java.lang.String algorithmURI)
Method translateURItoJCEID- Parameters:
algorithmURI-- Returns:
- the JCE standard name corresponding to the given URI
-
getAlgorithmClassFromURI
public static java.lang.String getAlgorithmClassFromURI(java.lang.String algorithmURI)
Method getAlgorithmClassFromURI- Parameters:
algorithmURI-- Returns:
- the class name that implements this algorithm
-
getKeyLengthFromURI
public static int getKeyLengthFromURI(java.lang.String algorithmURI)
Returns the keylength in bits for a particular algorithm.- Parameters:
algorithmURI-- Returns:
- The length of the key used in the algorithm
-
getIVLengthFromURI
public static int getIVLengthFromURI(java.lang.String algorithmURI)
-
getJCEKeyAlgorithmFromURI
public static java.lang.String getJCEKeyAlgorithmFromURI(java.lang.String algorithmURI)
Method getJCEKeyAlgorithmFromURI- Parameters:
algorithmURI-- Returns:
- The KeyAlgorithm for the given URI.
-
getJCEProviderFromURI
public static java.lang.String getJCEProviderFromURI(java.lang.String algorithmURI)
Method getJCEProviderFromURI- Parameters:
algorithmURI-- Returns:
- The JCEProvider for the given URI.
-
getAlgorithm
private static JCEMapper.Algorithm getAlgorithm(java.lang.String algorithmURI)
Method getAlgorithm- Parameters:
algorithmURI-- Returns:
- The Algorithm object for the given URI.
-
getProviderId
public static java.lang.String getProviderId()
Gets the default Provider for obtaining the security algorithms- Returns:
- the default providerId.
-
setProviderId
public static void setProviderId(java.lang.String provider)
Sets the default Provider for obtaining the security algorithms- Parameters:
provider- the default providerId.- Throws:
java.lang.SecurityException- if a security manager is installed and the caller does not have permission to register the JCE algorithm
-
setThreadSpecificProviderName
public static void setThreadSpecificProviderName(java.lang.String threadSpecificProviderName)
Sets the default Provider for this thread to obtain the security algorithms- Parameters:
threadSpecificProviderName- the default providerId.- Throws:
java.lang.SecurityException- if a security manager is installed and the caller does not have permission to register the JCE algorithm
-
-