mirror of
https://github.com/vgough/encfs.git
synced 2024-12-25 16:18:47 +01:00
reset salt and iteration count when changing password
git-svn-id: http://encfs.googlecode.com/svn/trunk@36 db9cf616-1c43-0410-9cb8-a902689de0d6
This commit is contained in:
parent
921a361e1b
commit
bcfe2aff09
@ -692,6 +692,21 @@ static int do_chpasswd( bool useStdin, int argc, char **argv )
|
||||
// Now, get New user key..
|
||||
userKey.reset();
|
||||
cout << _("Enter new Encfs password\n");
|
||||
// reinitialize salt and iteration count
|
||||
config.kdfIterations = 0; // generate new
|
||||
if(config.saltSize != 20)
|
||||
{
|
||||
if(config.saltData != NULL)
|
||||
delete[] config.saltData;
|
||||
config.saltSize = 20;
|
||||
config.saltData = new unsigned char[config.saltSize];
|
||||
}
|
||||
if(!cipher->randomize(config.saltData, config.saltSize, 20))
|
||||
{
|
||||
cout << _("Error creating salt\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if( useStdin )
|
||||
userKey = getUserKey( cipher, true,
|
||||
config.saltData, config.saltSize,
|
||||
@ -724,6 +739,9 @@ static int do_chpasswd( bool useStdin, int argc, char **argv )
|
||||
{
|
||||
cout << _("Error saving modified config file.\n");
|
||||
}
|
||||
} else
|
||||
{
|
||||
cout << _("Error creating key\n");
|
||||
}
|
||||
|
||||
volumeKey.reset();
|
||||
|
Loading…
Reference in New Issue
Block a user