1 <?php
if (!defined('PmWiki')) exit();
6 Copyright 2011 Anomen (ludek_h@seznam.cz)
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published
9 by the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
13 $RecipeInfo['AesCrypt']['Version'] = '2012-04-23';
15 SDV($AesCryptKDF, 'sha256_dup');
16 SDV($AesCryptCipherToken, '(:aes ');
17 SDV($AesCryptEndToken, ':)');
18 SDV($AesCryptPadding, 6);
20 SDV($HTMLStylesFmt['aescrypt'], "
29 filter: alpha(opacity=40);
30 /* this hack is so it works in IE
31 * I find setting the color in the css gives me more flexibility
32 * than the PNG solution.
34 background-color:transparent !important;
35 background-color: #333333;
36 /* this hack is for opera support
37 * you can uncomment the background-image if you don't care about opera.
38 * this gives you the flexibility to use any bg color that you want, instead of the png
40 background-image/**/: url('$PubDirUrl/aescrypt/maskbg.png') !important; // For browsers Moz, Opera, etc.
41 background-image:none;
42 background-color:#cccccc;
43 background-repeat: repeat;
59 .aescrypt_overlay div {
62 background-color: #ffffff;
63 border:1px solid #000000;
75 $HTMLHeaderFmt['aescrypt_common'] = "
76 <script type=\"text/javascript\" src=\"\$PubDirUrl/aescrypt/aescrypt.js\"></script>
77 <script type=\"text/javascript\" src=\"\$PubDirUrl/aescrypt/main.js\"></script>
78 <script type=\"text/javascript\">
82 * Key derivation function selected by AesCryptKDF variable.
84 AesCtr.kdf = function(password, nBits, nonce) {
85 return AesCtr.kdf_$AesCryptKDF (password, nBits, nonce);
88 AesCrypt.AesCryptCipherToken = '$AesCryptCipherToken';
89 AesCrypt.AesCryptEndToken = '$AesCryptEndToken';
90 AesCrypt.AesCryptPadding = $AesCryptPadding;
91 AesCrypt.PubDirUrl = '$PubDirUrl/aescrypt';
97 /* generate decryption code */
98 function aescryptMarkup($ciphertext)
103 $res .= "<div id=\"aescrypt_c_$id\" style=\"white-space:pre;display:none;\">$ciphertext</div>";
104 $res .= "<div id=\"aescrypt_d_$id\">";
105 $res .= "<a id=\"aescrypt_a_$id\" href=\"javascript:void (0);\" onClick=\"AesCrypt.decPopup($id);\">";
114 "/\\Q$AesCryptCipherToken\\E\\s*(.*?)\\s*\\Q$AesCryptEndToken\\E/se",
115 "aescryptMarkup('$1')");
117 if ($action == 'edit') {
119 if (IsEnabled($EnableGUIButtons)) {
120 $GUIButtons['aescrypt'] = array(750, '', '', '',
121 "<a href='#' onclick='AesCrypt.encPopup();'><img src='\$GUIButtonDirUrlFmt/aescrypt.png' title='Encrypt' /></a>");
123 $MessagesFmt[] = "<input type='button' name='aesButton' value='Encrypt' onClick='AesCrypt.encPopup();'/>";