db_set_encrypt.html   [plain text]


<!--$Id: db_set_encrypt.html,v 1.2 2004/03/30 01:21:42 jtownsen Exp $-->
<!--$Id: db_set_encrypt.html,v 1.2 2004/03/30 01:21:42 jtownsen Exp $-->
<!--Copyright 1997-2003 by Sleepycat Software, Inc.-->
<!--All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DB-&gt;set_encrypt</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<a name="2"><!--meow--></a>
<table width="100%"><tr valign=top>
<td>
<h3>DB-&gt;set_encrypt</h3>
</td>
<td align=right>
<a href="../api_c/api_index.html"><img src="../images/api.gif" alt="API"></a>
<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<hr size=1 noshade>
<tt>
<h3><pre>
#include &lt;db.h&gt;
<p>
int
DB-&gt;set_encrypt(DB *db, const char *passwd, u_int32_t flags);
<p>
int
DB-&gt;get_encrypt_flags(DB *db, u_int32_t *flagsp);
</pre></h3>
<hr size=1 noshade>
<h3>Description: DB-&gt;set_encrypt</h3>
<a name="3"><!--meow--></a>
<p>Set the password used by the Berkeley DB library to perform encryption and
decryption.</p>
<p>Because databases opened within Berkeley DB environments use the password
specified to the environment, it is an error to attempt to set a
password in a database created within an environment.</p>
<p>The DB-&gt;set_encrypt method may not be called after the <a href="../api_c/db_open.html">DB-&gt;open</a> method is called.
</p>
<p>The DB-&gt;set_encrypt method
returns a non-zero error value on failure
and 0 on success.
</p>
<h3>Parameters</h3>
<p><dl compact>
<p><dt><b>flags</b><dd>
The <b>flags</b> parameter must be set to 0 or
the following value:
<p><dl compact>
<p><dt><a name="DB_ENCRYPT_AES">DB_ENCRYPT_AES</a><dd>Use the Rijndael/AES (also known as the Advanced Encryption Standard
and Federal Information Processing Standard (FIPS) 197) algorithm for
encryption or decryption.
</dl>
<p><dt><b>passwd</b><dd>
The <b>passwd</b> parameter is the password used to perform encryption
and decryption.
</dl>
<h3>Errors</h3>
<p>The DB-&gt;set_encrypt method
may fail and return one of the following non-zero errors:</p>
<p><dl compact>
<p><dt>EINVAL<dd>If the method was called after
<a href="../api_c/db_open.html">DB-&gt;open</a>
was called; or if an
invalid flag value or parameter was specified.
</dl>
<p><dl compact>
<p><dt>EOPNOTSUPP<dd>Cryptography is not available in this Berkeley DB release.
</dl>
<hr size=1 noshade>
<h3>Description: DB-&gt;get_encrypt_flags</h3>
<p>The DB-&gt;get_encrypt_flags method returns the encryption flags.</p>
<p>The DB-&gt;get_encrypt_flags method may be called at any time during the life of the
application.</p>
<p>The DB-&gt;get_encrypt_flags method
returns a non-zero error value on failure
and 0 on success.
</p>
<h3>Parameters</h3>
<p><dl compact>
<p><dt><b>flagsp</b><dd>
The DB-&gt;get_encrypt_flags method returns  the
encryption flags in <b>flagsp</b>.
</dl>
<hr size=1 noshade>
<h3>Class</h3>
<a href="../api_c/db_class.html">DB</a>
<h3>See Also</h3>
<a href="../api_c/db_list.html">Databases and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_c/api_index.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1><a href="../sleepycat/legal.html">Copyright (c) 1996-2003</a> <a href="http://www.sleepycat.com">Sleepycat Software, Inc.</a> - All rights reserved.</font>
</body>
</html>