VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/GraphicUserInterface.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-05-28 21:53:55 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-05-28 23:33:17 (GMT)
commita0d8b8a3b78b1d0db50de2a7d841efaec2a55c36 (patch)
tree749fb2a2fd5888145030b546666a41d28479bafa /src/Main/GraphicUserInterface.cpp
parent3f806010d2e2d54f0b5bc796f2d5e506e66537c7 (diff)
downloadVeraCrypt-a0d8b8a3b78b1d0db50de2a7d841efaec2a55c36.zip
VeraCrypt-a0d8b8a3b78b1d0db50de2a7d841efaec2a55c36.tar.gz
Linux/MacOSX: Implement passing smart card PIN as command line argument (--token-pin switch)
Diffstat (limited to 'src/Main/GraphicUserInterface.cpp')
-rw-r--r--src/Main/GraphicUserInterface.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp
index d15e737..b302b71 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