IBM Support

PM65435: THE WS-SECURITY JAX-WS X509 TOKEN CONSUMER IS NOT ACCEPTING TOKENS THROUGH THE SHAREDSTATE.

Fixes are available

7.0.0.27: WebSphere Application Server V7.0 Fix Pack 27
8.5.0.2: WebSphere Application Server V8.5 Fix Pack 2
8.0.0.6: WebSphere Application Server V8.0 Fix Pack 6
7.0.0.29: WebSphere Application Server V7.0 Fix Pack 29
8.0.0.7: WebSphere Application Server V8.0 Fix Pack 7
8.0.0.8: WebSphere Application Server V8.0 Fix Pack 8
7.0.0.31: WebSphere Application Server V7.0 Fix Pack 31
7.0.0.27: Java SDK 1.6 SR13 FP2 Cumulative Fix for WebSphere Application Server
7.0.0.33: WebSphere Application Server V7.0 Fix Pack 33
8.0.0.9: WebSphere Application Server V8.0 Fix Pack 9
7.0.0.35: WebSphere Application Server V7.0 Fix Pack 35
8.0.0.10: WebSphere Application Server V8.0 Fix Pack 10
7.0.0.37: WebSphere Application Server V7.0 Fix Pack 37
8.0.0.11: WebSphere Application Server V8.0 Fix Pack 11
7.0.0.39: WebSphere Application Server V7.0 Fix Pack 39
8.0.0.12: WebSphere Application Server V8.0 Fix Pack 12
7.0.0.41: WebSphere Application Server V7.0 Fix Pack 41
8.0.0.13: WebSphere Application Server V8.0 Fix Pack 13
7.0.0.43: WebSphere Application Server V7.0 Fix Pack 43
8.0.0.14: WebSphere Application Server V8.0 Fix Pack 14
7.0.0.45: WebSphere Application Server V7.0 Fix Pack 45
8.0.0.15: WebSphere Application Server V8.0 Fix Pack 15
7.0.0.27: Java SDK 1.6 SR12 Cumulative Fix for WebSphere Application Server
7.0.0.29: Java SDK 1.6 SR13 FP2 Cumulative Fix for WebSphere Application Server
7.0.0.45: Java SDK 1.6 SR16 FP60 Cumulative Fix for WebSphere Application Server
7.0.0.31: Java SDK 1.6 SR15 Cumulative Fix for WebSphere Application Server
7.0.0.35: Java SDK 1.6 SR16 FP1 Cumulative Fix for WebSphere Application Server
7.0.0.37: Java SDK 1.6 SR16 FP3 Cumulative Fix for WebSphere Application Server
7.0.0.39: Java SDK 1.6 SR16 FP7 Cumulative Fix for WebSphere Application Server
7.0.0.41: Java SDK 1.6 SR16 FP20 Cumulative Fix for WebSphere Application Server
7.0.0.43: Java SDK 1.6 SR16 FP41 Cumulative Fix for WebSphere Application Server
Obtain the fix for this APAR.

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • When you put an X509 token in the sharedState for use by the
    X509GenerateLoginModule or X509ConsumeLoginModule, the login
    modules are not recognizing the passed-in token.
    
    Passing a token into the X509 login modules is necessary for
    proper operation of scenarios where the use of dynamic
    certificates is required.
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  IBM WebSphere Application Server            *
    *                  developers of WS-Security enabled JAX-WS    *
    *                  applications.                               *
    ****************************************************************
    * PROBLEM DESCRIPTION: The X.509 token consumer and            *
    *                      generator cannot accept an              *
    *                      application specified public            *
    *                      certificate or private key.             *
    ****************************************************************
    * RECOMMENDATION:  Install a fix pack that contains this       *
    *                  APAR.                                       *
    ****************************************************************
    A fully-formed SAML token can be can be put in the sharedState
    by a login module and the SAMLGenerateLoginModule will use
    that token as if it were built by itself.  When you put an
    X.509 token in the sharedState for use by the
    X509GenerateLoginModule or X509ConsumeLoginModule, the login
    modules are not recognizing the passed-in token.
    Passing a token into the X509 login modules is necessary for
    proper operation of scenarios where the use of dynamic
    certificates is required.
    

