Class PowerAuthNonPersonalizedEncryptor

java.lang.Object
io.getlime.security.powerauth.rest.api.spring.encryption.PowerAuthNonPersonalizedEncryptor

public class PowerAuthNonPersonalizedEncryptor
extends Object
Non-personalized encryptor class.
Author:
Petr Dvorak, petr@wultra.com
  • Constructor Details

    • PowerAuthNonPersonalizedEncryptor

      public PowerAuthNonPersonalizedEncryptor​(String applicationKeyBase64, String sessionKeyBytesBase64, String sessionIndexBase64, String ephemeralPublicKeyBase64)
      Constructor with all mandatory parameters.
      Parameters:
      applicationKeyBase64 - Application key.
      sessionKeyBytesBase64 - Session key.
      sessionIndexBase64 - Session index.
      ephemeralPublicKeyBase64 - Ephemeral public key.
  • Method Details

    • encrypt

      public io.getlime.core.rest.model.base.response.ObjectResponse<NonPersonalizedEncryptedPayloadModel> encrypt​(Object object) throws com.fasterxml.jackson.core.JsonProcessingException, io.getlime.security.powerauth.crypto.lib.model.exception.GenericCryptoException, io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderException, InvalidKeyException
      Encrypt object.
      Parameters:
      object - Object to be encrypted.
      Returns:
      Encrypted object.
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - In case the resulting object cannot be encoded as JSON.
      io.getlime.security.powerauth.crypto.lib.model.exception.GenericCryptoException - In case of a cryptography error.
      io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderException - In case of a cryptographic provider error.
      InvalidKeyException - In case the key provided for encryption is invalid.
    • encrypt

      public io.getlime.core.rest.model.base.response.ObjectResponse<NonPersonalizedEncryptedPayloadModel> encrypt​(byte[] originalData) throws io.getlime.security.powerauth.crypto.lib.model.exception.GenericCryptoException, io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderException, InvalidKeyException
      Encrypt data.
      Parameters:
      originalData - Bytes to be encrypted.
      Returns:
      Encrypted object.
      Throws:
      io.getlime.security.powerauth.crypto.lib.model.exception.GenericCryptoException - In case of a cryptography error.
      io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderException - In case of a cryptographic provider error.
      InvalidKeyException - In case the key provided for encryption is invalid.
    • decrypt

      public byte[] decrypt​(io.getlime.core.rest.model.base.request.ObjectRequest<NonPersonalizedEncryptedPayloadModel> request) throws io.getlime.security.powerauth.crypto.lib.model.exception.GenericCryptoException, io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderException, InvalidKeyException
      Decrypt an object.
      Parameters:
      request - Object with encrypted payload.
      Returns:
      Decrypted bytes.
      Throws:
      io.getlime.security.powerauth.crypto.lib.model.exception.GenericCryptoException - In case of a cryptography error.
      io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderException - In case of a cryptographic provider error.
      InvalidKeyException - In case the key provided for encryption is invalid.
    • decrypt

      public <T> T decrypt​(io.getlime.core.rest.model.base.request.ObjectRequest<NonPersonalizedEncryptedPayloadModel> request, Class<T> resultClass) throws IOException, io.getlime.security.powerauth.crypto.lib.model.exception.GenericCryptoException, io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderException, InvalidKeyException
      Decrypt data and serialize object.
      Type Parameters:
      T - Specific type of the result class.
      Parameters:
      request - Request with encrypted data.
      resultClass - Result deserialized class.
      Returns:
      Decrypted object of a provided type T.
      Throws:
      IOException - In case the JSON deserialization fails.
      io.getlime.security.powerauth.crypto.lib.model.exception.GenericCryptoException - In case of a cryptography error.
      io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderException - In case of a cryptographic provider error.
      InvalidKeyException - In case the key provided for encryption is invalid.