1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2026-06-10 06:46:59 -05:00

EMV keyfile support: Overall code improvements and bug fixes

This commit is contained in:
Mounir IDRASSI
2023-06-29 00:06:20 +02:00
parent 502ab9112a
commit 034b64f415
81 changed files with 4654 additions and 1574 deletions
+21 -17
View File
@@ -15,42 +15,46 @@
#define UNAVAILABLE_SLOT ~0UL
namespace VeraCrypt {
struct TokenKeyfilePath {
namespace VeraCrypt
{
struct TokenKeyfilePath
{
virtual ~TokenKeyfilePath() {};
TokenKeyfilePath(const wstring& path): Path(path) { }
operator wstring () const { return Path; }
wstring Path; //Complete path
wstring Path; // Complete path
};
struct TokenInfo {
TokenInfo() {}
struct TokenInfo
{
TokenInfo(): SlotId(0), Label(L"") {}
virtual ~TokenInfo() {}
virtual BOOL isEditable() const=0;
virtual BOOL isEditable() const = 0;
unsigned long int SlotId;
wstring Label; //Card name
wstring Label; // Card name
};
struct TokenKeyfile {
struct TokenKeyfile
{
virtual ~TokenKeyfile() {}
virtual operator TokenKeyfilePath () const = 0;
virtual void GetKeyfileData(vector <byte>& keyfileData) const = 0;
string IdUtf8; // Was used in SecurityToken to compare with the file name from a PKCS11 card, remove from token ?
shared_ptr<TokenInfo> Token;
wstring Id;
};
class Token {
class Token
{
public:
static vector<shared_ptr<TokenKeyfile>> GetAvailableKeyfiles(bool EMVOption);
static bool IsKeyfilePathValid(const wstring& tokenKeyfilePath, bool EMVOption);
static list <shared_ptr<TokenInfo>> GetAvailableTokens(); // List available token to write
static shared_ptr<TokenKeyfile> getTokenKeyfile(const TokenKeyfilePath path);
static vector<shared_ptr<TokenKeyfile>> GetAvailableKeyfiles(bool isEMVSupportEnabled);
static bool IsKeyfilePathValid(const wstring& tokenKeyfilePath, bool isEMVSupportEnabled);
static list <shared_ptr<TokenInfo>> GetAvailableTokens();
static shared_ptr<TokenKeyfile> getTokenKeyfile(const TokenKeyfilePath& path);
};
};