Skip to documentation content

Security Filters

Security Filters

Liquid filters for encryption, decryption, and security.

decrypt_aes filter

Returns the unencrypted value of the input string using a shared secret and optional salt. If no salt is provided, a default salt value is used.

decrypt_aes: string secret, string salt
Example Encrypt and decrypt strings with aesUse the encrypt_aes and decrypt_aes filters to encrypt and decrypt strings using the aes alrorithm.
Liquid
{%- var secret = "my secret string" -%}
{%- var salt = "my salt" -%}

encrypt_aes

Liquid
{%- var securetext = "I want this to be reasonably secure" | encrypt_aes: secret, salt -%}
{{-securetext}}
Output
EAAAAIhwZI7hYpsYH7BdFMcQB+H31bacn2V1LECVVhc7OLWWgQdK6S641eAt2Rp2JixOvCTO0ArVkXzhIL988jVDL+w=

decrypt_aes

Liquid
{{securetext | decrypt_aes: secret, salt }}
Output
I want this to be reasonably secure

encrypt_aes filter

Returns the encrypted value of the input string using a shared secret and optional salt. If no salt is provided, a default salt value is used.

encrypt_aes: string secret, string salt
Example Encrypt and decrypt strings with aesUse the encrypt_aes and decrypt_aes filters to encrypt and decrypt strings using the aes alrorithm.
Liquid
{%- var secret = "my secret string" -%}
{%- var salt = "my salt" -%}

encrypt_aes

Liquid
{%- var securetext = "I want this to be reasonably secure" | encrypt_aes: secret, salt -%}
{{-securetext}}
Output
EAAAAIhwZI7hYpsYH7BdFMcQB+H31bacn2V1LECVVhc7OLWWgQdK6S641eAt2Rp2JixOvCTO0ArVkXzhIL988jVDL+w=

decrypt_aes

Liquid
{{securetext | decrypt_aes: secret, salt }}
Output
I want this to be reasonably secure

base64_url_safe_encode filter

Encodes a string to a URL-safe base64 format. The difference between the base64 and URL-safe base64 formats is that the URL-safe format uses - and _ in place of + and /, which can cause problems when used in a URL.

base64_url_safe_encode
Example Encoding and decoding from base64Use the base64_encode, base64_decode, base64_url_safe_encode, and base64_url_safe_decode filters to encode and decode strings to and from a base64 format.

base64_encode

Liquid
{{ '>>> do you want to stop?' | base64_encode }}
Output
Pj4+IGRvIHlvdSB3YW50IHRvIHN0b3A/

base64_decode

Liquid
{{ 'Pj4+IGRvIHlvdSB3YW50IHRvIHN0b3A/' | base64_decode }}
Output
>>> do you want to stop?

base64_url_safe_encode

Liquid
{{ '>>> do you want to stop?' | base64_url_safe_encode }}
Output
Pj4-IGRvIHlvdSB3YW50IHRvIHN0b3A_

base64_url_safe_decode

Liquid
{{ 'Pj4-IGRvIHlvdSB3YW50IHRvIHN0b3A_' | base64_url_safe_decode }}
Output
>>> do you want to stop?

base64_url_safe_decode filter

Decodes a string from a URL-safe base64 format. The difference between the base64 and URL-safe base64 formats is that the URL-safe format uses - and _ in place of + and /, which can cause problems when used in a URL.

base64_url_safe_decode
Example Encoding and decoding from base64Use the base64_encode, base64_decode, base64_url_safe_encode, and base64_url_safe_decode filters to encode and decode strings to and from a base64 format.

base64_encode

Liquid
{{ '>>> do you want to stop?' | base64_encode }}
Output
Pj4+IGRvIHlvdSB3YW50IHRvIHN0b3A/

base64_decode

Liquid
{{ 'Pj4+IGRvIHlvdSB3YW50IHRvIHN0b3A/' | base64_decode }}
Output
>>> do you want to stop?

base64_url_safe_encode

Liquid
{{ '>>> do you want to stop?' | base64_url_safe_encode }}
Output
Pj4-IGRvIHlvdSB3YW50IHRvIHN0b3A_

base64_url_safe_decode

Liquid
{{ 'Pj4-IGRvIHlvdSB3YW50IHRvIHN0b3A_' | base64_url_safe_decode }}
Output
>>> do you want to stop?

base64_encode filter

Encodes a string to Base64 format

base64_encode
Example Encoding and decoding from base64Use the base64_encode, base64_decode, base64_url_safe_encode, and base64_url_safe_decode filters to encode and decode strings to and from a base64 format.

base64_encode

Liquid
{{ '>>> do you want to stop?' | base64_encode }}
Output
Pj4+IGRvIHlvdSB3YW50IHRvIHN0b3A/

base64_decode

Liquid
{{ 'Pj4+IGRvIHlvdSB3YW50IHRvIHN0b3A/' | base64_decode }}
Output
>>> do you want to stop?

base64_url_safe_encode

Liquid
{{ '>>> do you want to stop?' | base64_url_safe_encode }}
Output
Pj4-IGRvIHlvdSB3YW50IHRvIHN0b3A_

base64_url_safe_decode

Liquid
{{ 'Pj4-IGRvIHlvdSB3YW50IHRvIHN0b3A_' | base64_url_safe_decode }}
Output
>>> do you want to stop?

base64_decode filter

Decodes a string from Base64 format

base64_decode
Example Encoding and decoding from base64Use the base64_encode, base64_decode, base64_url_safe_encode, and base64_url_safe_decode filters to encode and decode strings to and from a base64 format.

base64_encode

Liquid
{{ '>>> do you want to stop?' | base64_encode }}
Output
Pj4+IGRvIHlvdSB3YW50IHRvIHN0b3A/

base64_decode

Liquid
{{ 'Pj4+IGRvIHlvdSB3YW50IHRvIHN0b3A/' | base64_decode }}
Output
>>> do you want to stop?

base64_url_safe_encode

Liquid
{{ '>>> do you want to stop?' | base64_url_safe_encode }}
Output
Pj4-IGRvIHlvdSB3YW50IHRvIHN0b3A_

base64_url_safe_decode

Liquid
{{ 'Pj4-IGRvIHlvdSB3YW50IHRvIHN0b3A_' | base64_url_safe_decode }}
Output
>>> do you want to stop?