1*40e9b92eSEd Tanous // SPDX-License-Identifier: Apache-2.0 2*40e9b92eSEd 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, 150ec8b83dSEd Tanous }; 160ec8b83dSEd Tanous 170ec8b83dSEd Tanous enum class KeyUsage{ 180ec8b83dSEd Tanous Invalid, 190ec8b83dSEd Tanous DigitalSignature, 200ec8b83dSEd Tanous NonRepudiation, 210ec8b83dSEd Tanous KeyEncipherment, 220ec8b83dSEd Tanous DataEncipherment, 230ec8b83dSEd Tanous KeyAgreement, 240ec8b83dSEd Tanous KeyCertSign, 250ec8b83dSEd Tanous CRLSigning, 260ec8b83dSEd Tanous EncipherOnly, 270ec8b83dSEd Tanous DecipherOnly, 280ec8b83dSEd Tanous ServerAuthentication, 290ec8b83dSEd Tanous ClientAuthentication, 300ec8b83dSEd Tanous CodeSigning, 310ec8b83dSEd Tanous EmailProtection, 320ec8b83dSEd Tanous Timestamping, 330ec8b83dSEd Tanous OCSPSigning, 340ec8b83dSEd Tanous }; 350ec8b83dSEd Tanous 360ec8b83dSEd Tanous enum class CertificateUsageType{ 370ec8b83dSEd Tanous Invalid, 380ec8b83dSEd Tanous User, 390ec8b83dSEd Tanous Web, 400ec8b83dSEd Tanous SSH, 410ec8b83dSEd Tanous Device, 420ec8b83dSEd Tanous Platform, 430ec8b83dSEd Tanous BIOS, 44e9cc1bc9SEd Tanous IDevID, 45e9cc1bc9SEd Tanous LDevID, 46e9cc1bc9SEd Tanous IAK, 47e9cc1bc9SEd Tanous LAK, 48dd5c81e9SGunnar Mills EK, 490ec8b83dSEd Tanous }; 500ec8b83dSEd Tanous 510ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(CertificateType, { 520ec8b83dSEd Tanous {CertificateType::Invalid, "Invalid"}, 530ec8b83dSEd Tanous {CertificateType::PEM, "PEM"}, 540ec8b83dSEd Tanous {CertificateType::PEMchain, "PEMchain"}, 550ec8b83dSEd Tanous {CertificateType::PKCS7, "PKCS7"}, 560ec8b83dSEd Tanous }); 570ec8b83dSEd Tanous 580ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(KeyUsage, { 590ec8b83dSEd Tanous {KeyUsage::Invalid, "Invalid"}, 600ec8b83dSEd Tanous {KeyUsage::DigitalSignature, "DigitalSignature"}, 610ec8b83dSEd Tanous {KeyUsage::NonRepudiation, "NonRepudiation"}, 620ec8b83dSEd Tanous {KeyUsage::KeyEncipherment, "KeyEncipherment"}, 630ec8b83dSEd Tanous {KeyUsage::DataEncipherment, "DataEncipherment"}, 640ec8b83dSEd Tanous {KeyUsage::KeyAgreement, "KeyAgreement"}, 650ec8b83dSEd Tanous {KeyUsage::KeyCertSign, "KeyCertSign"}, 660ec8b83dSEd Tanous {KeyUsage::CRLSigning, "CRLSigning"}, 670ec8b83dSEd Tanous {KeyUsage::EncipherOnly, "EncipherOnly"}, 680ec8b83dSEd Tanous {KeyUsage::DecipherOnly, "DecipherOnly"}, 690ec8b83dSEd Tanous {KeyUsage::ServerAuthentication, "ServerAuthentication"}, 700ec8b83dSEd Tanous {KeyUsage::ClientAuthentication, "ClientAuthentication"}, 710ec8b83dSEd Tanous {KeyUsage::CodeSigning, "CodeSigning"}, 720ec8b83dSEd Tanous {KeyUsage::EmailProtection, "EmailProtection"}, 730ec8b83dSEd Tanous {KeyUsage::Timestamping, "Timestamping"}, 740ec8b83dSEd Tanous {KeyUsage::OCSPSigning, "OCSPSigning"}, 750ec8b83dSEd Tanous }); 760ec8b83dSEd Tanous 770ec8b83dSEd Tanous NLOHMANN_JSON_SERIALIZE_ENUM(CertificateUsageType, { 780ec8b83dSEd Tanous {CertificateUsageType::Invalid, "Invalid"}, 790ec8b83dSEd Tanous {CertificateUsageType::User, "User"}, 800ec8b83dSEd Tanous {CertificateUsageType::Web, "Web"}, 810ec8b83dSEd Tanous {CertificateUsageType::SSH, "SSH"}, 820ec8b83dSEd Tanous {CertificateUsageType::Device, "Device"}, 830ec8b83dSEd Tanous {CertificateUsageType::Platform, "Platform"}, 840ec8b83dSEd Tanous {CertificateUsageType::BIOS, "BIOS"}, 85e9cc1bc9SEd Tanous {CertificateUsageType::IDevID, "IDevID"}, 86e9cc1bc9SEd Tanous {CertificateUsageType::LDevID, "LDevID"}, 87e9cc1bc9SEd Tanous {CertificateUsageType::IAK, "IAK"}, 88e9cc1bc9SEd Tanous {CertificateUsageType::LAK, "LAK"}, 89dd5c81e9SGunnar Mills {CertificateUsageType::EK, "EK"}, 900ec8b83dSEd Tanous }); 910ec8b83dSEd Tanous 920ec8b83dSEd Tanous } 930ec8b83dSEd Tanous // clang-format on 94