Class ServerEciesEncryptor

java.lang.Object
io.getlime.security.powerauth.crypto.lib.encryptor.ecies.ServerEciesEncryptor
All Implemented Interfaces:
ServerEncryptor

public class ServerEciesEncryptor extends Object implements ServerEncryptor
Class implements ECIES encryption for PowerAuth Server.

PowerAuth protocol versions:

  • 3.0
  • 3.1
  • 3.2
  • Constructor Details

    • ServerEciesEncryptor

      public ServerEciesEncryptor(EncryptorId encryptorId, EncryptorParameters parameters) throws EncryptorException
      Construct ECIES encryptor that implements encryption for PowerAuth Server.
      Parameters:
      encryptorId - Encryptor identifier.
      parameters - Encryptor parameters.
      Throws:
      EncryptorException - In case that protocol is not supported.
  • Method Details

    • getEncryptorParameters

      public EncryptorParameters getEncryptorParameters()
      Description copied from interface: ServerEncryptor
      Get this encryptor's identifier.
      Specified by:
      getEncryptorParameters in interface ServerEncryptor
      Returns:
      This encryptor's identifier.
    • getEncryptorId

      public EncryptorId getEncryptorId()
      Description copied from interface: ServerEncryptor
      Get parameters used to construct this encryptor.
      Specified by:
      getEncryptorId in interface ServerEncryptor
      Returns:
      EncryptorParameters used to construct this encryptor.
    • configureSecrets

      public void configureSecrets(EncryptorSecrets secrets) throws EncryptorException
      Description copied from interface: ServerEncryptor
      Configure secret keys before the encryptor is used for the encryption and decryption tasks.
      Specified by:
      configureSecrets in interface ServerEncryptor
      Parameters:
      secrets - Object representing a secret keys for particular protocol version.
      Throws:
      EncryptorException - In case of failure.
    • canDecryptRequest

      public boolean canDecryptRequest()
      Description copied from interface: ServerEncryptor
      Determine whether encrypted request data can be decrypted.
      Specified by:
      canDecryptRequest in interface ServerEncryptor
      Returns:
      true if response data can be decrypted.
    • calculateSecretsForExternalEncryptor

      public EncryptorSecrets calculateSecretsForExternalEncryptor(EncryptedRequest request) throws EncryptorException
      Description copied from interface: ServerEncryptor
      Build encryptor secrets that can be used in the external encryptor to decrypt the provided request. The external encryptor is typically running in a different application java environment without knowing the private keys. The best example is cooperation between the PowerAuth Server and our PowerAuth Integration libraries for RESTful API. The server is using this function to calculate the shared secret that can be used in the integration library to actually decrypt the request from the client.
      Specified by:
      calculateSecretsForExternalEncryptor in interface ServerEncryptor
      Parameters:
      request - Request to encrypt in the external server encryptor. The request object should contain all parameters except the encryptedData and mac properties.
      Returns:
      Object containing encrypted secrets for the external encryptor.
      Throws:
      EncryptorException - In case of failure.
    • decryptRequest

      public byte[] decryptRequest(EncryptedRequest request) throws EncryptorException
      Description copied from interface: ServerEncryptor
      Decrypt encrypted request data.
      Specified by:
      decryptRequest in interface ServerEncryptor
      Parameters:
      request - Object representing an encrypted request.
      Returns:
      Decrypted data.
      Throws:
      EncryptorException - In case of failure.
    • canEncryptResponse

      public boolean canEncryptResponse()
      Description copied from interface: ServerEncryptor
      Determine whether response data can be encrypted. You cannot encrypt the response if you did not decrypt the request before.
      Specified by:
      canEncryptResponse in interface ServerEncryptor
      Returns:
      true if response data can be decrypted.
    • encryptResponse

      public EncryptedResponse encryptResponse(byte[] data) throws EncryptorException
      Description copied from interface: ServerEncryptor
      Encrypt response data.
      Specified by:
      encryptResponse in interface ServerEncryptor
      Parameters:
      data - Data to encrypt as response.
      Returns:
      Object representing an encrypted response.
      Throws:
      EncryptorException - In case of failure.