org.gcube.common.utils.encryption
Class StringEncrypter

java.lang.Object
  extended by org.gcube.common.utils.encryption.StringEncrypter
All Implemented Interfaces:
Encrypter<String>

public class StringEncrypter
extends Object
implements Encrypter<String>

Encrypter for String objects

Author:
Manuele Simi (CNR)

Method Summary
 String decrypt(String string, Key... key)
          Decrypts the string with the given key
 String encrypt(String string, Key... key)
          Encrypts the string with the given key
static StringEncrypter getEncrypter()
          Gets the Encrypter for String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getEncrypter

public static StringEncrypter getEncrypter()
Gets the Encrypter for String

Returns:
the encrypter

encrypt

public String encrypt(String string,
                      Key... key)
               throws Exception
Encrypts the string with the given key

Specified by:
encrypt in interface Encrypter<String>
Parameters:
key - the key for encrypting
string - the object to encrypt
Returns:
the encrypted string in a Base64 encoding
Throws:
Exception

decrypt

public String decrypt(String string,
                      Key... key)
               throws Exception
Decrypts the string with the given key

Specified by:
decrypt in interface Encrypter<String>
Parameters:
key - the key to use for decrypting
string - the object to decrypt
Returns:
the decripted string
Throws:
Exception


Copyright © 2013. All Rights Reserved.