Class SecurityUtil

java.lang.Object
org.cdlib.mrt.security.SecurityUtil

public class SecurityUtil extends Object
Author:
David Loy
  • Constructor Details

    • SecurityUtil

      public SecurityUtil()
  • Method Details

    • encrypt

      public static String encrypt(String password) throws TException
      Do an MD5 encryption on a string
      Note that the encryption does utf-8 conversion of password to byte array
      Parameters:
      password - string to encrypt
      Returns:
      encrypted String
      Throws:
      TException
    • encrypt

      public static String encrypt(String password, String type) throws TException
      Do an MD5 encryption on a string
      Note that the encryption does utf-8 conversion of password to byte array
      Parameters:
      password - string to encrypt
      algorithm - encryption algorithm type: MD5
      Returns:
      encrypted String
      Throws:
      TException
    • desEncrypt

      public static String desEncrypt(String text, String tkey) throws TException
      Use DES to encrypt a string
      Parameters:
      text - text to be DES encrypted
      Returns:
      encrypted String
      Throws:
      TException
    • desDecrypt

      public static String desDecrypt(String text, String tkey) throws TException
      Use DES to decrypt a string
      Parameters:
      text - encrypted string
      Returns:
      decrypted String
      Throws:
      TException
    • encodeBase64

      public static String encodeBase64(InputStream inputStream) throws TException
      Throws:
      TException
    • encodeBase64

      public static String encodeBase64(byte[] byteArray) throws TException
      Throws:
      TException
    • encodeBase64

      public static String encodeBase64(String str) throws TException
      Throws:
      TException
    • decodeBase64

      public static String decodeBase64(String str) throws TException
      Throws:
      TException