|
pure virtual |
Copy an octet string (binary array) from pBuffer into the P6R's defined "P6ASN1OCTET" type.
This function handles all length details and once successfully done moves the index parameter to the start of the next type in pBuffer.
It is the caller's responsibility to make sure that the value P6ASN1OCTET parameter has a sufficiently large byte buffer (value.pBytes) to hold the OCTET STRING at "pBuffer[ index ]". The caller can determine how big the buffer must be by setting value.pBytes to NULL. The required length will be returned in the parameter value.length. ** Determining the length of the OCTET STRING 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 OCTET STRING. 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 OCTET STRING.
pBuffer | [ in ] Byte array containg the ASN.1 encoded data to decode |
bufSize | [ in ] the amount of data (in bytes) pointed to by pBuffer |
index | [ 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 |
value | [ out ] An octet string of length zero is legal and supported |
Success | P6R::eOk | |
Failure | P6R::eNotInitialized | A successful call to initialize was not made before this call. |
P6R::eTooBig | value.pBytes is too small to hold the OCTET STRING | |
P6R::eInvalidArg | pBuffer is set to NULL. | |
errors from decodeLength() | This function calls decodeLength. |