GSS-API Programming Guide

gss_str_to_oid()

For backward compatibility with earlier versions of the GSS-API, this implementation of the GSS-API supports the function gss_str_to_oid(). gss_str_to_oid() converts a string representing a mechanism or QOP (either as a number or a word) to an OID.


Caution – Caution –

gss_str_to_oid(), gss_oid_to_str(), and gss_release_oid() are not supported by some implementations of the GSS-API in order to discourage the use of explicit, non-default mechanisms and QOPs.


The string can be hard-coded in the application, or come from user input. However, not all implementations of the GSS-API support this function, so applications shouldn't rely on it.

Note that the number representing a mechanism can have two different formats. The first


{ 1 2 3 4 }


is officially mandated by the GSS-API specifications, while the second:

1.2.3.4


is more widely used but is not an official standard format. gss_str_to_oid() expects the mechanism number in the first format, so you must convert the string if it's in the second format before calling gss_str_to_oid(). An example of this is shown in parse_oid(). If the mechanism is not a valid one, gss_str_to_oid() returns GSS_S_BAD_MECH.

Because gss_str_to_oid() allocates GSS-API dataspace, the gss_release_oid() function exists, to remove the allocated OID when you've finished with it. Like gss_str_to_oid(), gss_release_oid() is not a generally supported function and should not be relied upon in programs that aspire to universal portability.