140e9b92eSEd Tanous // SPDX-License-Identifier: Apache-2.0 240e9b92eSEd Tanous // SPDX-FileCopyrightText: Copyright OpenBMC Authors 30ec8b83dSEd Tanous #pragma once 40ec8b83dSEd Tanous #include <nlohmann/json.hpp> 50ec8b83dSEd Tanous 60ec8b83dSEd Tanous namespace certificate 70ec8b83dSEd Tanous { 80ec8b83dSEd Tanous // clang-format off 90ec8b83dSEd Tanous 100ec8b83dSEd Tanous enum class CertificateType{ 110ec8b83dSEd Tanous Invalid, 120ec8b83dSEd Tanous PEM, 130ec8b83dSEd Tanous PEMchain, 140ec8b83dSEd Tanous PKCS7, 15*c6d7a45dSGunnar Mills PKCS12, 160ec8b83dSEd Tanous }; 170ec8b83dSEd Tanous 180ec8b83dSEd Tanous enum class KeyUsage{ 190ec8b83dSEd Tanous Invalid, 200ec8b83dSEd Tanous DigitalSignature, 210ec8b83dSEd Tanous NonRepudiation, 220ec8b83dSEd Tanous KeyEncipherment, 230ec8b83dSEd Tanous DataEncipherment, 240ec8b83dSEd Tanous KeyAgreement, 250ec8b83dSEd Tanous KeyCertSign, 260ec8b83dSEd Tanous CRLSigning, 270ec8b83dSEd Tanous EncipherOnly, 280ec8b83dSEd Tanous DecipherOnly, 290ec8b83dSEd Tanous ServerAuthentication, 300ec8b83dSEd Tanous ClientAuthentication, 310ec8b83dSEd Tanous CodeSigning, 320ec8b83dSEd Tanous EmailProtection, 330ec8b83dSEd Tanous Timestamping, 340ec8b83dSEd Tanous OCSPSigning, 350ec8b83dSEd Tanous }; 360ec8b83dSEd Tanous 370ec8b83dSEd Tanous enum class CertificateUsageType{ 380ec8b83dSEd Tanous Invalid, 390ec8b83dSEd Tanous User, 400ec8b83dSEd Tanous Web, 410ec8b83dSEd Tanous SSH, 420ec8b83dSEd Tanous Device, 430ec8b83dSEd Tanous Platform, 440ec8b83dSEd Tanous BIOS, 45e9cc1bc9SEd Tanous IDevID, 46e9cc1bc9SEd Tanous LDevID, 47e9cc1bc9SEd Tanous IAK, 48e9cc1bc9SEd Tanous LAK, 49dd5c81e9SGunnar Mills EK, 500ec8b83dSEd Tanous }; 510ec8b83dSEd Tanous 520ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(CertificateType, { 530ec8b83dSEd Tanous {CertificateType::Invalid, "Invalid"}, 540ec8b83dSEd Tanous {CertificateType::PEM, "PEM"}, 550ec8b83dSEd Tanous {CertificateType::PEMchain, "PEMchain"}, 560ec8b83dSEd Tanous {CertificateType::PKCS7, "PKCS7"}, 57*c6d7a45dSGunnar Mills {CertificateType::PKCS12, "PKCS12"}, 580ec8b83dSEd Tanous }); 590ec8b83dSEd Tanous 600ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(KeyUsage, { 610ec8b83dSEd Tanous {KeyUsage::Invalid, "Invalid"}, 620ec8b83dSEd Tanous {KeyUsage::DigitalSignature, "DigitalSignature"}, 630ec8b83dSEd Tanous {KeyUsage::NonRepudiation, "NonRepudiation"}, 640ec8b83dSEd Tanous {KeyUsage::KeyEncipherment, "KeyEncipherment"}, 650ec8b83dSEd Tanous {KeyUsage::DataEncipherment, "DataEncipherment"}, 660ec8b83dSEd Tanous {KeyUsage::KeyAgreement, "KeyAgreement"}, 670ec8b83dSEd Tanous {KeyUsage::KeyCertSign, "KeyCertSign"}, 680ec8b83dSEd Tanous {KeyUsage::CRLSigning, "CRLSigning"}, 690ec8b83dSEd Tanous {KeyUsage::EncipherOnly, "EncipherOnly"}, 700ec8b83dSEd Tanous {KeyUsage::DecipherOnly, "DecipherOnly"}, 710ec8b83dSEd Tanous {KeyUsage::ServerAuthentication, "ServerAuthentication"}, 720ec8b83dSEd Tanous {KeyUsage::ClientAuthentication, "ClientAuthentication"}, 730ec8b83dSEd Tanous {KeyUsage::CodeSigning, "CodeSigning"}, 740ec8b83dSEd Tanous {KeyUsage::EmailProtection, "EmailProtection"}, 750ec8b83dSEd Tanous {KeyUsage::Timestamping, "Timestamping"}, 760ec8b83dSEd Tanous {KeyUsage::OCSPSigning, "OCSPSigning"}, 770ec8b83dSEd Tanous }); 780ec8b83dSEd Tanous 790ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(CertificateUsageType, { 800ec8b83dSEd Tanous {CertificateUsageType::Invalid, "Invalid"}, 810ec8b83dSEd Tanous {CertificateUsageType::User, "User"}, 820ec8b83dSEd Tanous {CertificateUsageType::Web, "Web"}, 830ec8b83dSEd Tanous {CertificateUsageType::SSH, "SSH"}, 840ec8b83dSEd Tanous {CertificateUsageType::Device, "Device"}, 850ec8b83dSEd Tanous {CertificateUsageType::Platform, "Platform"}, 860ec8b83dSEd Tanous {CertificateUsageType::BIOS, "BIOS"}, 87e9cc1bc9SEd Tanous {CertificateUsageType::IDevID, "IDevID"}, 88e9cc1bc9SEd Tanous {CertificateUsageType::LDevID, "LDevID"}, 89e9cc1bc9SEd Tanous {CertificateUsageType::IAK, "IAK"}, 90e9cc1bc9SEd Tanous {CertificateUsageType::LAK, "LAK"}, 91dd5c81e9SGunnar Mills {CertificateUsageType::EK, "EK"}, 920ec8b83dSEd Tanous }); 930ec8b83dSEd Tanous 940ec8b83dSEd Tanous } 950ec8b83dSEd Tanous // clang-format on 96