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