def decrypt(str)
      decoded = decode(str)
      return unless decoded

      return decoded if decoded.empty?

      decrypted = binary_decrypt(decoded)

      # Try to force result to UTF-8 encoding, but if it is not valid, force it back to Binary
      decrypted.force_encoding(SymmetricEncryption::BINARY_ENCODING) unless decrypted.force_encoding(SymmetricEncryption::UTF8_ENCODING).valid_encoding?

      decrypted
    end
def decrypt(str)
      decoded = decode(str)
      return unless decoded

      return decoded if decoded.empty?

      decrypted = binary_decrypt(decoded)

      # Try to force result to UTF-8 encoding, but if it is not valid, force it back to Binary
      decrypted.force_encoding(SymmetricEncryption::BINARY_ENCODING) unless decrypted.force_encoding(SymmetricEncryption::UTF8_ENCODING).valid_encoding?

      decrypted
    end
Decode and Decrypt string
   Returns a decrypted string after decoding it first according to the
           encoding setting of this cipher
   Returns nil if encrypted_string is nil
   Returns '' if encrypted_string == ''

 Parameters
   encrypted_string [String]
     Binary encrypted string to decrypt

 Reads the header if present for key, iv, cipher_name and compression

 encrypted_string must be in raw binary form when calling this method

 Creates a new OpenSSL::Cipher with every call so that this call
 is thread-safe and can be called concurrently by multiple threads with
 the same instance of Cipher