From a0d8b8a3b78b1d0db50de2a7d841efaec2a55c36 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sat, 28 May 2016 23:53:55 +0200 Subject: Linux/MacOSX: Implement passing smart card PIN as command line argument (--token-pin switch) --- src/Main/GraphicUserInterface.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/Main/GraphicUserInterface.cpp') diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp index d15e7375..b302b715 100644 --- a/src/Main/GraphicUserInterface.cpp +++ b/src/Main/GraphicUserInterface.cpp @@ -537,6 +537,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 (Gui->GetPreferences().NonInteractive) throw MissingArgument (SRC_POS); @@ -563,6 +570,14 @@ namespace VeraCrypt StringConverter::ToSingle (wPassword, passwordStr); } + + virtual void notifyIncorrectPin () + { + if (CmdLine->ArgTokenPin && CmdLine->ArgTokenPin->IsAllocated ()) + { + CmdLine->ArgTokenPin->Free (); + } + } }; struct WarningHandler : public SendExceptionFunctor -- cgit v1.2.3