Next: , Previous: , Up: Programming Manual   [Contents][Index]


5.16 ASN.1 Functions

shishi_asn1_read_inline

Function: int shishi_asn1_read_inline (Shishi * handle, Shishi_asn1 node, const char * field, char * data, size_t * datalen)

handle: shishi handle as allocated by shishi_init().
node: ASN.1 variable to read field from.
field: name of field in node to read.
data: pre-allocated output buffer that will hold ASN.1 field data.
datalen: on input, maximum size of output buffer, on output, actual size of output buffer.

Description: Extract data stored in a ASN.1 field into a fixed size buffer allocated by caller.

Note that since it is difficult to predict the length of the field, it is often better to use shishi_asn1_read() instead.

Return value: Returns SHISHI_OK if successful, SHISHI_ASN1_NO_ELEMENT if the element do not exist, SHISHI_ASN1_NO_VALUE if the field has no value, ot SHISHI_ASN1_ERROR otherwise.

shishi_asn1_read

Function: int shishi_asn1_read (Shishi * handle, Shishi_asn1 node, const char * field, char ** data, size_t * datalen)

handle: shishi handle as allocated by shishi_init().
node: ASN.1 variable to read field from.
field: name of field in node to read.
data: newly allocated output buffer that will hold ASN.1 field data.
datalen: actual size of output buffer.

Description: Extract data stored in a ASN.1 field into a newly allocated buffer. The buffer will always be zero terminated, even though datalen will not include the added zero.

Return value: Returns SHISHI_OK if successful, SHISHI_ASN1_NO_ELEMENT if the element do not exist, SHISHI_ASN1_NO_VALUE if the field has no value, ot SHISHI_ASN1_ERROR otherwise.

shishi_asn1_read_optional

Function: int shishi_asn1_read_optional (Shishi * handle, Shishi_asn1 node, const char * field, char ** data, size_t * datalen)

handle: shishi handle as allocated by shishi_init().
node: ASN.1 variable to read field from.
field: name of field in node to read.
data: newly allocated output buffer that will hold ASN.1 field data.
datalen: actual size of output buffer.

Description: Extract data stored in a ASN.1 field into a newly allocated buffer. If the field does not exist (i.e., SHISHI_ASN1_NO_ELEMENT), this function set datalen to 0 and succeeds. Can be useful to read ASN.1 fields which are marked OPTIONAL in the grammar, if you want to avoid special error handling in your code.

Return value: Returns SHISHI_OK if successful, SHISHI_ASN1_NO_VALUE if the field has no value, ot SHISHI_ASN1_ERROR otherwise.

shishi_asn1_done

Function: void shishi_asn1_done (Shishi * handle, Shishi_asn1 node)

handle: shishi handle as allocated by shishi_init().
node: ASN.1 node to deallocate.

Description: Deallocate resources associated with ASN.1 structure. Note that the node must not be used after this call.

shishi_asn1_pa_enc_ts_enc

