Class LtpaKeyUtils

java.lang.Object
de.sephirothj.spring.security.ltpa2.LtpaKeyUtils

public class LtpaKeyUtils extends Object
Utility class for working with encoded and/or encrpyted keys exported from IBM WebSphere Application Server and Liberty Profile
Author:
Sephiroth
  • Constructor Details

    • LtpaKeyUtils

      public LtpaKeyUtils()
  • Method Details

    • decryptSharedKey

      @NonNull public SecretKey decryptSharedKey(@NonNull String encryptedKey, @NonNull String password) throws GeneralSecurityException
      decrypts the shared secret key (com.ibm.websphere.ltpa.3DESKey) that is used to encrypt a serialized LTPA2 token
      Parameters:
      encryptedKey - the base64-encoded and with 3DES encrypted key
      password - the password for decryption (attribute keysPassword in your server configuration)
      Returns:
      the decrypted key
      Throws:
      GeneralSecurityException - if anything went wrong
    • decodePublicKey

      @NonNull public PublicKey decodePublicKey(@NonNull String encryptedPublicKey) throws GeneralSecurityException
      decodes an base64-encoded public key com.ibm.websphere.ltpa.PublicKey
      Parameters:
      encryptedPublicKey - the base64-encoded public key which corresponds to the private key that is used to sign an LTPA2 token
      Returns:
      the decoded public key
      Throws:
      GeneralSecurityException - if anything went wrong
    • decryptPrivateKey

      @NonNull public PrivateKey decryptPrivateKey(@NonNull String encryptedKey, @NonNull String password) throws GeneralSecurityException
      decrypt the private key (com.ibm.websphere.ltpa.PrivateKey) that is used to sign an LTPA2 token
      Parameters:
      encryptedKey - the base64-encoded and with 3DES encrypted key
      password - the password for decryption
      Returns:
      the decrypted key
      Throws:
      GeneralSecurityException - if anything went wrong