00001 // -*- c++ -*- 00002 // 00003 // $Id: partdec.h 1331 2008-07-15 20:58:38Z rafi $ 00004 // 00005 // YAPET -- Yet Another Password Encryption Tool 00006 // Copyright (C) 2008 Rafael Ostertag 00007 // 00008 // This program is free software: you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation, either version 3 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // This program is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 // 00021 00022 #ifndef _PARTDEC_H 00023 #define _PARTDEC_H 00024 00025 #ifdef HAVE_CONFIG_H 00026 # include <config.h> 00027 #endif 00028 00029 #ifdef HAVE_INTTYPES_H 00030 # include <inttypes.h> 00031 #endif 00032 00033 #include "record.h" 00034 #include "key.h" 00035 #include "yapetexception.h" 00036 #include "bdbuffer.h" 00037 #include "structs.h" 00038 00039 namespace YAPET { 00055 class PartDec { 00056 private: 00062 uint8_t name[NAME_SIZE]; 00068 BDBuffer enc_data; 00069 00070 public: 00071 PartDec(); 00072 00073 PartDec(BDBuffer& bd, 00074 const Key& key) throw(YAPETException); 00075 00076 PartDec(Record<PasswordRecord>& pr, 00077 const Key& key) throw(YAPETException); 00078 00079 PartDec(const PartDec& pd); 00080 00081 ~PartDec(); 00082 00083 void setRecord(Record<PasswordRecord>& pr, 00084 const Key& key) throw(YAPETException); 00094 inline const BDBuffer& getEncRecord() const { return enc_data; } 00104 inline const uint8_t* getName() const { return name; } 00113 inline const char* c_str() const { return (char*)name; } 00114 const PartDec& operator=(const PartDec& pd); 00115 00116 bool operator<(const PartDec& pd) const; 00117 }; 00118 } 00119 00120 #endif // _PARTDEC_H