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