org.openswing.swing.permissions.java
Class CryptUtils

java.lang.Object
  extended byorg.openswing.swing.permissions.java.CryptUtils

public class CryptUtils
extends java.lang.Object

Title: OpenSwing Framework

Description: Utility class used to crypt and decrypt of bytes. This class can be used by LoginDialog class to encode/decode the password field. This class can be used by any other layer: there are two initializers, based on "getInstance" method; - getInstance() initializes the internal cipher by providing a default internal password - getInstance(String passwd) initializes the internal cipher by providing an application defined password

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it


Method Summary
 byte[] decodeBytes(byte[] encodedBytes)
           
 java.lang.String decodeText(byte[] encodedBytes)
           
 byte[] encodeBytes(byte[] clearBytes)
           
 byte[] encodeText(java.lang.String clearText)
           
static CryptUtils getInstance()
           
static CryptUtils getInstance(java.lang.String passwd)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static CryptUtils getInstance()
Returns:
unique instance of this class

getInstance

public static CryptUtils getInstance(java.lang.String passwd)
Parameters:
passwd - password used to initialize the encryption/decryption cipher
Returns:
unique instance of this class

encodeBytes

public final byte[] encodeBytes(byte[] clearBytes)
                         throws java.lang.Throwable
Parameters:
clearBytes - bytes to encode
Returns:
encoded bytes
Throws:
java.lang.Throwable

decodeBytes

public final byte[] decodeBytes(byte[] encodedBytes)
                         throws java.lang.Throwable
Parameters:
encodedBytes - bytes to decode
Returns:
decoded bytes
Throws:
java.lang.Throwable

encodeText

public final byte[] encodeText(java.lang.String clearText)
                        throws java.lang.Throwable
Parameters:
clearText - text to encode
Returns:
encoded text as bytes
Throws:
java.lang.Throwable

decodeText

public final java.lang.String decodeText(byte[] encodedBytes)
                                  throws java.lang.Throwable
Parameters:
encodedBytes - bytes to decode as text
Returns:
decoded text
Throws:
java.lang.Throwable