Cryptographer Twig filters to perform cryptographic operations.

Developed by Miranj


A Craft CMS plugin that adds Twig filters to perform cryptographic operations.

Installation

  1. Download or clone the repository.
  2. Place the cryptographer folder inside your craft/plugins/ folder.
  3. Go to Settings > Plugins inside your Control Panel and install Cryptographer.
  4. [Optional] You can change the secret used in cryptographic operations from Settings > Plugins > Cryptographer.

Usage

Encryption

{{ 'This is a secret text.' | encrypt }}

This filter takes two optional arguments.

  • $method — Cipher method to be used. Possible methods can be determined using openssl_get_cipher_methods(). By default the AES-256-CBC method is used.
  • $iv — The initialisation vector. If no initialisation vector is provided, a random value is used every time.

More Examples

{{ 'This is encrypted using the AES-128-CFB method and generates a different cipher each time.' | encrypt('AES-128-CFB') }}

{{ 'This is encrypted using the AES-256-CBC method and generates the same cipher each time.' | encrypt('AES-256-CBC', 'hello') }}

Decryption

{{ '66e46cfa6029c1484jTssikEhQXOk4BvYXWfu1M82R3Ifh1kVxQYmxoGwKc=' | decrypt }}

This filter takes one optional argument.

  • $method — Cipher method to be used. Possible methods can be determined using openssl_get_cipher_methods(). By default the AES-256-CBC method is used.
More Examples

{{ '9b3c72940c8318b7dGbekO6uMVIAxk7UFA1f0A5tTuoqBo1Vn0jRb3ZjN54=' | decrypt('AES-128-CBC') }}

Commercial plugins

  • Sprout SEO

    Content-focused SEO. Search, Structured Data, Social Media Sharing, Redirects, and Sitemap.
    Barrel Strength Design, March 04, 2014

  • Printmaker

    Generate a PDF from any template, URL, or HTML code — in just one easy line of code!
    Top Shelf Craft (Michael Rog), November 14, 2014

  • Scraper

    Fetch HTML content from any URL, select DOM elements using CSS selectors, and manipulate/output content via Twig.
    Top Shelf Craft (Michael Rog), November 20, 2014


Plugin Development 101

Don't miss any Craft tips, tricks, and community updates