Class SecurityUtil
java.lang.Object
io.getlime.security.powerauth.lib.cmd.util.SecurityUtil
public class SecurityUtil extends Object
Helper class with security utilities.
- Author:
- Lukas Lukovsky, lukas.lukovsky@wultra.com
-
Constructor Summary
Constructors Constructor Description SecurityUtil() -
Method Summary
Modifier and Type Method Description static io.getlime.security.powerauth.rest.api.model.request.v3.EciesEncryptedRequestcreateEncryptedRequest(io.getlime.security.powerauth.crypto.lib.encryptor.ecies.model.EciesCryptogram eciesCryptogram, boolean useIv)Creates an encrypted request instancestatic io.getlime.security.powerauth.crypto.lib.encryptor.ecies.EciesEncryptorcreateEncryptor(String applicationSecretValue, ResultStatusObject resultStatusObject, io.getlime.security.powerauth.crypto.lib.encryptor.ecies.model.EciesSharedInfo1 sharedInfo)Creates new encryptorstatic byte[]decryptBytesFromResponse(io.getlime.security.powerauth.crypto.lib.encryptor.ecies.EciesEncryptor encryptor, io.getlime.security.powerauth.rest.api.model.response.v3.EciesEncryptedResponse encryptedResponse)Decrypts bytes from a responsestatic io.getlime.security.powerauth.crypto.lib.encryptor.ecies.model.EciesCryptogramencryptObject(io.getlime.security.powerauth.crypto.lib.encryptor.ecies.EciesEncryptor encryptor, Object value, boolean useIv)Encrypts an object using the provided encryptor
-
Constructor Details
-
SecurityUtil
public SecurityUtil()
-
-
Method Details
-
encryptObject
public static io.getlime.security.powerauth.crypto.lib.encryptor.ecies.model.EciesCryptogram encryptObject(io.getlime.security.powerauth.crypto.lib.encryptor.ecies.EciesEncryptor encryptor, Object value, boolean useIv) throws io.getlime.security.powerauth.crypto.lib.encryptor.ecies.exception.EciesException, IOExceptionEncrypts an object using the provided encryptorThe object will be serialized to json and the json bytes will be then encrypted
- Parameters:
encryptor- Encyptor instancevalue- Object value to be encrypteduseIv- True for encryption with non-zero initialization vector- Returns:
- Cryptogram value of the provided object.
- Throws:
io.getlime.security.powerauth.crypto.lib.encryptor.ecies.exception.EciesException- when an error during object encryption occurredIOException- when an error during object encryption occurred
-
decryptBytesFromResponse
public static byte[] decryptBytesFromResponse(io.getlime.security.powerauth.crypto.lib.encryptor.ecies.EciesEncryptor encryptor, io.getlime.security.powerauth.rest.api.model.response.v3.EciesEncryptedResponse encryptedResponse) throws io.getlime.security.powerauth.crypto.lib.encryptor.ecies.exception.EciesExceptionDecrypts bytes from a response- Parameters:
encryptor- EncryptorencryptedResponse- Encrypted response- Returns:
- decrypted bytes
- Throws:
io.getlime.security.powerauth.crypto.lib.encryptor.ecies.exception.EciesException- when an error during decryption occurred
-
createEncryptedRequest
public static io.getlime.security.powerauth.rest.api.model.request.v3.EciesEncryptedRequest createEncryptedRequest(io.getlime.security.powerauth.crypto.lib.encryptor.ecies.model.EciesCryptogram eciesCryptogram, boolean useIv)Creates an encrypted request instance- Parameters:
eciesCryptogram- Cryptogram data to be sentuseIv- True for encryption with non-zero initialization vector- Returns:
- Encrypted request instance