inline DirectoryEntry LocalServiceLocatorDataStore::MakeAccount(
     const std::string& name, const std::string& password,
     const DirectoryEntry& parent,
     const boost::posix_time::ptime& registrationTime) {
   bool accountExists;
   try {
     DirectoryEntry existingAccount = LoadAccount(name);
     accountExists = true;
   } catch(const ServiceLocatorDataStoreException&) {
     accountExists = false;
   }
   if(accountExists) {
     BOOST_THROW_EXCEPTION(ServiceLocatorDataStoreException(
       "An account with the specified name exists."));
   }
   DirectoryEntry newEntry(DirectoryEntry::Type::ACCOUNT, m_nextId, name);
   ++m_nextId;
   m_accounts.push_back(newEntry);
   m_passwords.insert(std::make_pair(newEntry,
     HashPassword(newEntry, password)));
   m_registrationTimes.insert(std::make_pair(newEntry, registrationTime));
   m_lastLoginTimes.insert(std::make_pair(newEntry,
     boost::posix_time::neg_infin));
   Associate(newEntry, parent);
   return newEntry;
 }
Exemplo n.º 2
0
unsigned long decryption(char* src, char* password, char* dst){
    char* hashPwd;
    hashPwd = HashPassword(password);
    OpenAllFile(src, dst);
    JudgeEBmpValidity();    
    GetDstFileSize();
    SaveCarryFile(hashPwd);
    closeAllFile();
    return 0;
}
Exemplo n.º 3
0
// Create a password authentication data
void *NewPasswordAuthData(char *username, char *password)
{
	AUTHPASSWORD *pw;
	// Validate arguments
	if (username == NULL || password == NULL)
	{
		return NULL;
	}

	pw = ZeroMalloc(sizeof(AUTHPASSWORD));
	HashPassword(pw->HashedKey, username, password);
	GenerateNtPasswordHash(pw->NtLmSecureHash, password);

	return pw;
}