Extension:Crypto

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
Crypto

Release status: stable

Implementation Parser functions
Description Displays encrypted data based upon group membership
Author(s) Ryan O. Stouffer (GoodyMasTalk)
Last version 1.0 (0)
MediaWiki 1.11.2
License GPL
Download Extension:Crypto/Version_1.0#Code
Parameters

$cryptoGroupMap

Hooks used
EditFilter

ArticleSave
LanguageGetMagic

Check usage (experimental)

Contents

[edit] What can this extension do?

Encrypts portions of text inside a wiki page. For use when you want to add things like passwords and only have them viewable by people of a certain group.

[edit] Usage

After configuring a group with an encryption key you can add the following Parser Function to any wiki page as long as you are a member of the group. The function works by supplying 3 parameters. The first is the group name the person viewing the page has to have to decrypt the text. The second is either the text to be encrypted or the already encrypted text. The third is the optional text to display when the viewer is not a member of a proper group. Default is blank. To encrypt text during the edit place it inside <encrypt></encrypt> tags. During the save process the text will be encrypted with the proper key.

For example:

{{#crypto: user | <encrypt>This is xor encrypted</encrypt> | You do not have permission to view this }}

After saving subsequent edits or view sources will only display:

{{#crypto: user | NgkKHE5JH08OCgBCBA0MHFkcGxMB | You do not have permission to view this }}

The pass phrases you encrypt with are held in LocalSettings.php so make sure you have proper permissions set to restrict read access. The encryption scheme is a simple XOR encryption and you should understand the frailties of this type of encryption scheme before using this extension. Also understand that this is experimental and I take no responsibility for this code not working as designed. In other words, use at your own risk.

[edit] Download instructions

Please cut and paste the code found Version_1.0 and place it in $IP/extensions/Crypto/Crypto.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

[edit] Installation

To install this extension, add the following to LocalSettings.php:

# add encryption key for group user
$cryptoGroupMap['user'] = 'REPLACE WITH RANDOM TEXT';
 
require_once("$IP/extensions/Crypto/Crypto.php");

[edit] Configuration parameters

The crypto map is defined with a key which represents the group name and the value which represents the phrase to encrypt with. The value you supply should be kept secret and the LocalSettings.php should have the proper permissions set to keep out prying eyes.

[edit] User rights

Dependant upon configuration user rights are varied.

Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox