encfs/cipher/CipherKey.h
Valient Gough b606ef122b cleanup warnings from cppcheck
git-svn-id: http://encfs.googlecode.com/svn/trunk@124 db9cf616-1c43-0410-9cb8-a902689de0d6
2013-10-21 05:38:54 +00:00

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();
CipherKey &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