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
KeyStore
s to handle cryptographic callbacks. Allows for specific key
stores to be set for various cryptographic operations.- Since:
- 2.3.0
- Author:
- Tareq Abed Rabbo, Arjen Poutsma, Jamin Hitchcock
- See Also:
-
Field Summary
Fields inherited from class org.springframework.ws.soap.security.callback.AbstractCallbackHandler
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
handleDecrypt
(org.apache.wss4j.common.ext.WSPasswordCallback callback) Invoked when the callback has aWSPasswordCallback.DECRYPT
usage.protected void
handleSecretKey
(org.apache.wss4j.common.ext.WSPasswordCallback callback) Invoked when the callback has aWSPasswordCallback.SECRET_KEY
usage.protected void
Loads the key store indicated by system properties.void
setKeyStore
(KeyStore keyStore) Sets the key store to use if a symmetric key name is embedded.void
setPrivateKeyPassword
(String privateKeyPassword) Sets the password used to retrieve private keys from the keystore.void
setSymmetricKeyPassword
(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, handleUsernameTokenPrincipal
Methods 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.DECRYPT
usage.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:
handleDecrypt
in classAbstractWsPasswordCallbackHandler
- Throws:
IOException
UnsupportedCallbackException
-
handleSecretKey
protected void handleSecretKey(org.apache.wss4j.common.ext.WSPasswordCallback callback) throws IOException, UnsupportedCallbackException Invoked when the callback has aWSPasswordCallback.SECRET_KEY
usage.Default implementation throws an
UnsupportedCallbackException
.- Overrides:
handleSecretKey
in classAbstractWsPasswordCallbackHandler
- Throws:
IOException
UnsupportedCallbackException
-
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:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
loadDefaultKeyStore
protected void loadDefaultKeyStore()Loads the key store indicated by system properties. Delegates toKeyStoreUtils.loadDefaultKeyStore()
.
-