Sat, 15 Jun 2019 11:01:37 +0200
add new api for encrypted properties
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta name="generator" content="pandoc" /> <title>Encryption</title> <style type="text/css">code{white-space: pre;}</style> <link rel="stylesheet" href="davdoc.css" type="text/css" /> </head> <body> <div class="header"> <a href="./index.html"><span>DavUtils documentation</span></a> </div> <div class="sidebar"> <div class="nav"> <h3>dav</h3> <ul> <li><a href="getting-started.html">Getting started</a></li> <li><a href="commands.html">Commands</a></li> <ul> <li><a href="list.html">list</a></li> <li><a href="get.html">get</a></li> <li><a href="put.html">put</a></li> <li><a href="mkdir.html">mkdir</a></li> <li><a href="remove.html">remove</a></li> <li><a href="copy.html">copy</a></li> <li><a href="move.html">move</a></li> <li><a href="export.html">export</a></li> <li><a href="import.html">import</a></li> <li><a href="get-property.html">get-property</a></li> <li><a href="set-property.html">set-property</a></li> <li><a href="remove-property.html">remove-property</a></li> <li><a href="lock.html">lock</a></li> <li><a href="unlock.html">unlock</a></li> <li><a href="info.html">info</a></li> <li><a href="date.html">date</a></li> <li><a href="add-repository.html">add-repository</a></li> <li><a href="remove-repository.html">remove-repository</a></li> <li><a href="list-repositories.html">list-repositories</a></li> <li><a href="check-config.html">check-config</a></li> </ul> <li><a href="configuration.html">Configuration</a></li> <li><a href="encryption.html">Encryption</a></li> </ul> </div> <div class="nav"> <h3>dav-sync</h3> <ul> <li><a href="introduction.html">Introduction</a></li> <li><a href="sync-commands.html">Commands</a></li> <ul> <li><a href="pull.html">pull</a></li> <li><a href="push.html">push</a></li> <li><a href="archive.html">archive</a></li> <li><a href="list-conflicts.html">list-conflicts</a></li> <li><a href="resolve-conflicts.html">resolve-conflicts</a></li> <li><a href="delete-conflicts.html">delete-conflicts</a></li> <li><a href="trash-info.html">trash-info</a></li> <li><a href="empty-trash.html">empty-trash</a></li> <li><a href="add-tag.html">add-tag</a></li> <li><a href="remove-tag.html">remove-tag</a></li> <li><a href="set-tags.html">set-tags</a></li> <li><a href="list-tags.html">list-tags</a></li> <li><a href="add-directory.html">add-directory</a></li> <li><a href="list-directories.html">list-directories</a></li> <li><a href="sync-check-config.html">check-config</a></li> <li><a href="check-repositories.html">check-repositories</a></li> </ul> <li><a href="sync-configuration.html">Configuration</a></li> </ul> </div> </div> <!-- begin content --> <div class="content"> <div id="header"> <h1 class="title">Encryption</h1> </div> <p>The davutils programs have an integrated client-side encryption feature, that allows you to encrypt and decrypt on the fly with AES256 or AES128. To use this feature, the server <strong>must</strong> support WebDAV dead properties.</p> <p>The tools support both, encryption of the resource content and encryption of the resource name. Each resource is encrypted separately. With activated name encryption, the actual resource name is disguised by a random name but the name used by the client is stored encrypted as a WebDAV property. This means, an attacker can see the directory structure and the file length, but can't guess the file names and in particular which files have the same name.</p> <p>To enable encryption a key must be configured in <code>$HOME/.dav/config.xml</code>. A key must have a unique name. To access encrypted resources, all clients must configure the same key with the same name. Currently a key can only be loaded from a file and not generated from a password.</p> <p>A configuration for a key looks like:</p> <pre><code><key> <name>mykey1</name> <file>keys/mykey1</file> </key> </code></pre> <p>The file path must be relative to <code>$HOME/.dav/</code>. In this example the file <code>$HOME/.dav/keys/mykey1</code> is loaded.</p> <p>To generate a key use <strong><code>dd</code></strong> on unix like systems. The following command generates a 256 bit (32 bytes) key for AES256 encryption.</p> <pre><code>dd if=/dev/random of=mykey1 bs=32 count=1</code></pre> <p>After a key is configured, you can enable encryption/decryption in two ways. You can use the dav option <strong><code>-c</code></strong> to enable encryption and specify your key with the <strong><code>-k</code></strong> option. The alternative is to enable encryption by default for a repository in the config.xml file. You may also choose to specify the default key only and use <strong><code>-c</code></strong> where you like to use encryption.</p> <pre><code><repository> <name>myrepo</name> <url>http://example.com/webdav/</url> <default-key>mykey1</default-key> <full-encryption>true</full-encryption> </repository></code></pre> <p>See <a href="./configuration.html">Configuration</a> for details.</p> <h2 id="internals">Internals</h2> <p>When a resource is encrypted, some crypto properties (namespace: http://davutils.org/) are set for the resource.</p> <ul> <li>crypto-key: Contains the name of the key used for encryption. The presence of this property indicates that the resource is encrypted</li> <li>crypto-hash: A hash of the cleartext, encrypted and base64 encoded</li> <li>crypto-name: The name of the resource, encrypted and base64 encoded. This property is not used if name encryption is disabled.</li> </ul> </div> <!-- end content --> </body> </html>