mirror of
https://github.com/vgough/encfs.git
synced 2024-12-01 20:34:04 +01:00
a89752dfe7
git-svn-id: http://encfs.googlecode.com/svn/trunk@121 db9cf616-1c43-0410-9cb8-a902689de0d6
61 lines
1.6 KiB
C++
61 lines
1.6 KiB
C++
/*****************************************************************************
|
|
* Author: Valient Gough <vgough@pobox.com>
|
|
*
|
|
*****************************************************************************
|
|
* Copyright (c) 2007, Valient Gough
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
* under the terms of the GNU Lesser General Public License as published by the
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
* option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
* for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef _CipherKey_incl_
|
|
#define _CipherKey_incl_
|
|
|
|
#include <cstring>
|
|
|
|
#include "base/shared_ptr.h"
|
|
#include "base/types.h"
|
|
|
|
namespace encfs {
|
|
|
|
class SecureMem;
|
|
|
|
class CipherKey {
|
|
public:
|
|
CipherKey(); // Creates a key for which valid() returns false.
|
|
explicit CipherKey(int length);
|
|
CipherKey(const byte *data, int length);
|
|
CipherKey(const CipherKey &src);
|
|
~CipherKey();
|
|
|
|
void operator=(const CipherKey &src);
|
|
|
|
byte *data() const;
|
|
int size() const;
|
|
|
|
// Clear memory associated with key.
|
|
void reset();
|
|
|
|
bool valid() const;
|
|
|
|
private:
|
|
bool _valid;
|
|
shared_ptr<SecureMem> _mem;
|
|
};
|
|
|
|
bool operator==(const CipherKey &a, const CipherKey &b);
|
|
|
|
} // namespace encfs
|
|
|
|
#endif
|