wicket.util.crypt
Class AbstractCrypt

java.lang.Object
  extended by wicket.util.crypt.AbstractCrypt
All Implemented Interfaces:
ICrypt
Direct Known Subclasses:
SunJceCrypt, TrivialCrypt

public abstract class AbstractCrypt
extends java.lang.Object
implements ICrypt

Abstract base class for JCE based ICrypt implementations.

Author:
Juergen Donnerstag

Constructor Summary
AbstractCrypt()
          Constructor
 
Method Summary
protected abstract  byte[] crypt(byte[] input, int mode)
          Crypts the given byte array
 java.lang.String decrypt(java.lang.String text)
          Decrypts a string into a string.
 java.lang.String decryptUrlSafe(java.lang.String text)
          Decrypts a string into a string.
 java.lang.String encrypt(java.lang.String plainText)
          Encrypt a string into a string
 java.lang.String encryptUrlSafe(java.lang.String plainText)
          Encrypt a string into a string using URL safe Base64 encoding.
 java.lang.String getKey()
          Get encryption private key
 void setKey(java.lang.String key)
          Set encryption private key
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCrypt

public AbstractCrypt()
Constructor

Method Detail

decrypt

public final java.lang.String decrypt(java.lang.String text)
Decrypts a string into a string.

Specified by:
decrypt in interface ICrypt
Parameters:
text - text to decript
Returns:
the decrypted text

decryptUrlSafe

public final java.lang.String decryptUrlSafe(java.lang.String text)
Decrypts a string into a string.

Specified by:
decryptUrlSafe in interface ICrypt
Parameters:
text - text to decript
Returns:
the decrypted text

encrypt

public final java.lang.String encrypt(java.lang.String plainText)
Encrypt a string into a string

Specified by:
encrypt in interface ICrypt
Parameters:
plainText - text to encrypt
Returns:
encrypted string

encryptUrlSafe

public final java.lang.String encryptUrlSafe(java.lang.String plainText)
Encrypt a string into a string using URL safe Base64 encoding.

Specified by:
encryptUrlSafe in interface ICrypt
Parameters:
plainText - text to encrypt
Returns:
encrypted string

getKey

public java.lang.String getKey()
Get encryption private key

Returns:
encryption private key

setKey

public void setKey(java.lang.String key)
Set encryption private key

Specified by:
setKey in interface ICrypt
Parameters:
key - private key to make de-/encryption unique

crypt

protected abstract byte[] crypt(byte[] input,
                                int mode)
                         throws java.security.GeneralSecurityException
Crypts the given byte array

Parameters:
input - byte array to be crypted
mode - crypt mode
Returns:
the input crypted. Null in case of an error
Throws:
java.security.GeneralSecurityException


Copyright © 2004-2007 Wicket developers. All Rights Reserved.