com.clickntap.utils
Class SecurityUtils

java.lang.Object
  extended by com.clickntap.utils.SecurityUtils

public class SecurityUtils
extends Object


Constructor Summary
SecurityUtils()
           
 
Method Summary
static String base64dec(String s)
           
static String base64enc(String s)
           
static byte[] decrypt(byte[] input, byte[] key)
           
static byte[] decrypt(byte[] input, byte[] key, String algorithm, String cipherAlgorithm, AlgorithmParameterSpec paramSpec)
           
static byte[] encrypt(byte[] input, byte[] key)
           
static byte[] encrypt(byte[] input, byte[] key, String algorithm, String cipherAlgorithm, AlgorithmParameterSpec paramSpec)
           
static SecretKey generateKey(int size)
           
static SecretKey generateKey(int size, String algorithm)
           
static void main(String[] args)
           
static String md5(String s)
           
static String sha1(String s)
           
static String sha256(String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityUtils

public SecurityUtils()
Method Detail

decrypt

public static byte[] decrypt(byte[] input,
                             byte[] key,
                             String algorithm,
                             String cipherAlgorithm,
                             AlgorithmParameterSpec paramSpec)
                      throws Exception
Throws:
Exception

decrypt

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

encrypt

public static byte[] encrypt(byte[] input,
                             byte[] key,
                             String algorithm,
                             String cipherAlgorithm,
                             AlgorithmParameterSpec paramSpec)
                      throws Exception
Throws:
Exception

encrypt

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

generateKey

public static SecretKey generateKey(int size)
                             throws Exception
Throws:
Exception

generateKey

public static SecretKey generateKey(int size,
                                    String algorithm)
                             throws Exception
Throws:
Exception

md5

public static String md5(String s)
                  throws Exception
Throws:
Exception

sha1

public static String sha1(String s)
                   throws Exception
Throws:
Exception

sha256

public static String sha256(String s)
                     throws Exception
Throws:
Exception

base64enc

public static String base64enc(String s)
                        throws Exception
Throws:
Exception

base64dec

public static String base64dec(String s)
                        throws Exception
Throws:
Exception

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 2014. All rights reserved.