1<!--$Id: db_set_encrypt.so,v 10.3 2002/08/18 21:15:54 bostic Exp $--> 2<!--$Id: env_set_encrypt.so,v 10.23 2004/09/28 15:04:20 bostic Exp $--> 3<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 4<!--See the file LICENSE for redistribution information.--> 5<html> 6<head> 7<title>Berkeley DB: DB->set_encrypt</title> 8<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 9<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 10</head> 11<body bgcolor=white> 12<table width="100%"><tr valign=top> 13<td> 14<b>DB->set_encrypt</b> 15</td> 16<td align=right> 17<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a> 18<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td> 19</tr></table> 20<hr size=1 noshade> 21<tt> 22<b><pre> 23#include <db.h> 24<p> 25int 26DB->set_encrypt(DB *db, const char *passwd, u_int32_t flags); 27<p> 28int 29DB->get_encrypt_flags(DB *db, u_int32_t *flagsp); 30</pre></b> 31<hr size=1 noshade> 32<b>Description: DB->set_encrypt</b> 33<p>Set the password used by the Berkeley DB library to perform encryption and 34decryption.</p> 35<p>Because databases opened within Berkeley DB environments use the password 36specified to the environment, it is an error to attempt to set a 37password in a database created within an environment.</p> 38<p>The DB->set_encrypt method may not be called after the <a href="../api_c/db_open.html">DB->open</a> method is called. 39</p> 40<p>The DB->set_encrypt method 41returns a non-zero error value on failure 42and 0 on success. 43</p> 44<b>Parameters</b> <br> 45 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or 46the following value: 47<br> 48<b><a name="DB_ENCRYPT_AES">DB_ENCRYPT_AES</a></b><ul compact><li>Use the Rijndael/AES (also known as the Advanced Encryption Standard 49and Federal Information Processing Standard (FIPS) 197) algorithm for 50encryption or decryption.</ul> 51<br></ul> 52 <b>passwd</b><ul compact><li>The <b>passwd</b> parameter is the password used to perform encryption 53and decryption.</ul> 54<br> 55<br><b>Errors</b> 56<p>The DB->set_encrypt method 57may fail and return one of the following non-zero errors:</p> 58<br> 59<b>EINVAL</b><ul compact><li>If the method was called after 60<a href="../api_c/db_open.html">DB->open</a> 61was called; or if an 62invalid flag value or parameter was specified.</ul> 63<br> 64<br> 65<b>EOPNOTSUPP</b><ul compact><li>Cryptography is not available in this Berkeley DB release.</ul> 66<br> 67<hr size=1 noshade> 68<b>Description: DB->get_encrypt_flags</b> 69<p>The DB->get_encrypt_flags method returns the encryption flags.</p> 70<p>The DB->get_encrypt_flags method may be called at any time during the life of the 71application.</p> 72<p>The DB->get_encrypt_flags method 73returns a non-zero error value on failure 74and 0 on success. 75</p> 76<b>Parameters</b> <br> 77 <b>flagsp</b><ul compact><li>The DB->get_encrypt_flags method returns the 78encryption flags in <b>flagsp</b>.</ul> 79<br> 80<hr size=1 noshade> 81<br><b>Class</b> 82<a href="../api_c/db_class.html">DB</a> 83<br><b>See Also</b> 84<a href="../api_c/db_list.html">Databases and Related Methods</a> 85</tt> 86<table width="100%"><tr><td><br></td><td align=right> 87<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 88</td></tr></table> 89<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 90</body> 91</html> 92