EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Encryption Password problem

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.
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
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
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];

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)
CheckStorageResult(StorageSetPassword(m_Storage, Password, xwcslen(Password)));

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

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



Topic viewed 5768 times

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


Back to top

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

Got it!