Class SecurityUtil

java.lang.Object
io.getlime.security.powerauth.lib.cmd.util.SecurityUtil

public class SecurityUtil
extends java.lang.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.EciesEncryptedRequest createEncryptedRequest​(io.getlime.security.powerauth.crypto.lib.encryptor.ecies.model.EciesCryptogram eciesCryptogram, boolean useIv)
    Creates an encrypted request instance
    static io.getlime.security.powerauth.crypto.lib.encryptor.ecies.EciesEncryptor createEncryptor​(java.lang.String applicationSecretValue, ResultStatusObject resultStatusObject, io.getlime.security.powerauth.crypto.lib.encryptor.ecies.model.EciesSharedInfo1 sharedInfo)
    Creates new encryptor
    static 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 response
    static io.getlime.security.powerauth.crypto.lib.encryptor.ecies.model.EciesCryptogram encryptObject​(io.getlime.security.powerauth.crypto.lib.encryptor.ecies.EciesEncryptor encryptor, java.lang.Object value, boolean useIv)
    Encrypts an object using the provided encryptor

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SecurityUtil

      public SecurityUtil()
  • Method Details

    • createEncryptor

      public static io.getlime.security.powerauth.crypto.lib.encryptor.ecies.EciesEncryptor createEncryptor​(java.lang.String applicationSecretValue, ResultStatusObject resultStatusObject, io.getlime.security.powerauth.crypto.lib.encryptor.ecies.model.EciesSharedInfo1 sharedInfo) throws io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderException, io.getlime.security.powerauth.crypto.lib.model.exception.GenericCryptoException, java.security.spec.InvalidKeySpecException
      Creates new encryptor
      Parameters:
      applicationSecretValue - Application secret value
      resultStatusObject - Activation status object
      sharedInfo - Shared info parameter value
      Returns:
      New encryptor instance
      Throws:
      io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderException - when an error during encryptor preparation occurred
      io.getlime.security.powerauth.crypto.lib.model.exception.GenericCryptoException - when an error during encryptor preparation occurred
      java.security.spec.InvalidKeySpecException - when an error during server public key processing occurred
    • encryptObject

      public static io.getlime.security.powerauth.crypto.lib.encryptor.ecies.model.EciesCryptogram encryptObject​(io.getlime.security.powerauth.crypto.lib.encryptor.ecies.EciesEncryptor encryptor, java.lang.Object value, boolean useIv) throws io.getlime.security.powerauth.crypto.lib.encryptor.ecies.exception.EciesException, java.io.IOException
      Encrypts an object using the provided encryptor

      The object will be serialized to json and the json bytes will be then encrypted

      Parameters:
      encryptor - Encyptor instance
      value - Object value to be encrypted
      useIv - 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 occurred
      java.io.IOException - 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.EciesException
      Decrypts bytes from a response
      Parameters:
      encryptor - Encryptor
      encryptedResponse - 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 sent
      useIv - True for encryption with non-zero initialization vector
      Returns:
      Encrypted request instance