Panda3D
 All Classes Functions Variables Enumerations
encryptStreamBuf.I
00001 // Filename: encryptStreamBuf.I
00002 // Created by:  drose (09Dec04)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: EncryptStreamBuf::set_algorithm
00018 //       Access: Public
00019 //  Description: Specifies the encryption algorithm that should be
00020 //               used for future calls to open_write().  The default
00021 //               is whatever is specified by the encryption-algorithm
00022 //               config variable.  The complete set of available
00023 //               algorithms is defined by the current version of
00024 //               OpenSSL.
00025 //
00026 //               If an invalid algorithm is specified, there is no
00027 //               immediate error return code, but open_write() will
00028 //               fail.
00029 ////////////////////////////////////////////////////////////////////
00030 INLINE void EncryptStreamBuf::
00031 set_algorithm(const string &algorithm) {
00032   _algorithm = algorithm;
00033 }
00034 
00035 ////////////////////////////////////////////////////////////////////
00036 //     Function: EncryptStreamBuf::get_algorithm
00037 //       Access: Public
00038 //  Description: Returns the encryption algorithm that was specified
00039 //               by set_algorithm(), or was read from the stream by
00040 //               the last successful open_read().
00041 ////////////////////////////////////////////////////////////////////
00042 INLINE const string &EncryptStreamBuf::
00043 get_algorithm() const {
00044   return _algorithm;
00045 }
00046 
00047 ////////////////////////////////////////////////////////////////////
00048 //     Function: EncryptStreamBuf::set_key_length
00049 //       Access: Public
00050 //  Description: Specifies the length of the key, in bits, that should
00051 //               be used to encrypt the stream in future calls to
00052 //               open_write().  The default is whatever is specified
00053 //               by the encryption-key-length config variable.  
00054 //
00055 //               If an invalid key_length for the chosen algorithm is
00056 //               specified, there is no immediate error return code,
00057 //               but open_write() will fail.
00058 ////////////////////////////////////////////////////////////////////
00059 INLINE void EncryptStreamBuf::
00060 set_key_length(int key_length) {
00061   _key_length = key_length;
00062 }
00063 
00064 ////////////////////////////////////////////////////////////////////
00065 //     Function: EncryptStreamBuf::get_key_length
00066 //       Access: Public
00067 //  Description: Returns the encryption key length, in bits, that was
00068 //               specified by set_key_length(), or was read from the
00069 //               stream by the last successful open_read().
00070 ////////////////////////////////////////////////////////////////////
00071 INLINE int EncryptStreamBuf::
00072 get_key_length() const {
00073   return _key_length;
00074 }
00075 
00076 ////////////////////////////////////////////////////////////////////
00077 //     Function: EncryptStreamBuf::set_iteration_count
00078 //       Access: Public
00079 //  Description: Specifies the number of times to repeatedly hash the
00080 //               key before writing it to the stream in future calls
00081 //               to open_write().  Its purpose is to make it
00082 //               computationally more expensive for an attacker to
00083 //               search the key space exhaustively.  This should be a
00084 //               multiple of 1,000 and should not exceed about 65
00085 //               million; the value 0 indicates just one application
00086 //               of the hashing algorithm.
00087 //
00088 //               The default is whatever is specified by the
00089 //               encryption-iteration-count config variable.
00090 ////////////////////////////////////////////////////////////////////
00091 INLINE void EncryptStreamBuf::
00092 set_iteration_count(int iteration_count) {
00093   _iteration_count = iteration_count;
00094 }
00095 
00096 ////////////////////////////////////////////////////////////////////
00097 //     Function: EncryptStreamBuf::get_iteration_count
00098 //       Access: Public
00099 //  Description: Returns the value that was specified by
00100 //               set_iteration_count(), or was read from the stream by
00101 //               the last successful open_read().
00102 ////////////////////////////////////////////////////////////////////
00103 INLINE int EncryptStreamBuf::
00104 get_iteration_count() const {
00105   return _iteration_count;
00106 }
 All Classes Functions Variables Enumerations