org.knime.core.util
Class KnimeEncryption

java.lang.Object
  extended by org.knime.core.util.KnimeEncryption

public final class KnimeEncryption
extends Object

This class handles the encryption and decryption with the static stored key. To this class one static key supplier can be registered that is invoked if no key is available.

Author:
Christoph Sieb, University of Konstanz

Method Summary
static SecretKey createSecretKey(String phrase)
          Generates a SecretKey based on the given key phrase.
static String decrypt(SecretKey secretKey, String password)
          Decrypts password with the given SecrectKey.
static String decrypt(String password)
          Decrypts password.
static String encrypt(char[] password)
          Enrypts password.
static String encrypt(SecretKey secretKey, char[] password)
          Enrypts password with the given SecrectKey.
static void setEncryptionKeySupplier(EncryptionKeySupplier supplier)
          Sets the static encryption key supplier for this global static knime encryptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encrypt

public static String encrypt(char[] password)
                      throws BadPaddingException,
                             IllegalBlockSizeException,
                             InvalidKeyException,
                             UnsupportedEncodingException
Enrypts password.

Parameters:
password - as char array
Returns:
The password encrypt.
Throws:
IllegalBlockSizeException - IllegalBlockSizeException
BadPaddingException - BadPaddingException
InvalidKeyException - InvalidKeyException
UnsupportedEncodingException - UnsupportedEncodingException

encrypt

public static String encrypt(SecretKey secretKey,
                             char[] password)
                      throws BadPaddingException,
                             IllegalBlockSizeException,
                             InvalidKeyException,
                             UnsupportedEncodingException
Enrypts password with the given SecrectKey.

Parameters:
secretKey - SecretKey used to encrypt the password
password - as char array
Returns:
The password encrypt.
Throws:
IllegalBlockSizeException - IllegalBlockSizeException
BadPaddingException - BadPaddingException
InvalidKeyException - InvalidKeyException
UnsupportedEncodingException - UnsupportedEncodingException

decrypt

public static String decrypt(String password)
                      throws BadPaddingException,
                             IllegalBlockSizeException,
                             InvalidKeyException,
                             IOException,
                             UnsupportedEncodingException
Decrypts password.

Parameters:
password - The password to decrypt.
Returns:
The decrypted password.
Throws:
IllegalBlockSizeException - IllegalBlockSizeException
BadPaddingException - BadPaddingException
InvalidKeyException - InvalidKeyException
IOException - IOException
UnsupportedEncodingException - UnsupportedEncodingException

decrypt

public static String decrypt(SecretKey secretKey,
                             String password)
                      throws BadPaddingException,
                             IllegalBlockSizeException,
                             InvalidKeyException,
                             IOException,
                             UnsupportedEncodingException
Decrypts password with the given SecrectKey.

Parameters:
secretKey - SecretKey used to decrypt the password
password - The password to decrypt.
Returns:
The decrypted password.
Throws:
IllegalBlockSizeException - IllegalBlockSizeException
BadPaddingException - BadPaddingException
InvalidKeyException - InvalidKeyException
IOException - IOException
UnsupportedEncodingException - UnsupportedEncodingException

setEncryptionKeySupplier

public static void setEncryptionKeySupplier(EncryptionKeySupplier supplier)
Sets the static encryption key supplier for this global static knime encryptor.

Parameters:
supplier - the EncryptionKeySupplier that is asked for a key if has not been set so far

createSecretKey

public static SecretKey createSecretKey(String phrase)
Generates a SecretKey based on the given key phrase.

Parameters:
phrase - key phrase used to generate secret key
Returns:
a new secret key


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.