Package org.apache.wss4j.common.crypto
Class CryptoFactory
- java.lang.Object
-
- org.apache.wss4j.common.crypto.CryptoFactory
-
public abstract class CryptoFactory extends Object
CryptoFactory.
-
-
Constructor Summary
Constructors Constructor Description CryptoFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Crypto
getInstance()
getInstancestatic Crypto
getInstance(Class<? extends Crypto> cryptoClass, Map<Object,Object> map)
getInstancestatic Crypto
getInstance(String propFilename)
getInstancestatic Crypto
getInstance(String propFilename, ClassLoader customClassLoader)
static Crypto
getInstance(Properties properties)
getInstancestatic Crypto
getInstance(Properties properties, ClassLoader classLoader, PasswordEncryptor passwordEncryptor)
getInstancestatic Properties
getProperties(String propFilename, ClassLoader loader)
This allows loading the resources with a custom class loader
-
-
-
Method Detail
-
getInstance
public static Crypto getInstance() throws WSSecurityException
getInstance Returns an instance of Crypto. This method uses the filecrypto.properties
to determine which implementation to use. Thus the propertyorg.apache.wss4j.crypto.provider
must define the classname of the Crypto implementation. The file may contain other property definitions as well. These properties are handed over to the Crypto implementation. The filecrypto.properties
is loaded with theLoader.getResource()
method.- Returns:
- The crypto implementation was defined
- Throws:
WSSecurityException
- if there is an error in loading the crypto properties
-
getInstance
public static Crypto getInstance(Properties properties) throws WSSecurityException
getInstance Returns an instance of Crypto. The properties are handed over the the crypto implementation. The properties must at least contain the Crypto implementation class name as the value of the property : org.apache.wss4j.crypto.provider- Parameters:
properties
- The Properties that are forwarded to the crypto implementation and the Crypto impl class name. These properties are dependent on the crypto implementation- Returns:
- The cyrpto implementation or null if no cryptoClassName was defined
- Throws:
WSSecurityException
- if there is an error in loading the crypto properties
-
getInstance
public static Crypto getInstance(Properties properties, ClassLoader classLoader, PasswordEncryptor passwordEncryptor) throws WSSecurityException
getInstance Returns an instance of Crypto loaded with the given classloader. The properties are handed over the the crypto implementation. The properties must at least contain the Crypto implementation class name as the value of the property : org.apache.wss4j.crypto.provider- Parameters:
properties
- The Properties that are forwarded to the crypto implementation and the Crypto impl class name. These properties are dependent on the crypto implementationclassLoader
- The class loader to usepasswordEncryptor
- The PasswordEncryptor to use to decrypt encrypted passwords- Returns:
- The crypto implementation or null if no cryptoClassName was defined
- Throws:
WSSecurityException
- if there is an error in loading the crypto properties
-
getInstance
public static Crypto getInstance(Class<? extends Crypto> cryptoClass, Map<Object,Object> map) throws WSSecurityException
getInstance Returns an instance of Crypto. The supplied map is handed over the the crypto implementation. The map can benull
. It is dependent on the Crypto implementation how the initialization is done in this case.- Parameters:
cryptoClass
- This is the crypto implementation class. No default is provided here.map
- The Maps that is forwarded to the crypto implementation. These contents of the map are dependent on the underlying crypto implementation specified in the cryptoClassName parameter.- Returns:
- The crypto implementation or null if no cryptoClassName was defined
- Throws:
WSSecurityException
- if there is an error in loading the crypto properties
-
getInstance
public static Crypto getInstance(String propFilename) throws WSSecurityException
getInstance Returns an instance of Crypto. This method uses the specified filename to load a property file. This file shall use the propertyorg.apache.wss4j.crypto.provider
to define the classname of the Crypto implementation. The file may contain other property definitions as well. These properties are handed over to the Crypto implementation. The specified file is loaded with theLoader.getResource()
method.- Parameters:
propFilename
- The name of the property file to load- Returns:
- The crypto implementation that was defined
- Throws:
WSSecurityException
- if there is an error in loading the crypto properties
-
getInstance
public static Crypto getInstance(String propFilename, ClassLoader customClassLoader) throws WSSecurityException
- Throws:
WSSecurityException
-
getProperties
public static Properties getProperties(String propFilename, ClassLoader loader) throws WSSecurityException
This allows loading the resources with a custom class loader- Parameters:
propFilename
-loader
-- Returns:
- a Properties object loaded from the propFilename argument
- Throws:
WSSecurityException
- if there is an error in loading the crypto properties
-
-