Package org.compiere.util
Class SecureEngine
- java.lang.Object
-
- org.compiere.util.SecureEngine
-
public class SecureEngine extends Object
Security Engine- Version:
- $Id: SecureEngine.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $
- Author:
- Jorg Janke
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Object
decrypt(Object value, int AD_Client_ID)
Decryption.static String
decrypt(String value, int AD_Client_ID)
Decryption.static Object
encrypt(Object value, int AD_Client_ID)
Encryption.static String
encrypt(String value, int AD_Client_ID)
Encryption.static String
getClassName()
Get Class Namestatic String
getDigest(String value)
Convert String to Digest.static String
getSHA512Hash(int iterations, String value, byte[] salt)
Convert String and salt to SHA-512 hash with iterations https://www.owasp.org/index.php/Hashing_Javastatic void
init(String className)
Initialize/Test Securitystatic void
init(Properties ctx)
Initialize Securitystatic boolean
isMatchHash(String hashedText, String hexSalt, String planText)
use salt in hex form and text hashed compare with plan text when has exception in hash, log to serverstatic void
main(String[] args)
main
-
-
-
Method Detail
-
init
public static void init(Properties ctx)
Initialize Security- Parameters:
ctx
- context with ADEMPIERE_SECURE class name
-
init
public static void init(String className)
Initialize/Test Security- Parameters:
className
- class name
-
getClassName
public static String getClassName()
Get Class Name- Returns:
- class name
-
getSHA512Hash
public static String getSHA512Hash(int iterations, String value, byte[] salt) throws NoSuchAlgorithmException, UnsupportedEncodingException
Convert String and salt to SHA-512 hash with iterations https://www.owasp.org/index.php/Hashing_Java- Parameters:
value
- message- Returns:
- HexString of message (length = 128 characters)
- Throws:
UnsupportedEncodingException
NoSuchAlgorithmException
-
getDigest
public static String getDigest(String value)
Convert String to Digest. JavaScript version see - http://pajhome.org.uk/crypt/md5/index.html- Parameters:
value
- message- Returns:
- HexString of message (length = 32 characters)
-
encrypt
public static String encrypt(String value, int AD_Client_ID)
Encryption. The methods must recognize clear text values- Parameters:
value
- clear valueAD_Client_ID
-- Returns:
- encrypted String
-
decrypt
public static String decrypt(String value, int AD_Client_ID)
Decryption. The methods must recognize clear text values- Parameters:
value
- encrypted valueAD_Client_ID
-- Returns:
- decrypted String
-
encrypt
public static Object encrypt(Object value, int AD_Client_ID)
Encryption. The methods must recognize clear values- Parameters:
value
- clear valueAD_Client_ID
-- Returns:
- encrypted String
-
decrypt
public static Object decrypt(Object value, int AD_Client_ID)
Decryption. The methods must recognize clear values- Parameters:
value
- encrypted value- Returns:
- decrypted String
-
isMatchHash
public static boolean isMatchHash(String hashedText, String hexSalt, String planText)
use salt in hex form and text hashed compare with plan text when has exception in hash, log to server- Parameters:
hashedText
-hexSalt
-planText
-- Returns:
-
main
public static void main(String[] args)
main- Parameters:
args
-
-
-