Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 864d1c3c3cd8df4e3a2692faf8776e05 > files > 451

db4o-doc-7.4-2.fc13.i686.rpm

<html>
  <head>
    <META http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Custom Encryption Adapters</title>
    <link rel="stylesheet" type="text/css" href="../../../style.css">
  </head>
  <body>
    <div class="CommonContent">
      <div class="CommonContentArea">
        <h1>Custom Encryption Adapters</h1>

<p>db4o still provides a solution for high-security encryption by allowing any user to choose his own encryption mechanism that he thinks he needs. The db4o file IO mechanism is pluggable and any fixed-length encryption mechanism can be added. All that needs to be done is to write an IoAdapter plugin for db4o file IO.</p>

<p>This is a lot easier than it sounds. Simply:</p>
<ul>
<li>take the sources of com.db4o.io.RandomAccessFileAdapter as an example <br></li>
<li>write your own IoAdapter implementation that delegates raw file access to another adapter using the GoF decorator pattern. <br></li>
<li>Implement the #read() and #write() methods to encrypt and decrypt when bytes are being exchanged with the file <br></li>
<li>plug your adapter into db4o with the following method:
</li>
</ul>


<span name="cs_wiki_filter" csw_filters="net">
<p><code>.NET: Db4o.Configure().Io(new MyEncryptionAdapter()); </code></p>
</span>

<p>However, you'll have to keep in mind that db4o will write partial updates. For example, it may write a full object and then only modify one field entry later on. Therefore it is not sufficient to en-/decrypt each access in isolation. You'll rather have to make up a tiling structure that defines the data chunks that have to be en-/decrypted together.</p><p>A community project containing an XTEA encryption IoAdapter implementation can be found here:</p><p><a href="http://developer.db4o.com/ProjectSpaces/view.aspx/XTEA">http://developer.db4o.com/ProjectSpaces/view.aspx/XTEA</a></p>

<p>Another method to inject encryption capabilities into db4o for instances of specific classes only is to implement and configure an en-/decrypting translator.</p></div>
    </div>
    <div id="footer">
					This revision (9) was last Modified 2007-03-19T11:16:24 by Tetyana.
				</div>
  </body>
</html>