Linux/MacOSX: Implement passing smart card PIN as command line argument (--token-pin switch)

This commit is contained in:
Mounir IDRASSI
2016-05-28 23:53:55 +02:00
parent 3f806010d2
commit a0d8b8a3b7
6 changed files with 39 additions and 0 deletions

View File

@@ -1053,6 +1053,13 @@ namespace VeraCrypt
virtual void operator() (string &passwordStr)
{
if (CmdLine->ArgTokenPin && CmdLine->ArgTokenPin->IsAllocated ())
{
passwordStr.clear();
passwordStr.insert (0, (char*) CmdLine->ArgTokenPin->Ptr (), CmdLine->ArgTokenPin->Size());
return;
}
if (UI->GetPreferences().NonInteractive)
throw MissingArgument (SRC_POS);
@@ -1069,6 +1076,14 @@ namespace VeraCrypt
StringConverter::ToSingle (wPassword, passwordStr);
}
virtual void notifyIncorrectPin ()
{
if (CmdLine->ArgTokenPin && CmdLine->ArgTokenPin->IsAllocated ())
{
CmdLine->ArgTokenPin->Free ();
}
}
const TextUserInterface *UI;
};