Package org.compiere.util
Class Secure
- java.lang.Object
-
- org.compiere.util.Secure
-
- All Implemented Interfaces:
SecureInterface
public class Secure extends Object implements SecureInterface
Security Services.Change log:
- 2007-01-27 - teo_sarca - [ 1598095 ] class Secure is not working with UTF8
- Version:
- $Id: Secure.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $
- Author:
- Jorg Janke
-
-
Field Summary
-
Fields inherited from interface org.compiere.util.SecureInterface
ADEMPIERE_SECURE, ADEMPIERE_SECURE_DEFAULT, CLEARVALUE_END, CLEARVALUE_START, ENCRYPTEDVALUE_END, ENCRYPTEDVALUE_START
-
-
Constructor Summary
Constructors Constructor Description Secure()Adempiere Security
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static byte[]convertHexString(String hexString)Convert Hex String to Byte Arraystatic StringconvertToHexString(byte[] bytes)Convert Byte Array to Hex StringIntegerdecrypt(Integer value, int ad_client_id)Decryption.Stringdecrypt(String value, int AD_Client_ID)Decryption.BigDecimaldecrypt(BigDecimal value, int ad_client_id)Decryption.Timestampdecrypt(Timestamp value, int ad_client_id)Decryption.Integerencrypt(Integer value, int ad_client_id)Encryption.Stringencrypt(String value, int AD_Client_ID)Encryption.BigDecimalencrypt(BigDecimal value, int ad_client_id)Encryption.Timestampencrypt(Timestamp value, int ad_client_id)Encryption.StringgetDigest(String value)Convert String to Digest.IKeyStoregetKeyStore()StringgetSHA512Hash(int iterations, String value, byte[] salt)Convert String and salt to SHA-512 hash with iterations https://www.owasp.org/index.php/Hashing_Javastatic inthash(String key)Hash checksum numberbooleanisDigest(String value)Checks, if value is a valid digestStringtoString()String Representation
-
-
-
Method Detail
-
hash
public static int hash(String key)
Hash checksum number- Parameters:
key- key- Returns:
- checksum number
-
convertToHexString
public static String convertToHexString(byte[] bytes)
Convert Byte Array to Hex String- Parameters:
bytes- bytes- Returns:
- HexString
-
convertHexString
public static byte[] convertHexString(String hexString)
Convert Hex String to Byte Array- Parameters:
hexString- hex string- Returns:
- byte array
-
encrypt
public String encrypt(String value, int AD_Client_ID)
Encryption.- Specified by:
encryptin interfaceSecureInterface- Parameters:
value- clear valueAD_Client_ID-- Returns:
- encrypted String
-
decrypt
public String decrypt(String value, int AD_Client_ID)
Decryption. The methods must recognize clear text values- Specified by:
decryptin interfaceSecureInterface- Parameters:
value- encrypted valueAD_Client_ID-- Returns:
- decrypted String
-
encrypt
public Integer encrypt(Integer value, int ad_client_id)
Encryption. The methods must recognize clear text values- Specified by:
encryptin interfaceSecureInterface- Parameters:
value- clear valuead_client_id-- Returns:
- encrypted String
-
decrypt
public Integer decrypt(Integer value, int ad_client_id)
Decryption. The methods must recognize clear text values- Specified by:
decryptin interfaceSecureInterface- Parameters:
value- encrypted value- Returns:
- decrypted String
-
encrypt
public BigDecimal encrypt(BigDecimal value, int ad_client_id)
Encryption. The methods must recognize clear text values- Specified by:
encryptin interfaceSecureInterface- Parameters:
value- clear valuead_client_id-- Returns:
- encrypted String
-
decrypt
public BigDecimal decrypt(BigDecimal value, int ad_client_id)
Decryption. The methods must recognize clear text values- Specified by:
decryptin interfaceSecureInterface- Parameters:
value- encrypted value- Returns:
- decrypted String
-
encrypt
public Timestamp encrypt(Timestamp value, int ad_client_id)
Encryption. The methods must recognize clear text values- Specified by:
encryptin interfaceSecureInterface- Parameters:
value- clear valuead_client_id-- Returns:
- encrypted String
-
decrypt
public Timestamp decrypt(Timestamp value, int ad_client_id)
Decryption. The methods must recognize clear text values- Specified by:
decryptin interfaceSecureInterface- Parameters:
value- encrypted value- Returns:
- decrypted String
-
getDigest
public String getDigest(String value)
Convert String to Digest. JavaScript version see - http://pajhome.org.uk/crypt/md5/index.html- Specified by:
getDigestin interfaceSecureInterface- Parameters:
value- message- Returns:
- HexString of message (length = 32 characters)
-
isDigest
public boolean isDigest(String value)
Checks, if value is a valid digest- Specified by:
isDigestin interfaceSecureInterface- Parameters:
value- digest string- Returns:
- true if valid digest
-
getSHA512Hash
public 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- Specified by:
getSHA512Hashin interfaceSecureInterface- Parameters:
value- message- Returns:
- HexString of message (length = 128 characters)
- Throws:
NoSuchAlgorithmExceptionUnsupportedEncodingException
-
toString
public String toString()
String Representation
-
getKeyStore
public IKeyStore getKeyStore()
- Returns:
- keystore
-
-