public class ServerSecurityManager extends Object implements ISensitiveParameterHandler
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SERVER_KEYS_FILENAME
The default server keys file name: "iiziServer.keys".
|
Modifier and Type | Method and Description |
---|---|
String |
decodeParameter(String data)
Decodes a sensitive information device parameter using the previously exchanged keys.
|
static byte[] |
digest(byte[] data)
Digests the bytes using preferably SHA-512, SHA-384, SHA-256,
then SHA-1 and worst case MD5.
|
void |
dispose()
Disposes of the instance.
|
String |
encodeParameter(String data)
Encodes a sensitive information device parameter using the previously exchanged keys.
|
static ServerSecurityManager |
getInstance()
Gets the instance of the security manager.
|
ServerKey |
getServerKey()
Gets the key to use for encryption.
|
void |
loadKeys(File file)
Loads the server keys from the specified file.
|
void |
setKeyTimeout(long timeout)
Assigns the timeout in milliseconds a key is valid.
|
public static final String DEFAULT_SERVER_KEYS_FILENAME
public static ServerSecurityManager getInstance()
public static byte[] digest(byte[] data)
data
- The data to digest.public void setKeyTimeout(long timeout)
timeout
- The timeout for a key in milliseconds, default is 90 days.IllegalArgumentException
- If the timeout is less than 1 hour (3_600_000 ms).public void loadKeys(File file) throws IOException, PropException
file
- The file.IOException
- For I/O errors.PropException
- For property exceptions.public ServerKey getServerKey()
public void dispose()
public String decodeParameter(String data) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, DigestException
decodeParameter
in interface ISensitiveParameterHandler
data
- The base64 encoded data.IllegalArgumentException
- If the data encoding is invalid (not base64).NoSuchPaddingException
NoSuchAlgorithmException
InvalidAlgorithmParameterException
InvalidKeyException
BadPaddingException
IllegalBlockSizeException
DigestException
public String encodeParameter(String data) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, UnsupportedEncodingException
encodeParameter
in interface ISensitiveParameterHandler
data
- The parameter to encode.IllegalArgumentException
- If the data encoding is invalid (not base64).NoSuchPaddingException
NoSuchAlgorithmException
InvalidAlgorithmParameterException
InvalidKeyException
BadPaddingException
IllegalBlockSizeException
UnsupportedEncodingException
iizi® is a registered trademark of Mindus SARL. © Copyright 2019 Mindus SARL. All rights reserved.