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