forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathencryptStream.h
More file actions
91 lines (73 loc) · 2.89 KB
/
encryptStream.h
File metadata and controls
91 lines (73 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Filename: encryptStream.h
// Created by: drose (01Sep04)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef ENCRYPTSTREAM_H
#define ENCRYPTSTREAM_H
#include "dtoolbase.h"
// This module is not compiled if OpenSSL is not available.
#ifdef HAVE_OPENSSL
#include "encryptStreamBuf.h"
////////////////////////////////////////////////////////////////////
// Class : IDecryptStream
// Description : An input stream object that uses OpenSSL to decrypt
// the input from another source stream on-the-fly.
//
// Attach an IDecryptStream to an existing istream that
// provides encrypted data, as generated by an
// OEncryptStream, and read the corresponding
// unencrypted data from the IDecryptStream.
//
// Seeking is not supported.
////////////////////////////////////////////////////////////////////
class EXPCL_DTOOLCONFIG IDecryptStream : public istream {
PUBLISHED:
INLINE IDecryptStream();
INLINE IDecryptStream(istream *source, bool owns_source,
const string &password);
INLINE IDecryptStream &open(istream *source, bool owns_source,
const string &password);
INLINE IDecryptStream &close();
INLINE const string &get_algorithm() const;
INLINE int get_key_length() const;
INLINE int get_iteration_count() const;
private:
EncryptStreamBuf _buf;
};
////////////////////////////////////////////////////////////////////
// Class : OEncryptStream
// 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.
////////////////////////////////////////////////////////////////////
class EXPCL_DTOOLCONFIG OEncryptStream : public ostream {
PUBLISHED:
INLINE OEncryptStream();
INLINE OEncryptStream(ostream *dest, bool owns_dest,
const string &password);
INLINE OEncryptStream &open(ostream *dest, bool owns_dest,
const string &password);
INLINE OEncryptStream &close();
INLINE void set_algorithm(const string &algorithm);
INLINE void set_key_length(int key_length);
INLINE void set_iteration_count(int iteration_count);
private:
EncryptStreamBuf _buf;
};
#include "encryptStream.I"
#endif // HAVE_OPENSSL
#endif