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 };
47 
48 NLOHMANN_JSON_SERIALIZE_ENUM(CertificateType, {
49     {CertificateType::Invalid, "Invalid"},
50     {CertificateType::PEM, "PEM"},
51     {CertificateType::PEMchain, "PEMchain"},
52     {CertificateType::PKCS7, "PKCS7"},
53 });
54 
55 NLOHMANN_JSON_SERIALIZE_ENUM(KeyUsage, {
56     {KeyUsage::Invalid, "Invalid"},
57     {KeyUsage::DigitalSignature, "DigitalSignature"},
58     {KeyUsage::NonRepudiation, "NonRepudiation"},
59     {KeyUsage::KeyEncipherment, "KeyEncipherment"},
60     {KeyUsage::DataEncipherment, "DataEncipherment"},
61     {KeyUsage::KeyAgreement, "KeyAgreement"},
62     {KeyUsage::KeyCertSign, "KeyCertSign"},
63     {KeyUsage::CRLSigning, "CRLSigning"},
64     {KeyUsage::EncipherOnly, "EncipherOnly"},
65     {KeyUsage::DecipherOnly, "DecipherOnly"},
66     {KeyUsage::ServerAuthentication, "ServerAuthentication"},
67     {KeyUsage::ClientAuthentication, "ClientAuthentication"},
68     {KeyUsage::CodeSigning, "CodeSigning"},
69     {KeyUsage::EmailProtection, "EmailProtection"},
70     {KeyUsage::Timestamping, "Timestamping"},
71     {KeyUsage::OCSPSigning, "OCSPSigning"},
72 });
73 
74 NLOHMANN_JSON_SERIALIZE_ENUM(CertificateUsageType, {
75     {CertificateUsageType::Invalid, "Invalid"},
76     {CertificateUsageType::User, "User"},
77     {CertificateUsageType::Web, "Web"},
78     {CertificateUsageType::SSH, "SSH"},
79     {CertificateUsageType::Device, "Device"},
80     {CertificateUsageType::Platform, "Platform"},
81     {CertificateUsageType::BIOS, "BIOS"},
82     {CertificateUsageType::IDevID, "IDevID"},
83     {CertificateUsageType::LDevID, "LDevID"},
84     {CertificateUsageType::IAK, "IAK"},
85     {CertificateUsageType::LAK, "LAK"},
86 });
87 
88 }
89 // clang-format on
90