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_cxx/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_cxx.h> 24<p> 25int 26Db::set_encrypt(const char *passwd, u_int32_t flags); 27<p> 28int 29Db::get_encrypt_flags(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_cxx/db_open.html">Db::open</a> method is called. 39</p> 40<p>The Db::set_encrypt method 41either returns a non-zero error value 42or throws an exception that encapsulates a non-zero error value on 43failure, and returns 0 on success. 44</p> 45<b>Parameters</b> <br> 46 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or 47the following value: 48<br> 49<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 50and Federal Information Processing Standard (FIPS) 197) algorithm for 51encryption or decryption.</ul> 52<br></ul> 53 <b>passwd</b><ul compact><li>The <b>passwd</b> parameter is the password used to perform encryption 54and decryption.</ul> 55<br> 56<br><b>Errors</b> 57<p>The Db::set_encrypt method 58may fail and throw 59<a href="/api_cxx/except_class.html">DbException</a>, 60encapsulating one of the following non-zero errors, or return one of 61the following non-zero errors:</p> 62<br> 63<b>EINVAL</b><ul compact><li>If the method was called after 64<a href="/api_cxx/db_open.html">Db::open</a> 65was called; or if an 66invalid flag value or parameter was specified.</ul> 67<br> 68<br> 69<b>EOPNOTSUPP</b><ul compact><li>Cryptography is not available in this Berkeley DB release.</ul> 70<br> 71<hr size=1 noshade> 72<b>Description: Db::get_encrypt_flags</b> 73<p>The Db::get_encrypt_flags method returns the encryption flags.</p> 74<p>The Db::get_encrypt_flags method may be called at any time during the life of the 75application.</p> 76<p>The Db::get_encrypt_flags method 77either returns a non-zero error value 78or throws an exception that encapsulates a non-zero error value on 79failure, and returns 0 on success. 80</p> 81<b>Parameters</b> <br> 82 <b>flagsp</b><ul compact><li>The Db::get_encrypt_flags method returns the 83encryption flags in <b>flagsp</b>.</ul> 84<br> 85<hr size=1 noshade> 86<br><b>Class</b> 87<a href="/api_cxx/db_class.html">Db</a> 88<br><b>See Also</b> 89<a href="/api_cxx/db_list.html">Databases and Related Methods</a> 90</tt> 91<table width="100%"><tr><td><br></td><td align=right> 92<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a> 93</td></tr></table> 94<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 95</body> 96</html> 97