This function converts a BER encoded OBJECT IDENTIFER (OID) into its narrow string representation (e.g., 2.6.6.247.1)
It is the caller's responsibility to make sure that the pOID parameter has a sufficiently large character string to hold the OID at "pBuffer[ index ]". The caller can determine how big the string must be by setting the parameter pOID to NULL. The required length will be returned in the parameter "oidSize". Determining the length of the OID will not result in a change to the index parameter (thus allowing a second call to extract the string).
NOTE, that "pBuffer[ index ]" MUST point to the start of the length field of the OID. That is the tag associated with the ASN.1 type should have already been processed by the caller and skipped. This function does not understand BER tags, but assumes that the caller does and has positioned pBuffer[ index ] to decode the length and value of the OID.
- Parameters
-
pBuffer | [ in ] Byte array containg the ASN.1 encoded data to decode |
bufSize | [ in ] the amount of data (in bytes) pointed to by pBuffer |
pIndex | [ in ] current offset into pBuffer, should be pointing to the length field of an integer tagged value [ out ] this index moves down the pBuffer data as the data is decoded |
pOID | [ in out ] Narrow string buffer that the text eqivalent of the binary OID is copied to. If set to NULL, then oidSize returns the size that pOID buffer is required for decode to work properly. |
pOidSize | [ in ] the size (in bytes) of pOID, [ out ] can be the required size of pOID buffer. |
- Returns
Success | P6R::eOk | |
Failure | P6R::eNotInitialized | A successful call to initialize was not made before this call. |
P6R::eInvalidArg | One of the parameters is NULL. |
P6R::eTooBig | One of the OID's numbers is too large (greater than 32767 - 2 octets to encode) |
errors from decodeLength() | This function calls decodeLength. |