docs: def encrypt(self, key, data, mode, padding):
          # pylint: disable=unused-argument,no-self-use
          """Encrypt data using the supplied values.
  
          :param bytes key: Loaded encryption key
          :param bytes data: Data to encrypt
          :param JavaMode mode: Encryption mode to use (not used by :class:`JavaAsymmetricEncryptionAlgorithm`)
          :param JavaPadding padding: Padding mode to use
          :returns: Encrypted data
          :rtype: bytes
          """
          if hasattr(key, "private_bytes"):
              _key = key.public_key()
          else:
              _key = key
          try:
              return _key.encrypt(data, padding.build())
          except Exception:
              error_message = "Encryption failed"
              _LOGGER.exception(error_message)
              raise EncryptionError(error_message)