1 #pragma once
2 #include <nlohmann/json.hpp>
3 
4 namespace certificate
5 {
6 // clang-format off
7 
8 enum class CertificateType{
9     Invalid,
10     PEM,
11     PEMchain,
12     PKCS7,
13 };
14 
15 enum class KeyUsage{
16     Invalid,
17     DigitalSignature,
18     NonRepudiation,
19     KeyEncipherment,
20     DataEncipherment,
21     KeyAgreement,
22     KeyCertSign,
23     CRLSigning,
24     EncipherOnly,
25     DecipherOnly,
26     ServerAuthentication,
27     ClientAuthentication,
28     CodeSigning,
29     EmailProtection,
30     Timestamping,
31     OCSPSigning,
32 };
33 
34 enum class CertificateUsageType{
35     Invalid,
36     User,
37     Web,
38     SSH,
39     Device,
40     Platform,
41     BIOS,
42     IDevID,
43     LDevID,
44     IAK,
45     LAK,
46     EK,
47 };
48 
49 NLOHMANN_JSON_SERIALIZE_ENUM(CertificateType, {
50     {CertificateType::Invalid, "Invalid"},
51     {CertificateType::PEM, "PEM"},
52     {CertificateType::PEMchain, "PEMchain"},
53     {CertificateType::PKCS7, "PKCS7"},
54 });
55 
56 NLOHMANN_JSON_SERIALIZE_ENUM(KeyUsage, {
57     {KeyUsage::Invalid, "Invalid"},
58     {KeyUsage::DigitalSignature, "DigitalSignature"},
59     {KeyUsage::NonRepudiation, "NonRepudiation"},
60     {KeyUsage::KeyEncipherment, "KeyEncipherment"},
61     {KeyUsage::DataEncipherment, "DataEncipherment"},
62     {KeyUsage::KeyAgreement, "KeyAgreement"},
63     {KeyUsage::KeyCertSign, "KeyCertSign"},
64     {KeyUsage::CRLSigning, "CRLSigning"},
65     {KeyUsage::EncipherOnly, "EncipherOnly"},
66     {KeyUsage::DecipherOnly, "DecipherOnly"},
67     {KeyUsage::ServerAuthentication, "ServerAuthentication"},
68     {KeyUsage::ClientAuthentication, "ClientAuthentication"},
69     {KeyUsage::CodeSigning, "CodeSigning"},
70     {KeyUsage::EmailProtection, "EmailProtection"},
71     {KeyUsage::Timestamping, "Timestamping"},
72     {KeyUsage::OCSPSigning, "OCSPSigning"},
73 });
74 
75 NLOHMANN_JSON_SERIALIZE_ENUM(CertificateUsageType, {
76     {CertificateUsageType::Invalid, "Invalid"},
77     {CertificateUsageType::User, "User"},
78     {CertificateUsageType::Web, "Web"},
79     {CertificateUsageType::SSH, "SSH"},
80     {CertificateUsageType::Device, "Device"},
81     {CertificateUsageType::Platform, "Platform"},
82     {CertificateUsageType::BIOS, "BIOS"},
83     {CertificateUsageType::IDevID, "IDevID"},
84     {CertificateUsageType::LDevID, "LDevID"},
85     {CertificateUsageType::IAK, "IAK"},
86     {CertificateUsageType::LAK, "LAK"},
87     {CertificateUsageType::EK, "EK"},
88 });
89 
90 }
91 // clang-format on
92