EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Encryption Password problem

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#2661
Posted: 04/02/2007 13:10:03
by Christian Peel (Standard support level)
Joined: 03/29/2007
Posts: 1

Having a problem with the length of a password when setting storage or file encryption password. SolFS only stores half the password unless the string length argument is doubled.

Using SolFS Standard v.3.1.0.75
Visual Studio 2005

Create Storage with encryption

SolFSStream::SolFSStorage _storage((PWideChar)storagePath.c_str(), SOLFS_NO_OVERWRITE, SOLFS_PAGE_SIZE, SOLFS_USE_TRANSACTIONS, SOLFS_USE_ACCESS_TIME, gPathSeparator, (PWideChar)gLogo.c_str());
All fields are checked and valid, all strings are wchar_t
SOLFS_NO_OVERWRITE = false
SOLFS_PAGE_SIZE = 512
SOLFS_USE_TRANSACTIONS = false
SOLFS_USE_ACCESS_TIME = false
gPathSeparator = Lā€\\ā€

_storage.SetEncryption( ecAES256_SHA256, NULL, (const PWideChar)storagePwd.c_str() );
storagePwd is wchar_t, 44 characters, 88 byte
close storage....

Open storage....
pStorage->SetPassword((const PWideChar)storagePwd.c_str());
Exception, Invalid Password
storagePwd is wchar_t, 44 characters, 88 byte, verified to be the same data as in SetEncryption
If only 22 characters of storagePwd are passed to SetPassword, function succeeds


Code fix implemented in Solfs.hpp V 3.1.0.75
SetEncryption modified to 2x the size of the new password length. wstring that is passed to StorageSetEncryption, is allocated 2x password size incase memory is modified inside StorageSetEncryption (avoiding memory errors)
SetPassword has not been changed.
Following code works with 44 character 88 byte wchar_t password....
void SolFSStorage::SetEncryption(SolFSEncryption Encryption, const PWideChar OldPassword, const PWideChar NewPassword)
{
wstring temp_bug_fix( NewPassword );
temp_bug_fix.resize( temp_bug_fix.size() * 2 );
PWideChar _password = (PWideChar)&temp_bug_fix[0];

CheckActive();
CheckStorageResult(StorageSetEncryption(m_Storage, (LongWord) Encryption,
OldPassword, xwcslen(OldPassword), _password, 2*xwcslen(_password)));
m_StorageEncryption = Encryption;
m_StoragePassword = xwstrdup(NewPassword);
}
void SolFSStorage::SetPassword(const PWideChar Password)
{
CheckActive();
CheckStorageResult(StorageSetPassword(m_Storage, Password, xwcslen(Password)));
}

Same problem exists for File Encryption
Same modification made for SolFSStream::InternalCreate
#2672
Posted: 04/03/2007 14:08:42
by Eugene Mayevski (EldoS Corp.)

Passed to helpdesk for fixing by the developer, as your fix is partial (and the source of the problem is yet unknown).


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 3956 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!