Class KeyStoreCallbackHandler
java.lang.Object
org.springframework.ws.soap.security.callback.AbstractCallbackHandler
org.springframework.ws.soap.security.wss4j2.callback.AbstractWsPasswordCallbackHandler
org.springframework.ws.soap.security.wss4j2.callback.KeyStoreCallbackHandler
- All Implemented Interfaces:
CallbackHandler,org.springframework.beans.factory.InitializingBean
public class KeyStoreCallbackHandler
extends AbstractWsPasswordCallbackHandler
implements org.springframework.beans.factory.InitializingBean
Callback handler that uses Java Security
KeyStores to handle cryptographic
callbacks. Allows for specific key stores to be set for various cryptographic
operations.- Since:
- 2.3.0
- See Also:
-
Field Summary
Fields inherited from class org.springframework.ws.soap.security.callback.AbstractCallbackHandler
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidhandleDecrypt(org.apache.wss4j.common.ext.WSPasswordCallback callback) Invoked when the callback has aWSPasswordCallback.DECRYPTusage.protected voidhandleSecretKey(org.apache.wss4j.common.ext.WSPasswordCallback callback) Invoked when the callback has aWSPasswordCallback.SECRET_KEYusage.protected voidLoads the key store indicated by system properties.voidsetKeyStore(KeyStore keyStore) Sets the key store to use if a symmetric key name is embedded.voidsetPrivateKeyPassword(String privateKeyPassword) Sets the password used to retrieve private keys from the keystore.voidsetSymmetricKeyPassword(String symmetricKeyPassword) Sets the password used to retrieve keys from the symmetric keystore.Methods inherited from class org.springframework.ws.soap.security.wss4j2.callback.AbstractWsPasswordCallbackHandler
handleCleanup, handleCustomToken, handleInternal, handleSecurityContextToken, handleSignature, handleUsernameToken, handleUsernameTokenPrincipalMethods inherited from class org.springframework.ws.soap.security.callback.AbstractCallbackHandler
handle
-
Constructor Details
-
KeyStoreCallbackHandler
public KeyStoreCallbackHandler()
-
-
Method Details
-
handleDecrypt
protected void handleDecrypt(org.apache.wss4j.common.ext.WSPasswordCallback callback) throws IOException, UnsupportedCallbackException Invoked when the callback has aWSPasswordCallback.DECRYPTusage.This method is invoked when WSS4J needs a password to get the private key of the
identifier(username) from the keystore. WSS4J uses this private key to decrypt the session (symmetric) key. Because the encryption method uses the public key to encrypt the session key it needs no password (a public key is usually not protected by a password).Default implementation throws an
UnsupportedCallbackException.- Overrides:
handleDecryptin classAbstractWsPasswordCallbackHandler- Throws:
IOExceptionUnsupportedCallbackException
-
handleSecretKey
protected void handleSecretKey(org.apache.wss4j.common.ext.WSPasswordCallback callback) throws IOException, UnsupportedCallbackException Invoked when the callback has aWSPasswordCallback.SECRET_KEYusage.Default implementation throws an
UnsupportedCallbackException.- Overrides:
handleSecretKeyin classAbstractWsPasswordCallbackHandler- Throws:
IOExceptionUnsupportedCallbackException
-
setKeyStore
Sets the key store to use if a symmetric key name is embedded. -
setPrivateKeyPassword
Sets the password used to retrieve private keys from the keystore. This property is required for decryption based on private keys, and signing. -
setSymmetricKeyPassword
Sets the password used to retrieve keys from the symmetric keystore. If this property is not set, it defaults to the private key password.- See Also:
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
loadDefaultKeyStore
protected void loadDefaultKeyStore()Loads the key store indicated by system properties. Delegates toKeyStoreUtils.loadDefaultKeyStore().
-