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 and Description |
---|
OwSecretEncryption() |
Modifier and Type | Method and Description |
---|---|
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
|
public static String bytesToString(byte[] bytes_p)
bytes_p
- stringToBytes(String)
public static byte[] stringToBytes(String text_p) throws OwInvalidOperationException
text_p
- OwInvalidOperationException
OwInvalidOperationException
bytesToString(byte[])
public static byte[] encrypt(String text_p) throws OwInvalidOperationException
text_p
- OwInvalidOperationException
public static byte[] encrypt(byte[] bytes_p) throws OwInvalidOperationException
bytes_p
- OwInvalidOperationException
public static String decryptToString(byte[] encrypted_p, String format_p) throws OwInvalidOperationException, UnsupportedEncodingException
encrypted_p
- format_p
- String
UnsupportedEncodingException
OwInvalidOperationException
public static String decryptToString(byte[] encrypted_p) throws OwInvalidOperationException
encrypted_p
- String
OwInvalidOperationException
public static byte[] decrypt(byte[] encrypted_p) throws OwInvalidOperationException
encrypted_p
- OwInvalidOperationException
Copyright © 2014 Alfresco Business Solutions. All Rights Reserved.