Data encryption

Encrypts (web::encrypt) and decrypts (web::decrypt) data. By default, the built-in, weak encryption is used. Encryption is extensible by plug-ins. The encryption module tries all plug-ins from a list until the first plug-in was able to en-/decrypt the input. See web::config for the configuration of the plug-ins to be used.

web::encrypt

web::encrypt data

Returns encrypted data.

web::decrypt

web::decrypt data

Returns decrypted data.

Example 15. web::encrypt

% web::encrypt "Hello, world!"
XDIVAhkgkxRjcfA7UTwpD7
% web::decrypt [web::encrypt "Hello, world!"]
Hello, world!
%	  


Encryption plug-in D

web::encryptd

By default, Websh uses this plug-in for (very) weak data encryption (web::encryptd) and decryption (web::decryptd). The encryption key is managed with web::crpytdkey.

web::encryptd data

Returns encrypted data.

web::decryptd

web::decryptd data

Returns decrypted data.

web::cryptdkey

web::cryptdkey ?key?

Sets a new key for encryption. If no argument is given, resets to the default key. This command does not return the currently active key, in difference to other configuration commands of Websh.

Encryption plug-in interface

For plug-in developers only

The encryption plug-in is required to implement the interface described below (note that to activate your plug-in, use web::config encryptchain and web::config decryptchain respectively):

  • web::yourencrypt accepts one argument web::yourencrypt takes a string as input and generates a string which must be URI compliant.
  • web::yourdecrypt accepts one argument web::yourdecrypt takes a string as input and returns a string.
  • Symmetry: $in == [web::yourdecrypt [web::yourencrypt $in]]
  • Error messaging: TCL_OK for success. TCL_ERROR for any error during en-/decryption. TCL_CONTINUE for unknown encryption type (pass on to next method).