com.wewebu.ow.server.util
Class OwSecretEncryption

java.lang.Object
  extended by com.wewebu.ow.server.util.OwSecretEncryption

public class OwSecretEncryption
extends Object

Utility class to encrypt / decrypt strings.

You can use this class for simple encryption of strings.
WARNING:
This class offers only weak encryption. Everybody with access to this class file is able to read the encrypted string! The key is stored inside OwSecretKey.class

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com


Constructor Summary
OwSecretEncryption()
           
 
Method Summary
static String bytesToString(byte[] bytes_p)
          get a string representation of the given byte array
static byte[] decrypt(byte[] encrypted_p)
          decrypt the given byte array
static String decryptToString(byte[] encrypted_p)
          decryt the given byte array to string using "ISO-8859-1" format
static String decryptToString(byte[] encrypted_p, String format_p)
          decryt the given byte array
static byte[] encrypt(byte[] bytes_p)
          encrypt the given byte array
static byte[] encrypt(String text_p)
          encrypt the given string
static byte[] stringToBytes(String text_p)
          get a byte array from the given string, that was created with bytesToString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OwSecretEncryption

public OwSecretEncryption()
Method Detail

bytesToString

public static String bytesToString(byte[] bytes_p)
get a string representation of the given byte array

Parameters:
bytes_p -
Returns:
a string representation of the given byte array
See Also:
stringToBytes(String)

stringToBytes

public static byte[] stringToBytes(String text_p)
                            throws OwInvalidOperationException
get a byte array from the given string, that was created with bytesToString

Parameters:
text_p -
Returns:
a byte array
Throws:
OwInvalidOperationException
OwInvalidOperationException
See Also:
bytesToString(byte[])

encrypt

public static byte[] encrypt(String text_p)
                      throws OwInvalidOperationException
encrypt the given string

Parameters:
text_p -
Returns:
a byte array
Throws:
OwInvalidOperationException

encrypt

public static byte[] encrypt(byte[] bytes_p)
                      throws OwInvalidOperationException
encrypt the given byte array

Parameters:
bytes_p -
Returns:
the encrypted byte array
Throws:
OwInvalidOperationException

decryptToString

public static String decryptToString(byte[] encrypted_p,
                                     String format_p)
                              throws OwInvalidOperationException,
                                     UnsupportedEncodingException
decryt the given byte array

Parameters:
encrypted_p -
format_p -
Returns:
a String
Throws:
UnsupportedEncodingException
OwInvalidOperationException

decryptToString

public static String decryptToString(byte[] encrypted_p)
                              throws OwInvalidOperationException
decryt the given byte array to string using "ISO-8859-1" format

Parameters:
encrypted_p -
Returns:
a String
Throws:
OwInvalidOperationException

decrypt

public static byte[] decrypt(byte[] encrypted_p)
                      throws OwInvalidOperationException
decrypt the given byte array

Parameters:
encrypted_p -
Returns:
the decrypted byte array
Throws:
OwInvalidOperationException


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.