Logo Search packages:      
Sourcecode: yapet version File versions  Download package

time_t File::getMasterPWSet ( const Key key  )  const throw (YAPETException,YAPETInvalidPasswordException)

Returns the time as a time_t when the master password was set.

Parameters:
key the key used to decrypt the header.
Returns:
a time_t representing the time the master password was set.

Definition at line 832 of file file.cc.

References YAPET::Crypt::decrypt(), YAPET::FileHeader::pwset, readHeader(), and uint32_from_disk().

                                                        {
    Crypt crypt(key);
    BDBuffer* enc_header = NULL;
    Record<FileHeader>* dec_header = NULL;
    FileHeader* ptr_dec_header = NULL;

    try {
      enc_header = readHeader();
      dec_header = crypt.decrypt<FileHeader>(*enc_header);
      ptr_dec_header = *dec_header;
    } catch (YAPETEncryptionException& ex) {
      if (enc_header != NULL) delete enc_header;
      if (dec_header != NULL) delete dec_header;
      throw YAPETInvalidPasswordException();
    } catch (YAPETException& ex) {
      if (enc_header != NULL) delete enc_header;
      if (dec_header != NULL) delete dec_header;
      throw;
    }

    time_t t = uint32_from_disk(ptr_dec_header->pwset);
    delete enc_header;
    delete dec_header;

    return t;
}


Generated by  Doxygen 1.6.0   Back to index