public class CryptoEngine extends Object
Simple crypto helper that uses symetric keys to crypt and decrypt resources passwords.
| Constructor and Description |
|---|
CryptoEngine() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public static String crypt(String cipher, String data) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, IOException
cipher - the cypther to use.data - the data to crypt.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.public static String decrypt(String cipher, String data) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, IOException
cipher - the cypther to use.data - the base64-encoded data to decrypt.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.Copyright © 2006-2016 Bitronix Software. All Rights Reserved.