DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:dokucrypt

Dokucrypt Plugin

Compatible with DokuWiki

2012-10-13, 2009-02-14, 2008-05-05

plugin A plugin to support client side cryptography

Last updated on
2013-02-25
Provides
Admin
Conflicts with
aceeditor

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to crypto, dokucrypt2

Tagged with deprecated, encryption, password


:!::!: This Plugin has been replaced by: dokucrypt2 :!::!:


The below info is out of date.


Details and Original Documentation

About This Plugin - Read Before Installing

  • :!: The latest version of this plugin (main download link above) requires PATCH1, PATCH2, PATCH3 below to work properly.
  • The update supplied by Ahmet Sacan below has been installed and tested to work well under Version 2012-10-13 “Adora Belle“ when combined with PATCH1 & PATCH2 below. I have updated the plugin info and main download link to point to this new version and have contacted the original author. — Sherri 2013/02/25 19:02
    • PATCH1 below fixes issues with some editor buttons not working and some buttons missing.
    • PATCH2 below fixes issues with the editor's header buttons not working.
  • I have used this plugin for years. I did not find a similar plugin that I like as much as this one. However it does needs some maintenance. I managed to get this working with HRUN using the patches below, as well as updating lib/plugins/crypt/action.php based on the jQueryfaq

PATCH1: Resolving conflict with Linkwizard JS code (Editor Toolbar Issues)

This solution makes “almost” everything work: The linkwizard is checking the textearea's form's pageid, but fails to do so, because moving the textarea out of the form is a critical part of the crypt's functionality. You need to change 2 lines in linkwiz.js to enable its to access the form's pageid:

Here is the patch for version 2013-10-13+:

--- \lib\scripts\linkwiz-original.js	
+++ \lib\scripts\linkwiz.js
@@ -41,12 +41,13 @@
                     'left':        (pos.left+80)+'px'
                    })
                .hide()
                .appendTo('.dokuwiki:first');
 
         dw_linkwiz.textArea = $editor[0];
+         dw_linkwiz.formid = dw_linkwiz.textArea.form['id'].value; // Dokucrypt Plugin Mod
         dw_linkwiz.result = jQuery('#link__wiz_result')[0];
 
         // scrollview correction on arrow up/down gets easier
         jQuery(dw_linkwiz.result).css('position', 'relative');
 
         dw_linkwiz.$entry = jQuery('#link__wiz_entry');
@@ -224,13 +225,14 @@
 
         if(!stxt && !DOKU_UHC) {
             stxt=title;
         }
 
         // prepend colon inside namespaces for non namespace pages
