Class SecurityUtil

java.lang.Object
org.summerboot.jexpress.security.SecurityUtil

public final class SecurityUtil extends Object
Author:
Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
  • Field Details

    • DO_NOT_VERIFY_REMOTE_IP

      public static final HostnameVerifier DO_NOT_VERIFY_REMOTE_IP
    • hostnameVerifier

      public static final HostnameVerifier hostnameVerifier
    • CIPHER_SUITES

      public static final String[] CIPHER_SUITES
    • hasUppercase

      public static final Pattern hasUppercase
    • hasLowercase

      public static final Pattern hasLowercase
    • hasNumber

      public static final Pattern hasNumber
    • hasSpecialChar

      public static final Pattern hasSpecialChar
    • PATTERN_UNPRINTABLE

      public static final Pattern PATTERN_UNPRINTABLE
    • PATTERN_UNPRINTABLE_CRLFTAB

      public static final Pattern PATTERN_UNPRINTABLE_CRLFTAB
  • Constructor Details

    • SecurityUtil

      public SecurityUtil()
  • Method Details

    • encrypt

      public static String encrypt(String plainData, boolean warped) throws GeneralSecurityException
      Parameters:
      plainData -
      warped - true if the encrypted value is in a warper like password=DEC(encrypted password)
      Returns:
      Throws:
      GeneralSecurityException
    • decrypt2Char

      public static char[] decrypt2Char(String encrypted, boolean warped) throws GeneralSecurityException
      decrypt encrypted value with prefix to plain text char array
      Parameters:
      encrypted -
      warped - true if the encrypted value is in a warper like password=ENC(encrypted password)
      Returns:
      Throws:
      GeneralSecurityException
    • decrypt

      public static String decrypt(String encrypted, boolean warped) throws GeneralSecurityException
      decrypt encrypted value with prefix to plain text
      Parameters:
      encrypted -
      warped - true if the encrypted value is in a warper like password=ENC(encrypted password)
      Returns:
      Throws:
      GeneralSecurityException
    • decryptEx

      public static byte[] decryptEx(String encrypted) throws GeneralSecurityException
      Throws:
      GeneralSecurityException
    • base64Decode

      public static String base64Decode(String base64Text)
    • base64Encode

      public static String base64Encode(String plain)
    • validatePassword

      public static boolean validatePassword(String pwd, int length)
    • stripControls

      public static String stripControls(String input, String substitute)
      Removes all unprintable characters from a string and replaces with substitute (i.e. a space).
      Parameters:
      input -
      substitute -
      Returns:
      the stripped value