Function: Shishi_asn1 shishi_asn1_pa_enc_ts_enc (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for PA-ENC-TS-ENC.

Return value: Returns ASN.1 structure.

shishi_asn1_encrypteddata

Function: Shishi_asn1 shishi_asn1_encrypteddata (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for EncryptedData

Return value: Returns ASN.1 structure.

shishi_asn1_padata

Function: Shishi_asn1 shishi_asn1_padata (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for PA-DATA.

Return value: Returns ASN.1 structure.

shishi_asn1_methoddata

Function: Shishi_asn1 shishi_asn1_methoddata (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for METHOD-DATA.

Return value: Returns ASN.1 structure.

shishi_asn1_etype_info

Function: Shishi_asn1 shishi_asn1_etype_info (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for ETYPE-INFO.

Return value: Returns ASN.1 structure.

shishi_asn1_etype_info2

Function: Shishi_asn1 shishi_asn1_etype_info2 (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for ETYPE-INFO2.

Return value: Returns ASN.1 structure.

shishi_asn1_asreq

Function: Shishi_asn1 shishi_asn1_asreq (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for AS-REQ.

Return value: Returns ASN.1 structure.

shishi_asn1_asrep

Function: Shishi_asn1 shishi_asn1_asrep (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for AS-REP.

Return value: Returns ASN.1 structure.

shishi_asn1_tgsreq

Function: Shishi_asn1 shishi_asn1_tgsreq (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for TGS-REQ.

Return value: Returns ASN.1 structure.

shishi_asn1_tgsrep

Function: Shishi_asn1 shishi_asn1_tgsrep (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for TGS-REP.

Return value: Returns ASN.1 structure.

shishi_asn1_apreq

Function: Shishi_asn1 shishi_asn1_apreq (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for AP-REQ.

Return value: Returns ASN.1 structure.

shishi_asn1_aprep

Function: Shishi_asn1 shishi_asn1_aprep (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for AP-REP.

Return value: Returns ASN.1 structure.

shishi_asn1_encapreppart

Function: Shishi_asn1 shishi_asn1_encapreppart (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for AP-REP.

Return value: Returns ASN.1 structure.

shishi_asn1_ticket

Function: Shishi_asn1 shishi_asn1_ticket (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for Ticket.

Return value: Returns ASN.1 structure.

shishi_asn1_encticketpart

Function: Shishi_asn1 shishi_asn1_encticketpart (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for EncTicketPart.

Return value: Returns ASN.1 structure.

shishi_asn1_authenticator

Function: Shishi_asn1 shishi_asn1_authenticator (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for Authenticator.

Return value: Returns ASN.1 structure.

shishi_asn1_enckdcreppart

Function: Shishi_asn1 shishi_asn1_enckdcreppart (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for EncKDCRepPart.

Return value: Returns ASN.1 structure.

shishi_asn1_encasreppart

Function: Shishi_asn1 shishi_asn1_encasreppart (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for EncASRepPart.

Return value: Returns ASN.1 structure.

shishi_asn1_krberror

Function: Shishi_asn1 shishi_asn1_krberror (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for KRB-ERROR.

Return value: Returns ASN.1 structure.

shishi_asn1_krbsafe

Function: Shishi_asn1 shishi_asn1_krbsafe (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for KRB-SAFE.

Return value: Returns ASN.1 structure.

shishi_asn1_priv

Function: Shishi_asn1 shishi_asn1_priv (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for KRB-PRIV.

Return value: Returns ASN.1 structure.

shishi_asn1_encprivpart

Function: Shishi_asn1 shishi_asn1_encprivpart (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Create new ASN.1 structure for EncKrbPrivPart.

Return value: Returns ASN.1 structure.

shishi_asn1_to_der_field

Function: int shishi_asn1_to_der_field (Shishi * handle, Shishi_asn1 node, const char * field, char ** der, size_t * len)

handle: shishi handle as allocated by shishi_init().
node: ASN.1 data that have field to extract.
field: name of field in node to extract.
der: output array that holds DER encoding of field in node.
len: output variable with length of der output array.

Description: Extract newly allocated DER representation of specified ASN.1 field.

Return value: Returns SHISHI_OK if successful, or SHISHI_ASN1_ERROR if DER encoding fails (common reasons for this is that the ASN.1 is missing required values).

shishi_asn1_to_der

Function: int shishi_asn1_to_der (Shishi * handle, Shishi_asn1 node, char ** der, size_t * len)

handle: shishi handle as allocated by shishi_init().
node: ASN.1 data to convert to DER.
der: output array that holds DER encoding of node.
len: output variable with length of der output array.

Description: Extract newly allocated DER representation of specified ASN.1 data.

Return value: Returns SHISHI_OK if successful, or SHISHI_ASN1_ERROR if DER encoding fails (common reasons for this is that the ASN.1 is missing required values).

shishi_asn1_msgtype

Function: Shishi_msgtype shishi_asn1_msgtype (Shishi * handle, Shishi_asn1 node)

handle: shishi handle as allocated by shishi_init().
node: ASN.1 type to get msg type for.

Description: Determine msg-type of ASN.1 type of a packet. Currently this uses the msg-type field instead of the APPLICATION tag, but this may be changed in the future.

Return value: Returns msg-type of ASN.1 type, 0 on failure.

shishi_der_msgtype

Function: Shishi_msgtype shishi_der_msgtype (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Determine msg-type of DER coded data of a packet.

Return value: Returns msg-type of DER data, 0 on failure.

shishi_der2asn1

Function: Shishi_asn1 shishi_der2asn1 (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Convert arbitrary DER data of a packet to a ASN.1 type.

Return value: Returns newly allocate ASN.1 corresponding to DER data, or NULL on failure.

shishi_der2asn1_padata

Function: Shishi_asn1 shishi_der2asn1_padata (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of PA-DATA and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_methoddata

Function: Shishi_asn1 shishi_der2asn1_methoddata (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of METHOD-DATA and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_etype_info

Function: Shishi_asn1 shishi_der2asn1_etype_info (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of ETYPE-INFO and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_etype_info2

Function: Shishi_asn1 shishi_der2asn1_etype_info2 (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of ETYPE-INFO2 and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_ticket

Function: Shishi_asn1 shishi_der2asn1_ticket (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of Ticket and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_encticketpart

Function: Shishi_asn1 shishi_der2asn1_encticketpart (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of EncTicketPart and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_asreq

Function: Shishi_asn1 shishi_der2asn1_asreq (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of AS-REQ and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_tgsreq

Function: Shishi_asn1 shishi_der2asn1_tgsreq (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of TGS-REQ and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_asrep

Function: Shishi_asn1 shishi_der2asn1_asrep (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of AS-REP and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_tgsrep

Function: Shishi_asn1 shishi_der2asn1_tgsrep (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of TGS-REP and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_kdcrep

Function: Shishi_asn1 shishi_der2asn1_kdcrep (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of KDC-REP and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_encasreppart

Function: Shishi_asn1 shishi_der2asn1_encasreppart (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of EncASRepPart and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_enctgsreppart

Function: Shishi_asn1 shishi_der2asn1_enctgsreppart (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of EncTGSRepPart and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_enckdcreppart

Function: Shishi_asn1 shishi_der2asn1_enckdcreppart (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of EncKDCRepPart and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_authenticator

Function: Shishi_asn1 shishi_der2asn1_authenticator (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of Authenticator and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_krberror

Function: Shishi_asn1 shishi_der2asn1_krberror (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of KRB-ERROR and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_krbsafe

Function: Shishi_asn1 shishi_der2asn1_krbsafe (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of KRB-SAFE and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_priv

Function: Shishi_asn1 shishi_der2asn1_priv (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of KRB-PRIV and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_encprivpart

Function: Shishi_asn1 shishi_der2asn1_encprivpart (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of EncKrbPrivPart and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_apreq

Function: Shishi_asn1 shishi_der2asn1_apreq (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of AP-REQ and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_aprep

Function: Shishi_asn1 shishi_der2asn1_aprep (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of AP-REP and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_encapreppart

Function: Shishi_asn1 shishi_der2asn1_encapreppart (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of EncAPRepPart and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_der2asn1_kdcreq

Function: Shishi_asn1 shishi_der2asn1_kdcreq (Shishi * handle, const char * der, size_t derlen)

handle: shishi handle as allocated by shishi_init().
der: input character array with DER encoding.
derlen: length of input character array with DER encoding.

Description: Decode DER encoding of AS-REQ, TGS-REQ or KDC-REQ and create a ASN.1 structure.

Return value: Returns ASN.1 structure corresponding to DER data.

shishi_asn1_print

Function: void shishi_asn1_print (Shishi * handle, Shishi_asn1 node, FILE * fh)

handle: shishi handle as allocated by shishi_init().
node: ASN.1 data that have field to extract.
fh: file descriptor to print to, e.g. stdout.

Description: Print ASN.1 structure in human readable form, typically for debugging purposes.


Next: , Previous: , Up: Programming Manual   [Contents][Index]