Package org.compiere.util
Class SecureEngine
java.lang.Object
org.compiere.util.SecureEngine
Secure engine for encryption and decryption
- Version:
- $Id: SecureEngine.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $
- Author:
- Jorg Janke
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
Decrypt value (only implemented for String)static String
Decryption.
The methods must recognize clear text valuesstatic Object
Encrypt value (only implemented for String).static String
Encryption.
The methods must recognize clear text valuesstatic String
Get Class Namestatic String
Perform MD5 Digest of value.
JavaScript version see - http://pajhome.org.uk/crypt/md5/index.htmlstatic 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
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.
If has exception in hash, log to server.
-
Method Details
-
init
Initialize Security- Parameters:
ctx
- context with ADEMPIERE_SECURE class name
-
init
Initialize/Test Security- Parameters:
className
- class name
-
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
Perform MD5 Digest of value.
JavaScript version see - http://pajhome.org.uk/crypt/md5/index.html- Parameters:
value
- message- Returns:
- HexString of digested message (length = 32 characters)
-
encrypt
Encryption.
The methods must recognize clear text values- Parameters:
value
- clear valueAD_Client_ID
-- Returns:
- encrypted String
-
decrypt
Decryption.
The methods must recognize clear text values- Parameters:
value
- encrypted valueAD_Client_ID
-- Returns:
- decrypted String
-
encrypt
Encrypt value (only implemented for String).- Parameters:
value
- clear valueAD_Client_ID
-- Returns:
- encrypted String
-
decrypt
Decrypt value (only implemented for String)- Parameters:
value
- encrypted value- Returns:
- decrypted String
-
isMatchHash
Use salt in hex form and text hashed compare with plan text.
If has exception in hash, log to server.- Parameters:
hashedText
-hexSalt
-planText
-- Returns:
- true if valid
-