VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/UserInterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main/UserInterface.cpp')
-rw-r--r--src/Main/UserInterface.cpp116
1 files changed, 86 insertions, 30 deletions
diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp
index d0e2f9a1..3ec2e8dc 100644
--- a/src/Main/UserInterface.cpp
+++ b/src/Main/UserInterface.cpp
@@ -17,6 +17,7 @@
#include <wx/cmdline.h>
#include "Crypto/cpu.h"
#include "Platform/PlatformTest.h"
+#include "Common/PCSCException.h"
#ifdef TC_UNIX
#include <errno.h>
#include "Platform/Unix/Process.h"
@@ -254,7 +255,7 @@ namespace VeraCrypt
#endif
prop << LangString["MOUNT_POINT"] << L": " << wstring (volume.MountPoint) << L'\n';
prop << LangString["SIZE"] << L": " << SizeToString (volume.Size) << L'\n';
- prop << LangString["TYPE"] << L": " << VolumeTypeToString (volume.Type, volume.TrueCryptMode, volume.Protection) << L'\n';
+ prop << LangString["TYPE"] << L": " << VolumeTypeToString (volume.Type, volume.Protection) << L'\n';
prop << LangString["READ_ONLY"] << L": " << LangString [volume.Protection == VolumeProtection::ReadOnly ? "UISTR_YES" : "UISTR_NO"] << L'\n';
@@ -436,6 +437,27 @@ namespace VeraCrypt
return LangString["SECURITY_TOKEN_ERROR"] + L":\n\n" + StringConverter::ToWide (errorString);
}
+
+ // PCSC Exception
+ if (dynamic_cast <const PCSCException *> (&ex))
+ {
+ string errorString = string (dynamic_cast <const PCSCException &> (ex));
+
+ if (LangString.Exists (errorString))
+ return LangString[errorString];
+
+ if (errorString.find("SCARD_E_") == 0 || errorString.find("SCARD_F_") == 0 || errorString.find("SCARD_W_") == 0)
+ {
+ errorString = errorString.substr(8);
+ for (size_t i = 0; i < errorString.size(); ++i)
+ {
+ if (errorString[i] == '_')
+ errorString[i] = ' ';
+ }
+ }
+ return LangString["PCSC_ERROR"] + L":\n\n" + StringConverter::ToWide (errorString);
+ }
+
// Other library exceptions
return ExceptionTypeToString (typeid (ex));
}
@@ -480,7 +502,20 @@ namespace VeraCrypt
EX2MSG (TemporaryDirectoryFailure, LangString["LINUX_EX2MSG_TEMPORARYDIRECTORYFAILURE"]);
EX2MSG (UnportablePassword, LangString["UNSUPPORTED_CHARS_IN_PWD"]);
+ EX2MSG (CommandAPDUNotValid, LangString["COMMAND_APDU_INVALID"]);
+ EX2MSG (ExtendedAPDUNotSupported, LangString["EXTENDED_APDU_UNSUPPORTED"]);
+ EX2MSG (ScardLibraryInitializationFailed, LangString["SCARD_MODULE_INIT_FAILED"]);
+ EX2MSG (EMVUnknownCardType, LangString["EMV_UNKNOWN_CARD_TYPE"]);
+ EX2MSG (EMVSelectAIDFailed, LangString["EMV_SELECT_AID_FAILED"]);
+ EX2MSG (EMVIccCertNotFound, LangString["EMV_ICC_CERT_NOTFOUND"]);
+ EX2MSG (EMVIssuerCertNotFound, LangString["EMV_ISSUER_CERT_NOTFOUND"]);
+ EX2MSG (EMVCPLCNotFound, LangString["EMV_CPLC_NOTFOUND"]);
+ EX2MSG (InvalidEMVPath, LangString["INVALID_EMV_PATH"]);
+ EX2MSG (EMVKeyfileDataNotFound, LangString["EMV_KEYFILE_DATA_NOTFOUND"]);
+ EX2MSG (EMVPANNotFound, LangString["EMV_PAN_NOTFOUND"]);
+
#if defined (TC_LINUX)
+ EX2MSG (TerminalNotFound, LangString["LINUX_EX2MSG_TERMINALNOTFOUND"]);
EX2MSG (UnsupportedSectorSize, LangString["SECTOR_SIZE_UNSUPPORTED"]);
EX2MSG (UnsupportedSectorSizeHiddenVolumeProtection, LangString["LINUX_EX2MSG_UNSUPPORTEDSECTORSIZEHIDDENVOLUMEPROTECTION"]);
EX2MSG (UnsupportedSectorSizeNoKernelCrypto, LangString["LINUX_EX2MSG_UNSUPPORTEDSECTORSIZENOKERNELCRYPTO"]);
@@ -492,8 +527,6 @@ namespace VeraCrypt
EX2MSG (VolumeEncryptionNotCompleted, LangString["ERR_ENCRYPTION_NOT_COMPLETED"]);
EX2MSG (VolumeHostInUse, LangString["LINUX_EX2MSG_VOLUMEHOSTINUSE"]);
EX2MSG (VolumeSlotUnavailable, LangString["LINUX_EX2MSG_VOLUMESLOTUNAVAILABLE"]);
- EX2MSG (UnsupportedAlgoInTrueCryptMode, LangString["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
- EX2MSG (UnsupportedTrueCryptFormat, LangString["UNSUPPORTED_TRUECRYPT_FORMAT"]);
#ifdef TC_MACOSX
EX2MSG (HigherFuseVersionRequired, LangString["LINUX_EX2MSG_HIGHERFUSEVERSIONREQUIRED"]);
@@ -932,10 +965,9 @@ namespace VeraCrypt
cmdLine.ArgMountOptions.Pim = cmdLine.ArgPim;
cmdLine.ArgMountOptions.Keyfiles = cmdLine.ArgKeyfiles;
cmdLine.ArgMountOptions.SharedAccessAllowed = cmdLine.ArgForce;
- cmdLine.ArgMountOptions.TrueCryptMode = cmdLine.ArgTrueCryptMode;
if (cmdLine.ArgHash)
{
- cmdLine.ArgMountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*cmdLine.ArgHash, cmdLine.ArgTrueCryptMode);
+ cmdLine.ArgMountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*cmdLine.ArgHash);
}
@@ -1008,7 +1040,7 @@ namespace VeraCrypt
{
if (!message.IsEmpty())
message += L'\n';
- message += StringFormatter (LangString["LINUX_VOL_DISMOUNTED"], wstring (volume.Path));
+ message += StringFormatter (LangString["LINUX_VOL_MOUNTED"], wstring (volume.Path));
}
ShowInfo (message);
}
@@ -1020,7 +1052,7 @@ namespace VeraCrypt
return true;
case CommandId::ChangePassword:
- ChangePassword (cmdLine.ArgVolumePath, cmdLine.ArgPassword, cmdLine.ArgPim, cmdLine.ArgHash, cmdLine.ArgTrueCryptMode, cmdLine.ArgKeyfiles, cmdLine.ArgNewPassword, cmdLine.ArgNewPim, cmdLine.ArgNewKeyfiles, cmdLine.ArgNewHash);
+ ChangePassword (cmdLine.ArgVolumePath, cmdLine.ArgPassword, cmdLine.ArgPim, cmdLine.ArgHash, cmdLine.ArgKeyfiles, cmdLine.ArgNewPassword, cmdLine.ArgNewPim, cmdLine.ArgNewKeyfiles, cmdLine.ArgNewHash);
return true;
case CommandId::CreateKeyfile:
@@ -1033,7 +1065,7 @@ namespace VeraCrypt
if (cmdLine.ArgHash)
{
- options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*cmdLine.ArgHash, false);
+ options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*cmdLine.ArgHash);
RandomNumberGenerator::SetHash (cmdLine.ArgHash);
}
@@ -1121,7 +1153,7 @@ namespace VeraCrypt
" Delete keyfiles from security tokens. See also command --list-token-keyfiles.\n"
"\n"
"--export-token-keyfile\n"
- " Export a keyfile from a security token. See also command --list-token-keyfiles.\n"
+ " Export a keyfile from a token. See also command --list-token-keyfiles.\n"
"\n"
"--import-token-keyfiles\n"
" Import keyfiles to a security token. See also option --token-lib.\n"
@@ -1133,9 +1165,15 @@ namespace VeraCrypt
" output option (-v). See below for description of MOUNTED_VOLUME.\n"
"\n"
"--list-token-keyfiles\n"
- " Display a list of all available security token keyfiles. See also command\n"
+ " Display a list of all available token keyfiles. See also command\n"
" --import-token-keyfiles.\n"
- "\n"
+ "\n""--list-securitytoken-keyfiles\n"
+ " Display a list of all available security token keyfiles. See also command\n"
+ " --import-token-keyfiles.\n"
+ "\n"
+ "\n""--list-emvtoken-keyfiles\n"
+ " Display a list of all available emv token keyfiles. See also command\n"
+ "\n"
"--mount[=VOLUME_PATH]\n"
" Mount a volume. Volume path and other options are requested from the user\n"
" if not specified on command line.\n"
@@ -1170,7 +1208,8 @@ namespace VeraCrypt
" Display password characters while typing.\n"
"\n"
"--encryption=ENCRYPTION_ALGORITHM\n"
- " Use specified encryption algorithm when creating a new volume.\n"
+ " Use specified encryption algorithm when creating a new volume. When cascading\n"
+ " algorithms, they must be separated by a dash. For example: AES-Twofish.\n"
"\n"
"--filesystem=TYPE\n"
" Filesystem type to mount. The TYPE argument is passed to mount(8) command\n"
@@ -1198,9 +1237,12 @@ namespace VeraCrypt
" used (non-recursively). Multiple keyfiles must be separated by comma.\n"
" Use double comma (,,) to specify a comma contained in keyfile's name.\n"
" Keyfile stored on a security token must be specified as\n"
- " token://slot/SLOT_NUMBER/file/FILENAME. An empty keyfile (-k \"\") disables\n"
+ " token://slot/SLOT_NUMBER/file/FILENAME for a security token keyfile\n"
+ " and emv://slot/SLOT_NUMBER for an EMV token keyfile.\n"
+ " An empty keyfile (-k \"\") disables\n"
" interactive requests for keyfiles. See also options --import-token-keyfiles,\n"
- " --list-token-keyfiles, --new-keyfiles, --protection-keyfiles.\n"
+ " --list-token-keyfiles, --list-securitytoken-keyfiles, --list-emvtoken-keyfiles,\n"
+ " --new-keyfiles, --protection-keyfiles.\n"
"\n"
"--load-preferences\n"
" Load user preferences.\n"
@@ -1280,11 +1322,6 @@ namespace VeraCrypt
" Use text user interface. Graphical user interface is used by default if\n"
" available. This option must be specified as the first argument.\n"
"\n"
- "-tc, --truecrypt\n"
- " Enable TrueCrypt compatibility mode to enable mounting volumes created\n"
- " by TrueCrypt 6.x or 7.x. This option must be specified as the first\n"
- " argument, or immediately after --text.\n"
- "\n"
"--token-lib=LIB_PATH\n"
" Use specified PKCS #11 security token library.\n"
"\n"
@@ -1355,18 +1392,26 @@ namespace VeraCrypt
}
return true;
- case CommandId::ExportSecurityTokenKeyfile:
- ExportSecurityTokenKeyfile();
+ case CommandId::ExportTokenKeyfile:
+ ExportTokenKeyfile();
return true;
- case CommandId::ImportSecurityTokenKeyfiles:
- ImportSecurityTokenKeyfiles();
+ case CommandId::ImportTokenKeyfiles:
+ ImportTokenKeyfiles();
return true;
- case CommandId::ListSecurityTokenKeyfiles:
- ListSecurityTokenKeyfiles();
+ case CommandId::ListTokenKeyfiles:
+ ListTokenKeyfiles();
return true;
+ case CommandId::ListSecurityTokenKeyfiles:
+ ListSecurityTokenKeyfiles();
+ return true;
+
+ case CommandId::ListEMVTokenKeyfiles:
+ ListEMVTokenKeyfiles();
+ return true;
+
case CommandId::ListVolumes:
if (Preferences.Verbose)
DisplayVolumeProperties (cmdLine.ArgVolumes);
@@ -1548,7 +1593,7 @@ namespace VeraCrypt
return dateStr;
}
- wxString UserInterface::VolumeTypeToString (VolumeType::Enum type, bool truecryptMode, VolumeProtection::Enum protection) const
+ wxString UserInterface::VolumeTypeToString (VolumeType::Enum type, VolumeProtection::Enum protection) const
{
wxString sResult;
switch (type)
@@ -1566,8 +1611,6 @@ namespace VeraCrypt
break;
}
- if (truecryptMode)
- sResult = wxT("TrueCrypt-") + sResult;
return sResult;
}
@@ -1620,6 +1663,7 @@ namespace VeraCrypt
VC_CONVERT_EXCEPTION (ParameterTooLarge);
VC_CONVERT_EXCEPTION (PartitionDeviceRequired);
VC_CONVERT_EXCEPTION (StringConversionFailed);
+ VC_CONVERT_EXCEPTION (TerminalNotFound);
VC_CONVERT_EXCEPTION (TestFailed);
VC_CONVERT_EXCEPTION (TimeOut);
VC_CONVERT_EXCEPTION (UnknownException);
@@ -1640,12 +1684,24 @@ namespace VeraCrypt
VC_CONVERT_EXCEPTION (SecurityTokenLibraryNotInitialized);
VC_CONVERT_EXCEPTION (SecurityTokenKeyfileAlreadyExists);
VC_CONVERT_EXCEPTION (SecurityTokenKeyfileNotFound);
- VC_CONVERT_EXCEPTION (UnsupportedAlgoInTrueCryptMode);
- VC_CONVERT_EXCEPTION (UnsupportedTrueCryptFormat);
VC_CONVERT_EXCEPTION (SystemException);
VC_CONVERT_EXCEPTION (CipherException);
VC_CONVERT_EXCEPTION (VolumeException);
VC_CONVERT_EXCEPTION (PasswordException);
+
+ VC_CONVERT_EXCEPTION (PCSCException);
+ VC_CONVERT_EXCEPTION (CommandAPDUNotValid);
+ VC_CONVERT_EXCEPTION (ExtendedAPDUNotSupported);
+ VC_CONVERT_EXCEPTION (ScardLibraryInitializationFailed);
+ VC_CONVERT_EXCEPTION (EMVUnknownCardType);
+ VC_CONVERT_EXCEPTION (EMVSelectAIDFailed);
+ VC_CONVERT_EXCEPTION (EMVIccCertNotFound);
+ VC_CONVERT_EXCEPTION (EMVIssuerCertNotFound);
+ VC_CONVERT_EXCEPTION (EMVCPLCNotFound);
+ VC_CONVERT_EXCEPTION (InvalidEMVPath);
+ VC_CONVERT_EXCEPTION (EMVKeyfileDataNotFound);
+ VC_CONVERT_EXCEPTION (EMVPANNotFound);
+
throw *ex;
}
}