CryptoEngine (Bitronix Transaction Manager :: Core 2.1.4 API)
Date: 2013-09-15

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## bitronix.tm.utils
Class CryptoEngine

    java.lang.Object
      bitronix.tm.utils.CryptoEngine

    public class CryptoEngine

extends Object

Simple crypto helper that uses symetric keys to crypt and decrypt resources passwords.

Author:
  lorban

Constructor Summary
`CryptoEngine()`

Method Summary
`static String` | `crypt(String cipher, String data)` Crypt the given data using the given cipher.
`static String` | `decrypt(String cipher, String data)` Decrypt using the given cipher the given base64-encoded, crypted data.
`static void` | `main(String[] args)` Main method of this class to be used as a command-line tool to get a crypted version of a resource password.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CryptoEngine

    public CryptoEngine()

Method Detail

### crypt

    public static String crypt(String cipher,
                               String data)
                        throws InvalidKeyException,
                               NoSuchAlgorithmException,
                               NoSuchPaddingException,
                               InvalidKeySpecException,
                               IOException

  Crypt the given data using the given cipher. The crypted result is base64-encoded before it is returned.

  Parameters:
    `cipher` - the cypther to use.
    `data` - the data to crypt.
  Returns:
    crypted, base64-encoded data.
  Throws:
    `InvalidKeyException` - if the given key material is shorter than 8 bytes.
    `NoSuchAlgorithmException` - if a secret-key factory for the specified algorithm is not available in the default provider package or any of the other provider packages that were searched.
    `NoSuchPaddingException` - if transformation contains a padding scheme that is not available.
    `InvalidKeySpecException` - if the given key specification is inappropriate for this secret-key factory to produce a secret key.
    `IOException` - if an I/O error occurs.

### decrypt

    public static String decrypt(String cipher,
                                 String data)
                          throws InvalidKeyException,
                                 NoSuchAlgorithmException,
                                 NoSuchPaddingException,
                                 InvalidKeySpecException,
                                 IOException

  Decrypt using the given cipher the given base64-encoded, crypted data.

  Parameters:
    `cipher` - the cypther to use.
    `data` - the base64-encoded data to decrypt.
  Returns:
    decrypted data.
  Throws:
    `InvalidKeyException` - if the given key material is shorter than 8 bytes.
    `NoSuchAlgorithmException` - if a secret-key factory for the specified algorithm is not available in the default provider package or any of the other provider packages that were searched.
    `NoSuchPaddingException` - if transformation contains a padding scheme that is not available.
    `InvalidKeySpecException` - if the given key specification is inappropriate for this secret-key factory to produce a secret key.
    `IOException` - if an I/O error occurs.

### main

    public static void main(String[] args)
                     throws Exception

  Main method of this class to be used as a command-line tool to get a crypted version of a resource password.

  Parameters:
    `args` - the command-line arguments.
  Throws:
    `Exception` - when an error occurs crypting the given resource password.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2013 Bitronix Software. All Rights Reserved.