blob: 03893378f6666c310ceaebf06155cc19a1f1f68e [file] [log] [blame]
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Data encryption</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><link rel="home" href="index.html" title="Websh Reference 3.6.0b5"><link rel="up" href="index.html" title="Websh Reference 3.6.0b5"><link rel="prev" href="file_handling_and_file_IO.html" title="File handling and file I/O"><link rel="next" href="uri-html-_en-decoding.html" title="Uri-/html- en-/decoding"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Data encryption</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="file_handling_and_file_IO.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="uri-html-_en-decoding.html">Next</a></td></tr></table><hr></div><div class="section" title="Data encryption"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="data_encryption"></a>Data encryption</h2></div></div></div><p style="width:90%">
Encrypts (<span style="font-family:monospace"><span class="command"><strong>web::encrypt</strong></span></span>) and decrypts
(<span style="font-family:monospace"><span class="command"><strong>web::decrypt</strong></span></span>) 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
<span style="font-family:monospace"><span class="command"><strong>web::config</strong></span></span> for the configuration of the
plug-ins to be used.
</p><div class="section" title="web::encrypt"><div class="titlepage"><div><div><h3 class="title"><a name="web::encrypt"></a><span style="font-family:monospace"><span class="command"><strong>web::encrypt</strong></span></span></h3></div></div></div><p style="width:90%">
</p><div class="cmdsynopsis"><span style="background:#bbbbff"><span style="font-weight:bold"><code class="command">web::encrypt</code></span> <em class="replaceable"><code>data</code></em></span></div><p style="width:90%">
Returns encrypted data.
</p></div><div class="section" title="web::decrypt"><div class="titlepage"><div><div><h3 class="title"><a name="web::decrypt"></a><span style="font-family:monospace"><span class="command"><strong>web::decrypt</strong></span></span></h3></div></div></div><p style="width:90%">
</p><div class="cmdsynopsis"><span style="background:#bbbbff"><span style="font-weight:bold"><code class="command">web::decrypt</code></span> <em class="replaceable"><code>data</code></em></span></div><p style="width:90%">
Returns decrypted data.
</p><div class="example"><a name="id2741585"></a><p class="title"><b>Example 15. <span style="font-family:monospace"><span class="command">web::encrypt</span></span></b></p><div class="example-contents"><pre style="background:#bbffbb ; width:75%" class="programlisting">
% web::encrypt "Hello, world!"
XDIVAhkgkxRjcfA7UTwpD7
% web::decrypt [web::encrypt "Hello, world!"]
Hello, world!
% </pre></div></div><p style="width:90%"><br class="example-break">
</p></div><div class="section" title="Encryption plug-in D"><div class="titlepage"><div><div><h3 class="title"><a name="encryption_plug-in_D"></a>Encryption plug-in D</h3></div></div></div><p style="width:90%">
</p></div><div class="section" title="web::encryptd"><div class="titlepage"><div><div><h3 class="title"><a name="web::encryptd"></a><span style="font-family:monospace"><span class="command"><strong>web::encryptd</strong></span></span></h3></div></div></div><p style="width:90%">
By default, Websh uses this plug-in for (very) weak data
encryption (<span style="font-family:monospace"><span class="command"><strong>web::encryptd</strong></span></span>)
and decryption (<span style="font-family:monospace"><span class="command"><strong>web::decryptd</strong></span></span>). The
encryption key is managed with
<span style="font-family:monospace"><span class="command"><strong>web::crpytdkey</strong></span></span>.
</p><p style="width:90%">
</p><div class="cmdsynopsis"><span style="background:#bbbbff"><span style="font-weight:bold"><code class="command">web::encryptd</code></span> <em class="replaceable"><code>data</code></em></span></div><p style="width:90%">
Returns encrypted <tt><em class="replaceable"><code>data</code></em></tt>.
</p></div><div class="section" title="web::decryptd"><div class="titlepage"><div><div><h3 class="title"><a name="web::decryptd"></a><span style="font-family:monospace"><span class="command"><strong>web::decryptd</strong></span></span></h3></div></div></div><p style="width:90%">
</p><div class="cmdsynopsis"><span style="background:#bbbbff"><span style="font-weight:bold"><code class="command">web::decryptd</code></span> <em class="replaceable"><code>data</code></em></span></div><p style="width:90%">
Returns decrypted <tt><em class="replaceable"><code>data</code></em></tt>.
</p></div><div class="section" title="web::cryptdkey"><div class="titlepage"><div><div><h3 class="title"><a name="web::cryptdkey"></a><span style="font-family:monospace"><span class="command"><strong>web::cryptdkey</strong></span></span></h3></div></div></div><p style="width:90%">
</p><div class="cmdsynopsis"><span style="background:#bbbbff"><span style="font-weight:bold"><code class="command">web::cryptdkey</code></span> ?<em class="replaceable"><code>key</code></em>?</span></div><p style="width:90%">
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.
</p></div><div class="section" title="Encryption plug-in interface"><div class="titlepage"><div><div><h3 class="title"><a name="encryption_plug-in_interface_"></a>Encryption plug-in interface</h3></div></div></div><p style="width:90%">
<span class="emphasis"><em>For plug-in developers only</em></span>
</p><p style="width:90%">
The encryption plug-in is required to implement the interface
described below (note that to activate your plug-in, use
<span style="font-family:monospace"><span class="command"><strong>web::config encryptchain</strong></span></span> and
<span style="font-family:monospace"><span class="command"><strong>web::config decryptchain</strong></span></span> respectively):
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><div style="margin-bottom:6">
<span style="font-family:monospace"><span class="command"><strong>web::yourencrypt</strong></span></span> accepts one argument
<span style="font-family:monospace"><span class="command"><strong>web::yourencrypt</strong></span></span> takes a string as
input and generates a string which must be URI compliant.
</div></li><li class="listitem"><div style="margin-bottom:6">
<span style="font-family:monospace"><span class="command"><strong>web::yourdecrypt</strong></span></span> accepts one argument
<span style="font-family:monospace"><span class="command"><strong>web::yourdecrypt</strong></span></span> takes a string as input
and returns a string.
</div></li><li class="listitem"><div style="margin-bottom:6">Symmetry: <span class="emphasis"><em><span style="font-family:monospace"><span class="command"><strong>$in ==
[web::yourdecrypt [web::yourencrypt
$in]]</strong></span></span></em></span>
</div></li><li class="listitem"><div style="margin-bottom:6">
Error messaging: <span class="emphasis"><em>TCL_OK</em></span> for
success. <span class="emphasis"><em>TCL_ERROR</em></span> for any error
during en-/decryption. <span class="emphasis"><em>TCL_CONTINUE</em></span>
for unknown encryption type (pass on to next method).
</div></li></ul></div><p style="width:90%">
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="file_handling_and_file_IO.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="uri-html-_en-decoding.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">File handling and file I/O </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Uri-/html- en-/decoding</td></tr></table></div></body></html>