Search code examples
javaphpencryptionwebspheresingle-sign-on

How to decrypt LTPA token version 2


I'm working on project which is required SSO implementation between WebShpere and PHP web application.

However after i take a look at possible ways to implement SSO i find the LTPA token which is used to implement SSO between different IBM technologies.

but LTPA token 2 is encrypted cookie file. which i should decrypt if i want to use information inside this file such as (userid, username, email ... etc).

i have make deep search about LTPA token 2 and below is the best definition i find from IBM.

LTPA2 signatures are generated using SHA-1 as the hash algorithm, and RSA (1024-bit key) as the encryption algorithm. After the digital signature has been attached, the user data and signature are encrypted with a 3DES or AES key obtained from the LTPA key file (refer to “Consuming LTPA tokens” and “Generating LTPA tokens”).

But i'm still trying to decrypt this token with no luck.

Any help ?


Solution

  • The Alfresco project did this. Take a look at this blog post for pointers, including working code.

    To clarify things, the contents of LTPA tokens are strings that are more or less like "uid=user,cn=users,ou=myorg,dc=com@ldaprealm%timeout%[RSA signature]", encrypted with the shared AES key and encoded with Base64. LTPA v2 will not use 3DES, but only AES. So what you need really to do is to AES decrypt the cookie, and you can already read the username. You don't have to verify the RSA signature.