Problem conclusion

  • The WS-Security runtime is updated to allow an application
    developer to dynamically set the public certificate or private
    key that the X.509 token consumer or generator uses when
    generating or consuming a message.
    
    Three new methods are added to
    com.ibm.websphere.wssecurity.wssapi.token.GenericSecurityTokenFa
    ctory
    
    X509Token getSimpleX509PublicToken(X509Certificate certificate)
    X509Token getSimpleX509PrivateToken(X509Certificate
    certificate, Key privateKey)
    X509Token getSimpleX509Token(X509Certificate certificate, Key
    privateKey)
    
    An application developer can pass custom data to the
    X509GenerateLoginModule and X509ConsumeLoginModule in two ways
    in this priority order:
    
    1) From the sharedState from a stacked JAAS login module
    2) From the com.ibm.wsspi.wssecurity.token.tokenHolder list
    on the message context
    
    Refer to the following constants in
    com.ibm.wsspi.wssecurity.core.Constants for more information:
    
    com.ibm.wsspi.wssecurity.token.tokenHolder
    com.ibm.wsspi.wssecurity.token.enableCaptureTokenContext
    
    An application developer can change the certificate or key
    that is used and emitted in the message by
    X509GenerateLoginModule.  The certificate or key that is used
    to evaluate the message by X509ConsumeLoginModule can also be
    changed.  For the generator, it will override what is
    configured in the callback handler.  For the consumer, it will
    override the certificate or key for either what is in the
    message or what is specified in the callback handler
    (depending on the action at the time, ie signature validation,
    decryption, etc).
    
    There are two most likely to be used scenarios for this
    function:
    
    1) A sender process wants to dynamically determine
    which key to sign with based on a criteria.  The built-in
    generator callback handler only allows a single hardcoded
    keystore/alias combination, so this would not be possible.
    
    2) A receiver process will receive messages from clients that
    use different KEYIDs.  The built-in consumer callback handler
    only allows a single hardcoded keystore/alias combination, so
    only ONE KEYID can be accepted by the receiver.
    
    With this update, for scenario #1, the stacked login module
    can determine which key to use, call
    getSimpleX509PrivateToken, then put the token on the shared
    state.  The X509GenerateLoginModule will then continue as if
    it had obtained the key itself.
    
    For scenario #2, tthe stacked login module can obtain the
    KEYID string from the message, then do the processing required
    to retrieve the correct key from a keystore.  Next, call
    getSimpleX509PublicToken and put the token on the shared
    state.  The X509ConsumeLoginModule will then continue as if it
    had obtained the certificate itself.
    
    
    Here is an example of code that would go in a stacked login
    module in the login() method.  _sharedState comes from the
    first Map parameter on the initialize method in the login
    module.
    
    import
    com.ibm.websphere.wssecurity.wssapi.token.GenericSecurityTokenFa
    ctory;
    //WSSUtilFactory is added on PM70833
    import com.ibm.websphere.wssecurity.wssapi.WSSUtilFactory;
    
    public boolean login() throws LoginException {
    //get the factories
    GenericSecurityTokenFactory factory =
    GenericSecurityTokenFactory.getInstance()
    WSSUtilFactory utilFactory = WSSUtilFactory.getInstance();
    
    //open the keystore
    java.security.KeyStore keystore =
    utilFactory.getKeystore(keystoreType,keystoreName,keystorePass);
    
    //get the key/certificate
    X509Certificate publicKey = null;
    Key privateKey = null;
    
    KeyStore.PasswordProtection pwdProtection = new
          KeyStore.PasswordProtection(aliasPass.toCharArray());
    KeyStore.Entry entry = keystore.getEntry(alias, pwdProtection);
    
    if (entry instanceof KeyStore.PrivateKeyEntry) {
      KeyStore.PrivateKeyEntry pkentry =
                              (KeyStore.PrivateKeyEntry)entry;
      cert = pkentry.getCertificate();
      privateKey = pkentry.getPrivateKey();
    } else if (entry instanceof KeyStore.TrustedCertificateEntry) {
      KeyStore.TrustedCertificateEntry tcentry =
                          (KeyStore.TrustedCertificateEntry)entry;
      cert = tcentry.getTrustedCertificate();
    }
    if ((cert != null) && (cert instanceof X509Certificate)) {
      publicKey = (X509Certificate)cert;
    }
    
    X509Token x509 = factory.getSimpleX509PrivateToken(publicKey,
                             privateKey);
    
    factory.putGeneratorTokenToSharedState(_sharedState, x509);
    //-or-
    factory.putConsumerTokenToSharedState(_sharedState, x509);
    
    return true;
    }
    
    Only the public certificate or the private key will be used by
    the generator or consumer that is stacked under the custom
    login module depending on the use of the consumer/generator.
    For example: public key=verify signature/encrypting, private
    key=signing/decrypting.  If your login module will only serve
    a single purpose, you only need to pass the public certificate
    or the private key; you do not need to provide both.
    
    APAR PM65435 requires changes to documentation.
    
    NOTE: Periodically, we refresh the documentation on our
    Web site, so the changes might have been made before you
    read this text. To access the latest on-line
    documentation, go to the product library page at:
    
    http://www.ibm.com/software/webservers/appserv/library
    
    The following changes to the WebSphere Application Server
    Version 7.0 Information Center will be made available in
    January, 2013.
    
    A new topic "Creating X.509 tokens for Web services security
    using APIs"
    will be added to the version 7.0 information center that
    indicates that, starting with Version 7.0.0.27, you can use the
    GenericSecurityTokenFactory APIs to create X.509 security
    tokens for use by the WS-Security runtime.  This new topic
    will also describe how to create a simple X.509 token, and how
    to create a JAAS login module that can be stacked on top of
    X509GenerateLoginModule or X509ConsumeLoginModule package
    test.tokens.
    
    APAR PM65435 is currently targeted for inclusion in WebSphere
    Application Server Fix Packs 7.0.0.27, 8.0.0.6, and 8.5.0.2.
    
    Please refer to URL:
    //www.ibm.com/support/docview.wss?rs=404&uid=swg27006970
    for Fix Pack availability.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PM65435

  • Reported component name

    WEBSPHERE FOR Z

  • Reported component ID

    5655I3500

  • Reported release

    700

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2012-05-24

  • Closed date

    2012-10-10

  • Last modified date

    2013-02-04

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

    PM70890

Fix information

  • Fixed component name

    WEBSPHERE FOR Z

  • Fixed component ID

    5655I3500

Applicable component levels

  • R700 PSY UK90578

       UP13/01/18 P F301

Fix is available

  • Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.



Document information

More support for: WebSphere Application Server for z/OS
General

Software version: 7.0

Reference #: PM65435

Modified date: 04 February 2013