org.apache.xml.security.algorithms
Class JCEMapper

java.lang.Object
  |
  +--org.apache.xml.security.algorithms.JCEMapper

public class JCEMapper
extends java.lang.Object

This class maps algorithm identifier URIs to JAVA JCE class names.

Author:
$Author: vdkoogh $

Nested Class Summary
static class JCEMapper.ProviderIdClass
          Class ProviderIdClass
 
Field Summary
static java.lang.String KEYTYPE_BLOCK_ENCRYPTION
          Field KEYTYPE_BLOCK_ENCRYPTION
static java.lang.String KEYTYPE_KEY_TRANSPORT
          Field KEYTYPE_KEY_TRANSPORT
static java.lang.String KEYTYPE_SYMMETRIC_KEY_WRAP
          Field KEYTYPE_SYMMETRIC_KEY_WRAP
 
Constructor Summary
JCEMapper()
           
 
Method Summary
static boolean addProvider(java.lang.String Id)
          This method takes a Provider ID and tries to register this provider in the JCE.
static java.lang.String getAlgorithmClassFromURI(java.lang.String AlgorithmURI)
          Method getAlgorithmClassFromURI
static java.lang.String getJCEIVAlgorithmFromURI(java.lang.String AlgorithmURI, java.lang.String ProviderId)
           
static java.lang.String getJCEKeyAlgorithmFromURI(java.lang.String AlgorithmURI, java.lang.String ProviderId)
          Method getJCEKeyAlgorithmFromURI
static int getKeyLengthFromURI(java.lang.String AlgorithmURI)
          Returns the keylength in bit for a particular algorithm.
static int getKeyTypeFromURI(java.lang.String AlgorithmURI)
          Method getKeyTypeFromURI
static boolean getProviderIsInClassPath(java.lang.String providerId)
          Method getProviderIsAvailable
static boolean getProviderIsRegisteredAtSecurity(java.lang.String providerId)
          Return true if the Provider with the given providerId is available in Security.
static java.lang.String getURIfromKey(java.security.Key key, java.lang.String type)
          This takes a Key and one of the JCEMapper.KEYTYPE_XXX Strings and returns the algorithm for which this key is.
static void init(org.w3c.dom.Element mappingElement)
          Method init
static JCEMapper.ProviderIdClass translateURItoJCEID(java.lang.String AlgorithmURI)
          Method translateURItoJCEID
static JCEMapper.ProviderIdClass translateURItoJCEID(java.lang.String AlgorithmURI, java.lang.String requestedProviderId)
          Method translateURItoJCEID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEYTYPE_SYMMETRIC_KEY_WRAP

public static final java.lang.String KEYTYPE_SYMMETRIC_KEY_WRAP
Field KEYTYPE_SYMMETRIC_KEY_WRAP

See Also:
Constant Field Values

KEYTYPE_BLOCK_ENCRYPTION

public static final java.lang.String KEYTYPE_BLOCK_ENCRYPTION
Field KEYTYPE_BLOCK_ENCRYPTION

See Also:
Constant Field Values

KEYTYPE_KEY_TRANSPORT

public static final java.lang.String KEYTYPE_KEY_TRANSPORT
Field KEYTYPE_KEY_TRANSPORT

See Also:
Constant Field Values
Constructor Detail

JCEMapper

public JCEMapper()
Method Detail

init

public static void init(org.w3c.dom.Element mappingElement)
                 throws java.lang.Exception
Method init

Parameters:
mappingElement -
Throws:
java.lang.Exception

addProvider

public static boolean addProvider(java.lang.String Id)
This method takes a Provider ID and tries to register this provider in the JCE.

Parameters:
Id -

getProviderIsInClassPath

public static boolean getProviderIsInClassPath(java.lang.String providerId)
Method getProviderIsAvailable

Parameters:
providerId -

getProviderIsRegisteredAtSecurity

public static boolean getProviderIsRegisteredAtSecurity(java.lang.String providerId)
Return true if the Provider with the given providerId is available in Security.

Parameters:
providerId -
Returns:
true if the Provider with the given providerId is available in Security

translateURItoJCEID

public static JCEMapper.ProviderIdClass translateURItoJCEID(java.lang.String AlgorithmURI)
Method translateURItoJCEID

Parameters:
AlgorithmURI -

translateURItoJCEID

public static JCEMapper.ProviderIdClass translateURItoJCEID(java.lang.String AlgorithmURI,
                                                            java.lang.String requestedProviderId)
Method translateURItoJCEID

Parameters:
AlgorithmURI -
requestedProviderId -

getAlgorithmClassFromURI

public static java.lang.String getAlgorithmClassFromURI(java.lang.String AlgorithmURI)
Method getAlgorithmClassFromURI

Parameters:
AlgorithmURI -

getKeyTypeFromURI

public static int getKeyTypeFromURI(java.lang.String AlgorithmURI)
Method getKeyTypeFromURI

Parameters:
AlgorithmURI -

getKeyLengthFromURI

public static int getKeyLengthFromURI(java.lang.String AlgorithmURI)
Returns the keylength in bit for a particular algorithm.

Parameters:
AlgorithmURI -

getJCEKeyAlgorithmFromURI

public static java.lang.String getJCEKeyAlgorithmFromURI(java.lang.String AlgorithmURI,
                                                         java.lang.String ProviderId)
Method getJCEKeyAlgorithmFromURI

Parameters:
AlgorithmURI -
ProviderId -

getJCEIVAlgorithmFromURI

public static java.lang.String getJCEIVAlgorithmFromURI(java.lang.String AlgorithmURI,
                                                        java.lang.String ProviderId)

getURIfromKey

public static java.lang.String getURIfromKey(java.security.Key key,
                                             java.lang.String type)
This takes a Key and one of the JCEMapper.KEYTYPE_XXX Strings and returns the algorithm for which this key is.
Example: If you enter an AES Key of length 128 bit and the JCEMapper.KEYTYPE_SYMMETRIC_KEY_WRAP, the result is EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES128.

Parameters:
key -
type -