Skip to content

Commit

Permalink
Merge pull request #50 from italia/feature/update-1.4.3.3
Browse files Browse the repository at this point in the history
Update to 1.4.3.3
  • Loading branch information
aantetomaso authored Oct 6, 2022
2 parents 60bcc55 + 7363938 commit 8a3234a
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 58 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.vscode/
.DS_Store
cie_sign_sdk/build
cie_sign_sdk/**/*.a
cie-pkcs11/dependencies/
libcie_sign_sdk.a
*dylib
Installer
*.zip
xcuserdata
Podfile.lock
Pods/
1 change: 1 addition & 0 deletions CIE ID/MainViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1649,6 +1649,7 @@ - (void)showInfoPage {

- (void)showMessage:(NSString*)message withTitle:(NSString*)title exitAfter:(bool)exitAfter {
[logger info:@"showMessage:withTitle:exitAfter: - Inizia funzione"];
[logger info:[NSString stringWithFormat:@"message: %@", message]];
__block bool exit = exitAfter;
dispatch_async(dispatch_get_main_queue(), ^ {
NSAlert *alert = [[NSAlert alloc] init];
Expand Down
2 changes: 1 addition & 1 deletion CIEIDBar/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion CIEToken/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSExtension</key>
Expand Down
32 changes: 18 additions & 14 deletions cie-pkcs11.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,9 @@
0883C2E2251C94290054055E /* CarouselCard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CarouselCard.m; sourceTree = "<group>"; };
0883C2E3251C94290054055E /* CarouselCard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CarouselCard.h; sourceTree = "<group>"; };
228A3612AA9E73AB30473645 /* libPods-cie-pkcs11.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-cie-pkcs11.a"; sourceTree = BUILT_PRODUCTS_DIR; };
2F05ABF04FC862DB88E240A2 /* Pods-CIE ID.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CIE ID.release.xcconfig"; path = "Pods/Target Support Files/Pods-CIE ID/Pods-CIE ID.release.xcconfig"; sourceTree = "<group>"; };
438D493AABE95B9738D331F7 /* Pods-cie-pkcs11.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-cie-pkcs11.release.xcconfig"; path = "Pods/Target Support Files/Pods-cie-pkcs11/Pods-cie-pkcs11.release.xcconfig"; sourceTree = "<group>"; };
6089967C276BCACE00E5CB32 /* AppLogger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppLogger.h; sourceTree = "<group>"; };
6089967D276BCACE00E5CB32 /* AppLogger.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppLogger.m; sourceTree = "<group>"; };
6E9C0B9FE6F0B903268DC6D0 /* Pods-CIE ID.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CIE ID.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CIE ID/Pods-CIE ID.debug.xcconfig"; sourceTree = "<group>"; };
7649F44025DE65E500A33DAC /* FirmaConCIE.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FirmaConCIE.cpp; sourceTree = "<group>"; };
7649F44125DE65E500A33DAC /* FirmaConCIE.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FirmaConCIE.h; sourceTree = "<group>"; };
7649F45425DE6B9700A33DAC /* VerificaConCIE.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = VerificaConCIE.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -339,6 +337,8 @@
77BAE7A8261EFB5600592607 /* libxml2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libxml2.a; path = cie_sign_sdk/Dependencies/libxml2/libxml2.a; sourceTree = "<group>"; };
77BAE7AA261EFB6000592607 /* libz.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libz.a; path = cie_sign_sdk/Dependencies/zlib/libz.a; sourceTree = "<group>"; };
79847492CAD3310437BDE674 /* Pods-cie-pkcs11.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-cie-pkcs11.debug.xcconfig"; path = "Pods/Target Support Files/Pods-cie-pkcs11/Pods-cie-pkcs11.debug.xcconfig"; sourceTree = "<group>"; };
AC7F8DEC9D70170164B0657A /* Pods-CIE ID.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CIE ID.release.xcconfig"; path = "Pods/Target Support Files/Pods-CIE ID/Pods-CIE ID.release.xcconfig"; sourceTree = "<group>"; };
D1955A7B2EEDA4790A796ED1 /* Pods-CIE ID.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CIE ID.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CIE ID/Pods-CIE ID.debug.xcconfig"; sourceTree = "<group>"; };
DC86202F63F36F82504EC0B3 /* Pods_CIE_ID.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CIE_ID.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E504202B2180665D00A41BF2 /* CIE-LOGO-REGISTRATO.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "CIE-LOGO-REGISTRATO.png"; sourceTree = "<group>"; };
E504202F218067BC00A41BF2 /* help.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = help.html; sourceTree = "<group>"; };
Expand Down Expand Up @@ -671,8 +671,8 @@
children = (
79847492CAD3310437BDE674 /* Pods-cie-pkcs11.debug.xcconfig */,
438D493AABE95B9738D331F7 /* Pods-cie-pkcs11.release.xcconfig */,
6E9C0B9FE6F0B903268DC6D0 /* Pods-CIE ID.debug.xcconfig */,
2F05ABF04FC862DB88E240A2 /* Pods-CIE ID.release.xcconfig */,
D1955A7B2EEDA4790A796ED1 /* Pods-CIE ID.debug.xcconfig */,
AC7F8DEC9D70170164B0657A /* Pods-CIE ID.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
Expand Down Expand Up @@ -1662,6 +1662,7 @@
CODE_SIGN_ENTITLEMENTS = CIEIDBar/CIEIDBar.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.4.3.3;
DEVELOPMENT_TEAM = 7GWNHU58JZ;
EXCLUDED_ARCHS = arm64;
INFOPLIST_FILE = CIEIDBar/Info.plist;
Expand All @@ -1674,7 +1675,7 @@
"$(PROJECT_DIR)/cie-pkcs11",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 1.3.4;
MARKETING_VERSION = 1.4.3.3;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "it.ipzs.CIE-ID-Bar";
Expand All @@ -1689,6 +1690,7 @@
CODE_SIGN_ENTITLEMENTS = CIEIDBar/CIEIDBar.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.4.3.3;
DEVELOPMENT_TEAM = 7GWNHU58JZ;
EXCLUDED_ARCHS = arm64;
INFOPLIST_FILE = CIEIDBar/Info.plist;
Expand All @@ -1701,7 +1703,7 @@
"$(PROJECT_DIR)/cie-pkcs11",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 1.3.4;
MARKETING_VERSION = 1.4.3.3;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "it.ipzs.CIE-ID-Bar";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1710,15 +1712,15 @@
};
E544F57421BFAFC90038B2CA /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 6E9C0B9FE6F0B903268DC6D0 /* Pods-CIE ID.debug.xcconfig */;
baseConfigurationReference = D1955A7B2EEDA4790A796ED1 /* Pods-CIE ID.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "CIE ID/CIE_ID.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 1.4.3.3;
DEVELOPMENT_TEAM = 7GWNHU58JZ;
INFOPLIST_FILE = "CIE ID/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -1730,7 +1732,7 @@
"$(SDKROOT)/usr/lib/system",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.4.4;
MARKETING_VERSION = 1.4.3.3;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "it.ipzs.CIE-ID";
Expand All @@ -1744,15 +1746,15 @@
};
E544F57521BFAFC90038B2CA /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 2F05ABF04FC862DB88E240A2 /* Pods-CIE ID.release.xcconfig */;
baseConfigurationReference = AC7F8DEC9D70170164B0657A /* Pods-CIE ID.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "CIE ID/CIE_ID.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 1.4.3.3;
DEVELOPMENT_TEAM = 7GWNHU58JZ;
INFOPLIST_FILE = "CIE ID/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -1764,7 +1766,7 @@
"$(SDKROOT)/usr/lib/system",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.4.4;
MARKETING_VERSION = 1.4.3.3;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "it.ipzs.CIE-ID";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1873,6 +1875,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.4.3.3;
DEVELOPMENT_TEAM = 7GWNHU58JZ;
ENABLE_HARDENED_RUNTIME = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
Expand All @@ -1886,7 +1889,7 @@
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.4.3.3;
PRODUCT_BUNDLE_IDENTIFIER = "it.ipzs.CIE-ID.CIEToken";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1901,6 +1904,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.4.3.3;
DEVELOPMENT_TEAM = 7GWNHU58JZ;
ENABLE_HARDENED_RUNTIME = NO;
INFOPLIST_FILE = CIEToken/Info.plist;
Expand All @@ -1909,7 +1913,7 @@
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.4.3.3;
PRODUCT_BUNDLE_IDENTIFIER = "it.ipzs.CIE-ID.CIEToken";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
Expand Down
33 changes: 16 additions & 17 deletions cie-pkcs11/CSP/ATR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,47 @@
using namespace CieIDLogger;

cie_atr atr_list[] = {
{CIE_Type::CIE_NXP, "NXP", { 0x80, 0x31, 0x80, 0x65, 0x49, 0x54, 0x4E, 0x58, 0x50, 0x12, 0x0F, 0xFF, 0x82, 0x90, 0xF0 }},
{CIE_Type::CIE_Gemalto, "Gemalto", { 0x80, 0x31, 0x80, 0x65, 0xB0, 0x85, 0x04, 0x00, 0x11 }},
{CIE_Type::CIE_Gemalto, "Gemalto2", {0x80, 0x31, 0x80, 0x65, 0xB0, 0x85, 0x03, 0x00, 0xEF }},
{CIE_Type::CIE_STM,"STM", {0x80, 0x66, 0x47, 0x50, 0x00, 0xB8, 0x00, 0x7F }},
{CIE_Type::CIE_STM2,"STM2", { 0x80, 0x80, 0x01, 0x01 }},
{CIE_Type::CIE_STM3,"STM3", {0x80, 0x01, 0x80, 0x66, 0x47, 0x50, 0x00, 0xB8, 0x00, 0x94, 0x82, 0x90, 0x00, 0xC5 }},
{CIE_Type::CIE_ACTALIS,"Actalis", {0x80, 0x01, 0x80, 0x31, 0x80, 0x65, 0x49, 0x54, 0x4a, 0x34, 0x41, 0x12, 0x0f, 0xff, 0x82, 0x90, 0x00, 0x88 }},
{CIE_Type::CIE_BIT4ID, "Bit4Id", {0x80, 0x01, 0x80, 0x31, 0x80, 0x65, 0x49, 0x54, 0x4a, 0x34, 0x42, 0x12, 0x0f, 0xff, 0x82, 0x90, 0x00, 0x8b }}
{CIE_Type::CIE_NXP, "NXP", { 0x80, 0x31, 0x80, 0x65, 0x49, 0x54, 0x4E, 0x58, 0x50 }},
{CIE_Type::CIE_Gemalto, "Gemalto", { 0x80, 0x31, 0x80, 0x65, 0xB0, 0x85, 0x04, 0x00, 0x11 }},
{CIE_Type::CIE_Gemalto, "Gemalto2", { 0x80, 0x31, 0x80, 0x65, 0xB0, 0x85, 0x03, 0x00, 0xEF }},
{CIE_Type::CIE_STM, "STM", { 0x80, 0x66, 0x47, 0x50, 0x00, 0xB8, 0x00, 0x7F }},
{CIE_Type::CIE_STM2, "STM2", { 0x80, 0x80, 0x01, 0x01 }},
{CIE_Type::CIE_STM3, "STM3", { 0x80, 0x01, 0x80, 0x66, 0x47, 0x50, 0x00, 0xB8, 0x00, 0x94, 0x82, 0x90, 0x00, 0xC5 }},
{CIE_Type::CIE_ACTALIS, "Actalis", { 0x80, 0x01, 0x80, 0x31, 0x80, 0x65, 0x49, 0x54, 0x4a, 0x34, 0x41, 0x12, 0x0f, 0xff, 0x82, 0x90, 0x00, 0x88 }},
{CIE_Type::CIE_BIT4ID, "Bit4Id", { 0x80, 0x01, 0x80, 0x31, 0x80, 0x65, 0x49, 0x54, 0x4a, 0x34, 0x42, 0x12, 0x0f, 0xff, 0x82, 0x90, 0x00, 0x8b }}
};


template <typename T>
bool IsSubset(std::vector<T> A, std::vector<T> B)
{
if (A.size() < B.size())
bool IsSubset(std::vector<T> A, std::vector<T> B) {
if (A.size() < B.size()) {
return false;
}

sort(A.begin(), A.end());
sort(B.begin(), B.end());
return includes(A.begin(), A.end(), B.begin(), B.end());
}

string get_manufacturer(vector<uint8_t> atr) {

for (cie_atr el : atr_list) {
if (IsSubset(atr, el.atr)) {
LOG_INFO("ReadCIEType - CIE %s detected", el.type.c_str());
LOG_INFO("ReadCIEType - get_manufacturer() CIE %s detected", el.type.c_str());
return el.type;
}
}

LOG_INFO("ReadCIEType - get_manufacturer() Unkown CIE detected");
return "";
}

CIE_Type get_type(vector<uint8_t> atr) {


for (cie_atr el : atr_list) {
if (IsSubset(atr, el.atr)) {
LOG_INFO("ReadCIEType - cie_type() CIE %s detected", el.type.c_str());
return el.cie_type;
}
}

LOG_INFO("ReadCIEType - cie_type() Unkown CIE detected");
return CIE_Type::CIE_Unknown;
}
}
15 changes: 8 additions & 7 deletions cie_sign_sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
- expat

## Step
- Creare una cartella con il nome *Dependencies* nella root del progetto che conterrà tutte le dipendenze precedentemente elencate. Per ogni dipendenza va creata la cartella con il nome e che conterrà sia la libreria statica, sia i relativi header files.
- Creare una cartella con il nome *Dependencies* nella root del progetto che conterrà tutte le dipendenze precedentemente elencate. Per ogni dipendenza va creata la cartella con il nome e che conterrà sia la libreria statica, sia i relativi header files.

Ad esempio:
Ad esempio:

```
Dependencies
Expand All @@ -33,14 +33,15 @@
│ │ headerfile2.h
│ │ ...
```
- Creare una cartella con il nome *build* nella root del progetto che conterrò tutti i file di build.
- Creare una cartella con il nome *build* nella root del progetto che conterrò tutti i file di build.
- Aprire il terminale, spostarsi nella cartella *build* ed eseguire il seguente comando:
*cmake ..*
cmake ..
- Eseguire il comando:
*cmake --build .*
cmake --build .
- Al termine della build eseguire il comando:
*cmake --install .*
cmake --install .
29 changes: 12 additions & 17 deletions cie_sign_sdk/src/CSP/ATR.cpp
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
#include "ATR.h"
#include <algorithm>


cie_atr atr_list[] = {
{CIE_Type::CIE_NXP, "NXP", { 0x80, 0x31, 0x80, 0x65, 0x49, 0x54, 0x4E, 0x58, 0x50, 0x12, 0x0F, 0xFF, 0x82, 0x90, 0xF0 }},
{CIE_Type::CIE_Gemalto, "Gemalto", { 0x80, 0x31, 0x80, 0x65, 0xB0, 0x85, 0x04, 0x00, 0x11 }},
{CIE_Type::CIE_Gemalto, "Gemalto2", {0x80, 0x31, 0x80, 0x65, 0xB0, 0x85, 0x03, 0x00, 0xEF }},
{CIE_Type::CIE_STM,"STM", {0x80, 0x66, 0x47, 0x50, 0x00, 0xB8, 0x00, 0x7F }},
{CIE_Type::CIE_STM2,"STM2", { 0x80, 0x80, 0x01, 0x01 }},
{CIE_Type::CIE_STM3,"STM3", {0x80, 0x01, 0x80, 0x66, 0x47, 0x50, 0x00, 0xB8, 0x00, 0x94, 0x82, 0x90, 0x00, 0xC5 }},
{CIE_Type::CIE_ACTALIS,"Actalis", {0x80, 0x01, 0x80, 0x31, 0x80, 0x65, 0x49, 0x54, 0x4a, 0x34, 0x41, 0x12, 0x0f, 0xff, 0x82, 0x90, 0x00, 0x88 }},
{CIE_Type::CIE_BIT4ID, "Bit4Id", {0x80, 0x01, 0x80, 0x31, 0x80, 0x65, 0x49, 0x54, 0x4a, 0x34, 0x42, 0x12, 0x0f, 0xff, 0x82, 0x90, 0x00, 0x8b }}
{CIE_Type::CIE_NXP, "NXP", { 0x80, 0x31, 0x80, 0x65, 0x49, 0x54, 0x4E, 0x58, 0x50 }},
{CIE_Type::CIE_Gemalto, "Gemalto", { 0x80, 0x31, 0x80, 0x65, 0xB0, 0x85, 0x04, 0x00, 0x11 }},
{CIE_Type::CIE_Gemalto, "Gemalto2", { 0x80, 0x31, 0x80, 0x65, 0xB0, 0x85, 0x03, 0x00, 0xEF }},
{CIE_Type::CIE_STM, "STM", { 0x80, 0x66, 0x47, 0x50, 0x00, 0xB8, 0x00, 0x7F }},
{CIE_Type::CIE_STM2, "STM2", { 0x80, 0x80, 0x01, 0x01 }},
{CIE_Type::CIE_STM3, "STM3", { 0x80, 0x01, 0x80, 0x66, 0x47, 0x50, 0x00, 0xB8, 0x00, 0x94, 0x82, 0x90, 0x00, 0xC5 }},
{CIE_Type::CIE_ACTALIS, "Actalis", { 0x80, 0x01, 0x80, 0x31, 0x80, 0x65, 0x49, 0x54, 0x4a, 0x34, 0x41, 0x12, 0x0f, 0xff, 0x82, 0x90, 0x00, 0x88 }},
{CIE_Type::CIE_BIT4ID, "Bit4Id", { 0x80, 0x01, 0x80, 0x31, 0x80, 0x65, 0x49, 0x54, 0x4a, 0x34, 0x42, 0x12, 0x0f, 0xff, 0x82, 0x90, 0x00, 0x8b }}
};


template <typename T>
bool IsSubset(std::vector<T> A, std::vector<T> B)
{
if (A.size() < B.size())
bool IsSubset(std::vector<T> A, std::vector<T> B) {
if (A.size() < B.size()) {
return false;
}

sort(A.begin(), A.end());
sort(B.begin(), B.end());
return includes(A.begin(), A.end(), B.begin(), B.end());
}

string get_manufacturer(vector<uint8_t> atr) {

for (cie_atr el : atr_list) {
if (IsSubset(atr, el.atr)) {
return el.type;
Expand All @@ -37,13 +34,11 @@ string get_manufacturer(vector<uint8_t> atr) {
}

CIE_Type get_type(vector<uint8_t> atr) {


for (cie_atr el : atr_list) {
if (IsSubset(atr, el.atr)) {
return el.cie_type;
}
}

return CIE_Type::CIE_Unknown;
}
}

0 comments on commit 8a3234a

Please sign in to comment.