diff options
Diffstat (limited to 'src/lib/asn1/oids.h')
-rw-r--r-- | src/lib/asn1/oids.h | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/src/lib/asn1/oids.h b/src/lib/asn1/oids.h index 7b87b5eaf..480e4f982 100644 --- a/src/lib/asn1/oids.h +++ b/src/lib/asn1/oids.h @@ -33,9 +33,9 @@ std::unordered_map<std::string, OID> load_str2oid_map(); /** * Resolve an OID * @param oid the OID to look up -* @return name associated with this OID +* @return name associated with this OID, or an empty string */ -BOTAN_PUBLIC_API(2,0) std::string lookup(const OID& oid); +BOTAN_UNSTABLE_API std::string oid2str_or_empty(const OID& oid); /** * Find the OID to a name. The lookup will be performed in the @@ -43,24 +43,16 @@ BOTAN_PUBLIC_API(2,0) std::string lookup(const OID& oid); * @param name the name to resolve * @return OID associated with the specified name */ -BOTAN_PUBLIC_API(2,0) OID lookup(const std::string& name); +BOTAN_UNSTABLE_API OID str2oid_or_empty(const std::string& name); -inline std::string oid2str(const OID& oid) - { - return lookup(oid); - } - -inline OID str2oid(const std::string& name) - { - return lookup(name); - } +BOTAN_UNSTABLE_API std::string oid2str_or_throw(const OID& oid); /** * See if an OID exists in the internal table. * @param oid the oid to check for * @return true if the oid is registered */ -BOTAN_UNSTABLE_API bool have_oid(const std::string& oid); +BOTAN_UNSTABLE_API bool BOTAN_DEPRECATED("Just lookup the value instead") have_oid(const std::string& oid); /** * Tests whether the specified OID stands for the specified name. @@ -68,7 +60,31 @@ BOTAN_UNSTABLE_API bool have_oid(const std::string& oid); * @param name the name to check * @return true if the specified OID stands for the specified name */ -BOTAN_UNSTABLE_API bool name_of(const OID& oid, const std::string& name); +inline bool BOTAN_DEPRECATED("Use oid == OID::from_string(name)") name_of(const OID& oid, const std::string& name) + { + return (oid == str2oid_or_empty(name)); + } + +inline std::string BOTAN_DEPRECATED("Use oid2str_or_empty") lookup(const OID& oid) + { + return oid2str_or_empty(oid); + } + +inline OID BOTAN_DEPRECATED("Use str2oid_or_empty") lookup(const std::string& name) + { + return str2oid_or_empty(name); + } + +inline std::string BOTAN_DEPRECATED("Use oid2str_or_empty") oid2str(const OID& oid) + { + return oid2str_or_empty(oid); + } + +inline OID BOTAN_DEPRECATED("Use str2oid_or_empty") str2oid(const std::string& name) + { + return str2oid_or_empty(name); + } + } } |