com.dyuproject.util
Class Cryptography

java.lang.Object
  extended by com.dyuproject.util.Cryptography

public class Cryptography
extends Object

Encryption and Decryption utility

Author:
David Yu

Field Summary
static String DES
           
static String DESede
           
 
Method Summary
static Cryptography create(byte[] secretKey, String algorithm)
           
static Cryptography create(String secretKey, String algorithm)
           
static Cryptography create(String secretKey, String charset, String algorithm)
           
static Cryptography createDES(String secretKey)
           
static Cryptography createDESede(String secretKey)
           
 byte[] decrypt(byte[] input)
           
 String decrypt(String input)
           
 String decrypt(String input, String charset)
           
 String decryptDecode(String input)
           
 String decryptDecode(String input, String charset)
           
 byte[] encrypt(byte[] input)
           
 String encrypt(String input)
           
 String encrypt(String input, String charset)
           
 String encryptEncode(String input)
           
 String encryptEncode(String input, String charset)
           
static Cryptography generateDESedeRandom()
           
static Cryptography generateDESRandom()
           
static Cryptography generateRandom(String algorithm)
           
 Key getKey()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DES

public static final String DES
See Also:
Constant Field Values

DESede

public static final String DESede
See Also:
Constant Field Values
Method Detail

createDES

public static Cryptography createDES(String secretKey)
                              throws Exception
Throws:
Exception

createDESede

public static Cryptography createDESede(String secretKey)
                                 throws Exception
Throws:
Exception

create

public static Cryptography create(String secretKey,
                                  String algorithm)
                           throws Exception
Throws:
Exception

create

public static Cryptography create(String secretKey,
                                  String charset,
                                  String algorithm)
                           throws Exception
Throws:
Exception

create

public static Cryptography create(byte[] secretKey,
                                  String algorithm)
                           throws Exception
Throws:
Exception

generateDESRandom

public static Cryptography generateDESRandom()
                                      throws Exception
Throws:
Exception

generateDESedeRandom

public static Cryptography generateDESedeRandom()
                                         throws Exception
Throws:
Exception

generateRandom

public static Cryptography generateRandom(String algorithm)
                                   throws Exception
Throws:
Exception

encrypt

public byte[] encrypt(byte[] input)
               throws Exception
Throws:
Exception

encrypt

public String encrypt(String input)
               throws Exception
Throws:
Exception

encrypt

public String encrypt(String input,
                      String charset)
               throws Exception
Throws:
Exception

encryptEncode

public String encryptEncode(String input)
                     throws Exception
Throws:
Exception

encryptEncode

public String encryptEncode(String input,
                            String charset)
                     throws Exception
Throws:
Exception

decrypt

public byte[] decrypt(byte[] input)
               throws Exception
Throws:
Exception

decrypt

public String decrypt(String input)
               throws Exception
Throws:
Exception

decrypt

public String decrypt(String input,
                      String charset)
               throws Exception
Throws:
Exception

decryptDecode

public String decryptDecode(String input)
                     throws Exception
Throws:
Exception

decryptDecode

public String decryptDecode(String input,
                            String charset)
                     throws Exception
Throws:
Exception

getKey

public Key getKey()


Copyright © 2013. All Rights Reserved.