-        if(dw_linkwiz.textArea.form.id.value.indexOf(':') != -1 &&
+        //if(dw_linkwiz.textArea.form.id.value.indexOf(':') != -1 &&  // Dokucrypt Plugin Mod
+        if(dw_linkwiz.formid.indexOf(':') != -1 &&   // Dokucrypt Plugin Mod
            link.indexOf(':') == -1){
            link = ':' + link;
         }
 
         var so = link.length+3;

Posted by: — Sherri 2013/02/25 22:27

Here is the patch for older versions of Dokuwiki:

--- lib/scripts/linkwiz.js (revision 158)
+++ lib/scripts/linkwiz.js (revision 167)
@@ -41,4 +41,5 @@
         textArea.form.parentNode.appendChild(linkwiz.wiz);
         linkwiz.textArea = textArea;
+		linkwiz.formid = textArea.form['id'].value;
         linkwiz.result = $('link__wiz_result');
         linkwiz.entry = $('link__wiz_entry');
@@ -205,5 +206,6 @@
 
         // prepend colon inside namespaces for non namespace pages
-        if(linkwiz.textArea.form['id'].value.indexOf(':') != -1 &&
+		// ahmet: replaced linkwiz.textArea.form['id'].value with linkwiz.formid
+        if(linkwiz.formid.indexOf(':') != -1 &&
            linkwiz.entry.value.indexOf(':') == -1){
             linkwiz.entry.value = ':'+linkwiz.entry.value;
  • Here is a fix to make this plugin work with DokuWiki after 2009-12-02. The fix involves delaying the addInitEvent after toolbar is setup by moving the init call into action.php. -Ahmet Sacan
    • Note: This URL has been set as the main download URL for this plugin. — Sherri 2013/03/08 02:28

posted by: —ahmetsacan

PATCH2: Resolving problems with empty pages and toolbar header buttons

The header buttons in the editor toolbar are not working. Reported by Termiter. This patch resolves the issue.

Here is the patch for version 2013-10-13+:

--- \lib\scripts\edit-original.js
+++ \lib\scripts\edit.js
@@ -143,16 +143,17 @@
  * @author Andreas Gohr <gohr@cosmocode.de>
  */
 function currentHeadlineLevel(textboxId){
     var field = jQuery('#' + textboxId)[0],
         s = false,
         opts = [field.value.substr(0,getSelection(field).start)];
-    if (field.form.prefix) {
-        // we need to look in prefix context
-        opts.push(field.form.prefix.value);
-    }
+        //if (field.form.prefix) {  // Dokucrypt Plugin Mod
+        if (field.form && field.form.prefix) {  // Dokucrypt Plugin Mod
+            // we need to look in prefix context
+            opts.push(field.form.prefix.value);
+        }
 
     jQuery.each(opts, function (_, opt) {
         // Check whether there is a headline in the given string
         var str = "\n" + opt,
             lasthl = str.lastIndexOf("\n==");
         if (lasthl !== -1) {

Posted by: — Sherri 2013/02/26 04:47

Here is the patch for older versions of Dokuwiki:

--- edit.js.orig	2010-06-22 09:31:07.000000000 +0200
+++ edit.js	2010-06-22 09:31:12.000000000 +0200
@@ -220,7 +220,7 @@
     var selection = getSelection(field);
     var search    = "\n"+field.value.substr(0,selection.start);
     var lasthl    = search.lastIndexOf("\n==");
-    if(lasthl == -1 && field.form.prefix){
+    if(lasthl == -1 && field.form && field.form.prefix){
         // we need to look in prefix context
         search = field.form.prefix.value;
         lasthl    = search.lastIndexOf("\n==");

PATCH3: Resolving addInitEvent is not defined JS error.

In action.php change this line:

$event->data['script'][]=array('type'=>'text/javascript','charset'=>'utf-8','_data'=>'','_data'=>"addInitEvent(function() { return(decryptEditSetup()); });");

to this:

$event->data['script'][]=array('type'=>'text/javascript','charset'=>'utf-8','_data'=>'','_data'=>"jQuery(function(){ return(decryptEditSetup()); });");

Note that I am going to fork this plugin and release a clean working one.

Sherri 2017-06-26 04:39

Comments & Discussion

IMHO it's not a really good idea to using “prompt” for insert the pass-phrase, cause anybody can see what you type. anyway if I can read the passphrase, it's not useful to type it twice, or?

winky 2010/02/26


any fix to make a password prompt?

peufel 2011/10/06


Not compatible with the version 2013/03/06

biowan 2013/04/29


I don't know if I'm alone in this case, but it's really doesn't work with the version in 2013-05-10. I patched and empty cache folder, no way.

biowan 2013/05/27


I also had problems with the latest version of Dokuwiki 2013-05-10. The <SECRET> tag does not work and there is no “DecryptSecret” button when editing pages. I think there is a typo on the version of Dokuwiki for which PATCH1 and PATCH2 should be used: instead of 2013-10-13, it should be 2012-10-13, right ?

renatocan 2013/08/09


Is there A better way to build this type of plugin so it doesn't break every time DokuWiki gets an upgrade?

Whats the best model for encrypting text client side?

J 2013/October/8th


Somewhere, I'm happy that I'm not alone. I'm really frustate that there is no solution and I don't know how this plugin works. No way for me to debug it and it's really complex to understand what the javascript does. So I must migration to another plugin and I must change them 1 by 1 manually.

biowan 2013/12/18

plugin/dokucrypt.txt · Last modified: 2021-03-03 15:24 by sherri

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki