Class CoreParser

java.lang.Object
es.kukenan.smartfi.parser.CoreParser

public class CoreParser extends Object
Bean uses to generate correct hashcodes according to rules of CORE system.
  • Field Details

    • cf

      private Cipher cf
      Bean user to Cypher into several algorithms.
    • digest

      private MessageDigest digest
      Bean use to cypher into SHA256.
    • hexArray

      private static final char[] hexArray
      Variable needed to do hexadecimal conversions.
  • Constructor Details

    • CoreParser

      public CoreParser()
      Constructor fro AuthBean.
  • Method Details

    • bytesToHex

      private String bytesToHex(byte[] bytes)
      Method to convert bytes to hexadecimal.
      Parameters:
      bytes - String of bytes to convert.
      Returns:
      Convert bytes to hexadecimal.
    • hexToByteArray

      private byte[] hexToByteArray(String s)
      Method to convert hexadecimal to array of bytes.
      Parameters:
      s - input to convert from byte to char array.
      Returns:
      Conversion of arrays of bytes.
    • generateHashAes

      private String generateHashAes(String hexkey, String hexin, int mode)
      Generate hash fo AES.
      Parameters:
      hexkey - Key for AES in hexadecimal format.
      hexin - Input fro EAS in hexadecimal format.
      mode - Cypher or Decipher mode for AES.
      Returns:
      String cipher or decipher in AES.
    • encryptAes

      private String encryptAes(String hexkey, String hexin)
      Encrypt to AES.
      Parameters:
      hexkey - Key in hexadecimal format.
      hexin - Input in hexadecimal format.
      Returns:
      String with AES encryptation.
    • decryptAes

      private String decryptAes(String hexkey, String hexin)
      Decrypt into AES codification.
      Parameters:
      hexkey - Key into hexadecimal format.
      hexin - Input into hexadecimal format.
      Returns:
      String decypher AES Algorithm.
    • coreDecrypt

      public String coreDecrypt(String in, String hexkey)
      Decipher CORE input.
      Parameters:
      in - Input for decrypt into CORE decryption.
      hexkey - Key in hexadecimal format to CORE decryption.
      Returns:
      String decrypted for CORE.
    • coreEncrypt

      public String coreEncrypt(String in, int length, String hexkey)
      Method to generate hashcodes encrypted due to CORE rules.
      Parameters:
      in - Input for CORE encryption.
      length - Max length of CORE encryption.
      hexkey - Key for encryption on hexadecimal format.
      Returns:
      String encrypted for CORE.
    • hashSha256Hex

      private String hashSha256Hex(String in, String salt)
      Generate hash in SHA256 in hexadecimal format.
      Parameters:
      in - Input in SHA256 algorithm.
      salt - param.
      Returns:
      SHA256 input into hexadecimal format.
    • hashCore

      public String hashCore(String in, String salt, int length)
      Generate hash defined for cipher in CORE. This hash is used into Kukenbank and BancoFar for hash password for login.
      Parameters:
      in - Input to generate hash for CORE.
      salt - param. This salt must to be defined into app properties for use.
      length - Length of input
      Returns:
      String with hash of CORE convert to hexadecimal.