Spring Web Services Framework

org.springframework.ws.soap.security.wss4j.callback
Class KeyStoreCallbackHandler

java.lang.Object
  extended by org.springframework.ws.soap.security.callback.AbstractCallbackHandler
      extended by org.springframework.ws.soap.security.wss4j.callback.AbstractWsPasswordCallbackHandler
          extended by org.springframework.ws.soap.security.wss4j.callback.KeyStoreCallbackHandler
All Implemented Interfaces:
CallbackHandler, InitializingBean

public class KeyStoreCallbackHandler
extends AbstractWsPasswordCallbackHandler
implements 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:
1.5.0
Author:
Tareq Abed Rabbo, Arjen Poutsma
See Also:
KeyStoreFactoryBean

Field Summary
 
Fields inherited from class org.springframework.ws.soap.security.callback.AbstractCallbackHandler
logger
 
Constructor Summary
KeyStoreCallbackHandler()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  void handleDecrypt(WSPasswordCallback callback)
          Invoked when the callback has a WSPasswordCallback.DECRYPT usage.
protected  void handleSecretKey(WSPasswordCallback callback)
          Invoked when the callback has a WSPasswordCallback.SECRET_KEY usage.
protected  void loadDefaultKeyStore()
          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.wss4j.callback.AbstractWsPasswordCallbackHandler
handleCleanup, handleCustomToken, handleInternal, handleSecurityContextToken, handleSignature, handleUsernameToken, handleUsernameTokenPrincipal
 
Methods inherited from class org.springframework.ws.soap.security.callback.AbstractCallbackHandler
handle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyStoreCallbackHandler

public KeyStoreCallbackHandler()
Method Detail

setKeyStore

public void setKeyStore(KeyStore keyStore)
Sets the key store to use if a symmetric key name is embedded.


setPrivateKeyPassword

public void setPrivateKeyPassword(String privateKeyPassword)
Sets the password used to retrieve private keys from the keystore. This property is required for decryption based on private keys, and signing.


setSymmetricKeyPassword

public void setSymmetricKeyPassword(String symmetricKeyPassword)
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:
setPrivateKeyPassword(String)

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

handleDecrypt

protected void handleDecrypt(WSPasswordCallback callback)
                      throws IOException,
                             UnsupportedCallbackException
Description copied from class: AbstractWsPasswordCallbackHandler
Invoked when the callback has a WSPasswordCallback.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 class AbstractWsPasswordCallbackHandler
Throws:
IOException
UnsupportedCallbackException

handleSecretKey

protected void handleSecretKey(WSPasswordCallback callback)
                        throws IOException,
                               UnsupportedCallbackException
Description copied from class: AbstractWsPasswordCallbackHandler
Invoked when the callback has a WSPasswordCallback.SECRET_KEY usage.

Default implementation throws an UnsupportedCallbackException.

Overrides:
handleSecretKey in class AbstractWsPasswordCallbackHandler
Throws:
IOException
UnsupportedCallbackException

loadDefaultKeyStore

protected void loadDefaultKeyStore()
Loads the key store indicated by system properties. Delegates to KeyStoreUtils.loadDefaultKeyStore().


Spring Web Services Framework

Copyright © 2005-2013 The Spring Web Services Framework. All Rights Reserved.