Panda3D
Public Member Functions | Public Attributes | List of all members
OEncryptStream Class Reference

An input stream object that uses OpenSSL to encrypt data to another destination stream on-the-fly. More...

Inheritance diagram for OEncryptStream:
Ostream BasicIosChar IosBase

Public Member Functions

 __init__ ()
 
 __init__ (Ostream dest, bool owns_dest, str password)
 
OEncryptStream close ()
 Resets the EncryptStream to empty, but does not actually close the dest ostream unless owns_dest was true. More...
 
OEncryptStream open (Ostream dest, bool owns_dest, str password)
 
 setAlgorithm (str algorithm)
 Specifies the encryption algorithm that should be used for future calls to open(). More...
 
 setIterationCount (int iteration_count)
 Specifies the number of times to repeatedly hash the key before writing it to the stream in future calls to open(). More...
 
 setKeyLength (int key_length)
 Specifies the length of the key, in bits, that should be used to encrypt the stream in future calls to open(). More...
 
- Public Member Functions inherited from Ostream
 flush ()
 
 put (char c)
 
 seekp (Streamoff pos)
 
 seekp (Streamoff off, IosBase::Seekdir dir)
 
Streamoff tellp ()
 
- Public Member Functions inherited from BasicIosChar
bool bad ()
 
 clear ()
 
bool eof ()
 
bool fail ()
 
bool good ()
 

Public Attributes

const String algorithm
 Returns the encryption algorithm that was read from the stream. More...
 
int iteration_count
 Returns the value that was was read from the stream. More...
 
int key_length
 Returns the encryption key length, in bits, that was read from the stream. More...
 

Additional Inherited Members

- Public Types inherited from IosBase
enum  Iostate
 
enum  Openmode
 
enum  Seekdir { beg = 0, cur = 1, end = 2 }
 

Detailed Description

An input stream object that uses OpenSSL to encrypt data to another destination stream on-the-fly.

Attach an OEncryptStream to an existing ostream that will accept encrypted data, and write your unencrypted source data to the OEncryptStream.

Seeking is not supported.

Member Function Documentation

◆ __init__() [1/2]

__init__ ( )

◆ __init__() [2/2]

__init__ ( Ostream  dest,
bool  owns_dest,
str  password 
)

◆ close()

OEncryptStream close ( )

Resets the EncryptStream to empty, but does not actually close the dest ostream unless owns_dest was true.

◆ open()

OEncryptStream open ( Ostream  dest,
bool  owns_dest,
str  password 
)

◆ setAlgorithm()

setAlgorithm ( str  algorithm)

Specifies the encryption algorithm that should be used for future calls to open().

The default is whatever is specified by the encryption-algorithm config variable. The complete set of available algorithms is defined by the current version of OpenSSL.

If an invalid algorithm is specified, there is no immediate error return code, but open() will fail.

◆ setIterationCount()

setIterationCount ( int  iteration_count)

Specifies the number of times to repeatedly hash the key before writing it to the stream in future calls to open().

Its purpose is to make it computationally more expensive for an attacker to search the key space exhaustively. This should be a multiple of 1,000 and should not exceed about 65 million; the value 0 indicates just one application of the hashing algorithm.

The default is whatever is specified by the encryption-iteration-count config variable.

◆ setKeyLength()

setKeyLength ( int  key_length)

Specifies the length of the key, in bits, that should be used to encrypt the stream in future calls to open().

The default is whatever is specified by the encryption-key-length config variable.

If an invalid key_length for the chosen algorithm is specified, there is no immediate error return code, but open() will fail.

Member Data Documentation

◆ algorithm

const String algorithm

Returns the encryption algorithm that was read from the stream.

◆ iteration_count

int iteration_count

Returns the value that was was read from the stream.

◆ key_length

int key_length

Returns the encryption key length, in bits, that was read from the stream.