/* * (C) 2025 Jack Lloyd * * Botan is released under the Simplified BSD License (see license.txt) */ #ifndef BOTAN_X509_UTILS_H_ #define BOTAN_X509_UTILS_H_ #include #include #include namespace Botan { inline std::optional is_sub_element_of(const OID& oid, std::initializer_list prefix) { const auto& c = oid.get_components(); if(c.size() != prefix.size() + 1) { return {}; } if(!std::equal(c.begin(), c.end() - 1, prefix.begin(), prefix.end())) { return {}; } return c[c.size() - 1]; } } // namespace Botan #endif