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