#include <stdio.h>
#include <sys/types.h>
#include <time.h>
Go to the source code of this file.
Data Structures | |
struct | node_asn_struct |
struct | static_struct_asn |
Defines | |
#define | LIBTASN1_VERSION "1.2" |
#define | MAX_NAME_SIZE 128 |
#define | MAX_ERROR_DESCRIPTION_SIZE 128 |
#define | ASN1_SUCCESS 0 |
#define | ASN1_FILE_NOT_FOUND 1 |
#define | ASN1_ELEMENT_NOT_FOUND 2 |
#define | ASN1_IDENTIFIER_NOT_FOUND 3 |
#define | ASN1_DER_ERROR 4 |
#define | ASN1_VALUE_NOT_FOUND 5 |
#define | ASN1_GENERIC_ERROR 6 |
#define | ASN1_VALUE_NOT_VALID 7 |
#define | ASN1_TAG_ERROR 8 |
#define | ASN1_TAG_IMPLICIT 9 |
#define | ASN1_ERROR_TYPE_ANY 10 |
#define | ASN1_SYNTAX_ERROR 11 |
#define | ASN1_MEM_ERROR 12 |
#define | ASN1_MEM_ALLOC_ERROR 13 |
#define | ASN1_DER_OVERFLOW 14 |
#define | ASN1_NAME_TOO_LONG 15 |
#define | ASN1_ARRAY_ERROR 16 |
#define | ASN1_ELEMENT_NOT_EMPTY 17 |
#define | ASN1_PRINT_NAME 1 |
#define | ASN1_PRINT_NAME_TYPE 2 |
#define | ASN1_PRINT_NAME_TYPE_VALUE 3 |
#define | ASN1_PRINT_ALL 4 |
#define | ASN1_CLASS_UNIVERSAL 0x00 |
#define | ASN1_CLASS_APPLICATION 0x40 |
#define | ASN1_CLASS_CONTEXT_SPECIFIC 0x80 |
#define | ASN1_CLASS_PRIVATE 0xC0 |
#define | ASN1_CLASS_STRUCTURED 0x20 |
#define | ASN1_TAG_BOOLEAN 0x01 |
#define | ASN1_TAG_INTEGER 0x02 |
#define | ASN1_TAG_SEQUENCE 0x10 |
#define | ASN1_TAG_SET 0x11 |
#define | ASN1_TAG_OCTET_STRING 0x04 |
#define | ASN1_TAG_BIT_STRING 0x03 |
#define | ASN1_TAG_UTCTime 0x17 |
#define | ASN1_TAG_GENERALIZEDTime 0x18 |
#define | ASN1_TAG_OBJECT_ID 0x06 |
#define | ASN1_TAG_ENUMERATED 0x0A |
#define | ASN1_TAG_NULL 0x05 |
#define | ASN1_TAG_GENERALSTRING 0x1B |
#define | ASN1_TYPE_EMPTY NULL |
Typedefs | |
typedef int | MHD__asn1_retCode |
typedef struct node_asn_struct | node_asn |
typedef node_asn * | ASN1_TYPE |
typedef struct static_struct_asn | ASN1_ARRAY_TYPE |
Functions | |
MHD__asn1_retCode | MHD__asn1_parser2tree (const char *file_name, ASN1_TYPE *definitions, char *errorDescription) |
MHD__asn1_retCode | MHD__asn1_parser2array (const char *inputFileName, const char *outputFileName, const char *vectorName, char *errorDescription) |
MHD__asn1_retCode | MHD__asn1_array2tree (const ASN1_ARRAY_TYPE *array, ASN1_TYPE *definitions, char *errorDescription) |
MHD__asn1_retCode | MHD__asn1_create_element (ASN1_TYPE definitions, const char *source_name, ASN1_TYPE *element) |
MHD__asn1_retCode | MHD__asn1_delete_structure (ASN1_TYPE *structure) |
MHD__asn1_retCode | MHD__asn1_write_value (ASN1_TYPE node_root, const char *name, const void *ivalue, int len) |
MHD__asn1_retCode | MHD__asn1_read_value (ASN1_TYPE root, const char *name, void *ivalue, int *len) |
MHD__asn1_retCode | MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len, char *ErrorDescription) |
MHD__asn1_retCode | MHD__asn1_der_decoding (ASN1_TYPE *element, const void *ider, int len, char *errorDescription) |
MHD__asn1_retCode | MHD__asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len, const char *name_element, int *start, int *end) |
int | MHD__asn1_get_tag_der (const unsigned char *der, int der_len, unsigned char *cls, int *len, unsigned long *tag) |
void | MHD__asn1_octet_der (const unsigned char *str, int str_len, unsigned char *der, int *der_len) |
MHD__asn1_retCode | MHD__asn1_get_octet_der (const unsigned char *der, int der_len, int *ret_len, unsigned char *str, int str_size, int *str_len) |
void | MHD__asn1_bit_der (const unsigned char *str, int bit_len, unsigned char *der, int *der_len) |
MHD__asn1_retCode | MHD__asn1_get_bit_der (const unsigned char *der, int der_len, int *ret_len, unsigned char *str, int str_size, int *bit_len) |
signed long | MHD__asn1_get_length_der (const unsigned char *der, int der_len, int *len) |
void | MHD__asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len) |
ASN1_TYPE | MHD__asn1_find_node (ASN1_TYPE pointer, const char *name) |
#define ASN1_ARRAY_ERROR 16 |
Definition at line 67 of file libtasn1.h.
Referenced by MHD__asn1_array2tree().
#define ASN1_CLASS_APPLICATION 0x40 |
Definition at line 82 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), and MHD__asn1_insert_tag_der().
#define ASN1_CLASS_CONTEXT_SPECIFIC 0x80 |
Definition at line 83 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), and MHD__asn1_insert_tag_der().
#define ASN1_CLASS_PRIVATE 0xC0 |
Definition at line 84 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), and MHD__asn1_insert_tag_der().
#define ASN1_CLASS_STRUCTURED 0x20 |
Definition at line 85 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), MHD__asn1_get_octet_string(), and MHD__asn1_insert_tag_der().
#define ASN1_CLASS_UNIVERSAL 0x00 |
Definition at line 81 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), and MHD__asn1_insert_tag_der().
#define ASN1_DER_ERROR 4 |
Definition at line 55 of file libtasn1.h.
Referenced by MHD__asn1_der_coding(), MHD__asn1_der_decoding(), MHD__asn1_der_decoding_startEnd(), MHD__asn1_extract_tag_der(), MHD__asn1_get_bit_der(), MHD__asn1_get_indefinite_length_string(), MHD__asn1_get_octet_der(), MHD__asn1_get_octet_string(), MHD__asn1_get_tag_der(), MHD__asn1_get_time_der(), MHD__asn1_read_value(), and MHD_gtls_asn2err().
#define ASN1_DER_OVERFLOW 14 |
Definition at line 65 of file libtasn1.h.
Referenced by MHD_gtls_asn2err().
#define ASN1_ELEMENT_NOT_EMPTY 17 |
Definition at line 68 of file libtasn1.h.
Referenced by MHD__asn1_array2tree().
#define ASN1_ELEMENT_NOT_FOUND 2 |
Definition at line 53 of file libtasn1.h.
Referenced by MHD__asn1_change_integer_value(), MHD__asn1_check_identifier(), MHD__asn1_create_element(), MHD__asn1_delete_not_used(), MHD__asn1_delete_structure(), MHD__asn1_der_coding(), MHD__asn1_der_decoding(), MHD__asn1_der_decoding_startEnd(), MHD__asn1_expand_identifier(), MHD__asn1_expand_object_id(), MHD__asn1_read_value(), MHD__asn1_type_choice_config(), MHD__asn1_write_value(), MHD__gnutls_x509_crt_get_extension(), MHD_gnutls_x509_crt_get_version(), and MHD_gtls_asn2err().
#define ASN1_ERROR_TYPE_ANY 10 |
Definition at line 61 of file libtasn1.h.
Referenced by MHD__asn1_der_decoding(), and MHD_gtls_asn2err().
#define ASN1_FILE_NOT_FOUND 1 |
Definition at line 52 of file libtasn1.h.
Referenced by MHD_gtls_asn2err().
#define ASN1_GENERIC_ERROR 6 |
Definition at line 57 of file libtasn1.h.
Referenced by MHD__asn1_append_sequence_set(), MHD__asn1_der_decoding(), MHD__asn1_der_decoding_startEnd(), MHD__asn1_extract_tag_der(), MHD__asn1_get_bit_der(), MHD__asn1_get_octet_der(), MHD__asn1_insert_tag_der(), and MHD_gtls_asn2err().
#define ASN1_IDENTIFIER_NOT_FOUND 3 |
Definition at line 54 of file libtasn1.h.
Referenced by MHD__asn1_array2tree(), MHD__asn1_check_identifier(), MHD__asn1_expand_identifier(), and MHD_gtls_asn2err().
#define ASN1_MEM_ALLOC_ERROR 13 |
Definition at line 64 of file libtasn1.h.
Referenced by MHD__asn1_der_decoding(), MHD__asn1_get_octet_string(), MHD__asn1_objectid_der(), MHD__asn1_write_value(), and MHD_gtls_asn2err().
#define ASN1_MEM_ERROR 12 |
Definition at line 63 of file libtasn1.h.
Referenced by MHD__asn1_complete_explicit_tag(), MHD__asn1_convert_integer(), MHD__asn1_der_coding(), MHD__asn1_get_bit_der(), MHD__asn1_get_octet_der(), MHD__asn1_insert_tag_der(), MHD__asn1_objectid_der(), MHD__asn1_read_value(), MHD__asn1_time_der(), MHD__gnutls_x509_der_encode(), MHD__gnutls_x509_export_int(), MHD__gnutls_x509_get_pk_algorithm(), MHD__gnutls_x509_read_int(), MHD__gnutls_x509_read_value(), and MHD_gtls_asn2err().
#define ASN1_NAME_TOO_LONG 15 |
Definition at line 66 of file libtasn1.h.
#define ASN1_PRINT_ALL 4 |
Definition at line 76 of file libtasn1.h.
#define ASN1_PRINT_NAME 1 |
Definition at line 73 of file libtasn1.h.
#define ASN1_PRINT_NAME_TYPE 2 |
Definition at line 74 of file libtasn1.h.
#define ASN1_PRINT_NAME_TYPE_VALUE 3 |
Definition at line 75 of file libtasn1.h.
#define ASN1_SUCCESS 0 |
Definition at line 51 of file libtasn1.h.
Referenced by MHD__asn1_append_sequence_set(), MHD__asn1_array2tree(), MHD__asn1_change_integer_value(), MHD__asn1_check_identifier(), MHD__asn1_complete_explicit_tag(), MHD__asn1_convert_integer(), MHD__asn1_delete_not_used(), MHD__asn1_delete_structure(), MHD__asn1_der_coding(), MHD__asn1_der_decoding(), MHD__asn1_der_decoding_startEnd(), MHD__asn1_expand_identifier(), MHD__asn1_expand_object_id(), MHD__asn1_extract_tag_der(), MHD__asn1_get_bit_der(), MHD__asn1_get_indefinite_length_string(), MHD__asn1_get_octet_der(), MHD__asn1_get_octet_string(), MHD__asn1_get_tag_der(), MHD__asn1_get_time_der(), MHD__asn1_insert_tag_der(), MHD__asn1_objectid_der(), MHD__asn1_ordering_set(), MHD__asn1_ordering_set_of(), MHD__asn1_read_value(), MHD__asn1_time_der(), MHD__asn1_type_choice_config(), MHD__asn1_write_value(), MHD__gnutls_cert_get_issuer_dn(), MHD__gnutls_global_init(), MHD__gnutls_privkey_decode_pkcs1_rsa_key(), MHD__gnutls_x509_crt_get_extension(), MHD__gnutls_x509_decode_octet_string(), MHD__gnutls_x509_der_encode(), MHD__gnutls_x509_export_int(), MHD__gnutls_x509_ext_extract_keyUsage(), MHD__gnutls_x509_get_pk_algorithm(), MHD__gnutls_x509_read_int(), MHD__gnutls_x509_read_rsa_params(), MHD__gnutls_x509_read_value(), MHD__gnutls_x509_write_int(), MHD__gnutls_x509_write_rsa_params(), MHD_gnutls_x509_crt_get_version(), MHD_gnutls_x509_crt_import(), and MHD_gnutls_x509_crt_init().
#define ASN1_SYNTAX_ERROR 11 |
Definition at line 62 of file libtasn1.h.
Referenced by MHD_gtls_asn2err().
#define ASN1_TAG_BIT_STRING 0x03 |
Definition at line 95 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), and MHD__asn1_insert_tag_der().
#define ASN1_TAG_BOOLEAN 0x01 |
Definition at line 90 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), and MHD__asn1_insert_tag_der().
#define ASN1_TAG_ENUMERATED 0x0A |
Definition at line 99 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), and MHD__asn1_insert_tag_der().
#define ASN1_TAG_ERROR 8 |
Definition at line 59 of file libtasn1.h.
Referenced by MHD__asn1_der_decoding(), MHD__asn1_der_decoding_startEnd(), MHD__asn1_extract_tag_der(), and MHD_gtls_asn2err().
#define ASN1_TAG_GENERALIZEDTime 0x18 |
Definition at line 97 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), and MHD__asn1_insert_tag_der().
#define ASN1_TAG_GENERALSTRING 0x1B |
Definition at line 101 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), and MHD__asn1_insert_tag_der().
#define ASN1_TAG_IMPLICIT 9 |
Definition at line 60 of file libtasn1.h.
Referenced by MHD_gtls_asn2err().
#define ASN1_TAG_INTEGER 0x02 |
Definition at line 91 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), and MHD__asn1_insert_tag_der().
#define ASN1_TAG_NULL 0x05 |
Definition at line 100 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), and MHD__asn1_insert_tag_der().
#define ASN1_TAG_OBJECT_ID 0x06 |
Definition at line 98 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), and MHD__asn1_insert_tag_der().
#define ASN1_TAG_OCTET_STRING 0x04 |
Definition at line 94 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), MHD__asn1_get_octet_string(), and MHD__asn1_insert_tag_der().
#define ASN1_TAG_SEQUENCE 0x10 |
Definition at line 92 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), and MHD__asn1_insert_tag_der().
#define ASN1_TAG_SET 0x11 |
Definition at line 93 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), and MHD__asn1_insert_tag_der().
#define ASN1_TAG_UTCTime 0x17 |
Definition at line 96 of file libtasn1.h.
Referenced by MHD__asn1_extract_tag_der(), and MHD__asn1_insert_tag_der().
#define ASN1_TYPE_EMPTY NULL |
Definition at line 123 of file libtasn1.h.
Referenced by MHD__asn1_array2tree(), MHD__asn1_delete_structure(), MHD__asn1_der_decoding(), MHD__asn1_der_decoding_startEnd(), MHD__gnutls_x509_decode_octet_string(), MHD__gnutls_x509_der_encode(), MHD__gnutls_x509_ext_extract_keyUsage(), MHD__gnutls_x509_read_rsa_params(), MHD__gnutls_x509_write_rsa_params(), and MHD_gnutls_x509_privkey_init().
#define ASN1_VALUE_NOT_FOUND 5 |
Definition at line 56 of file libtasn1.h.
Referenced by MHD__asn1_der_coding(), MHD__asn1_read_value(), MHD__asn1_write_value(), and MHD_gtls_asn2err().
#define ASN1_VALUE_NOT_VALID 7 |
Definition at line 58 of file libtasn1.h.
Referenced by MHD__asn1_write_value(), and MHD_gtls_asn2err().
#define LIBTASN1_VERSION "1.2" |
Definition at line 34 of file libtasn1.h.
#define MAX_ERROR_DESCRIPTION_SIZE 128 |
Definition at line 41 of file libtasn1.h.
Referenced by MHD__asn1_error_description_tag_error(), and MHD__asn1_error_description_value_not_found().
#define MAX_NAME_SIZE 128 |
Definition at line 39 of file libtasn1.h.
Referenced by MHD__asn1_check_identifier(), MHD__asn1_expand_identifier(), MHD__asn1_expand_object_id(), MHD__asn1_find_node(), and MHD__gnutls_x509_crt_get_extension().
typedef struct static_struct_asn ASN1_ARRAY_TYPE |
Definition at line 132 of file libtasn1.h.
Definition at line 121 of file libtasn1.h.
typedef int MHD__asn1_retCode |
Definition at line 46 of file libtasn1.h.
typedef struct node_asn_struct node_asn |
Definition at line 119 of file libtasn1.h.
MHD__asn1_retCode MHD__asn1_array2tree | ( | const ASN1_ARRAY_TYPE * | array, | |
ASN1_TYPE * | definitions, | |||
char * | errorDescription | |||
) |
MHD__asn1_array2tree - Creates the structures needed to manage the ASN1 definitions. : specify the array that contains ASN.1 declarations : return the pointer to the structure created by *ARRAY ASN.1 declarations : return the error description.
Creates the structures needed to manage the ASN.1 definitions. is a vector created by MHD__asn1_parser2array().
Returns:
ASN1_SUCCESS: Structure created correctly.
ASN1_ELEMENT_NOT_EMPTY: * not ASN1_TYPE_EMPTY.
ASN1_IDENTIFIER_NOT_FOUND: In the file there is an identifier that is not defined (see for more information).
ASN1_ARRAY_ERROR: The array pointed by is wrong.
Definition at line 108 of file structure.c.
References ASN1_ARRAY_ERROR, ASN1_ELEMENT_NOT_EMPTY, ASN1_IDENTIFIER_NOT_FOUND, ASN1_SUCCESS, ASN1_TYPE_EMPTY, CONST_DOWN, CONST_RIGHT, DOWN, Estrcat, Estrcpy, MHD__asn1_add_node(), MHD__asn1_change_integer_value(), MHD__asn1_check_identifier(), MHD__asn1_delete_list(), MHD__asn1_delete_list_and_nodes(), MHD__asn1_expand_object_id(), MHD__asn1_find_up(), MHD__asn1_identifierMissing, MHD__asn1_set_down(), MHD__asn1_set_name(), MHD__asn1_set_right(), MHD__asn1_set_value(), RIGHT, node_asn_struct::type, and UP.
Referenced by MHD__gnutls_global_init().
void MHD__asn1_bit_der | ( | const unsigned char * | str, | |
int | bit_len, | |||
unsigned char * | der, | |||
int * | der_len | |||
) |
MHD__asn1_bit_der: : BIT string. : number of meaningful bits in STR. : string returned. : number of meaningful bytes of DER (der[0]..der[ans_len-1]).
Creates the DER coding for a BIT STRING type (length and pad included).
Definition at line 303 of file coding.c.
References MHD__asn1_length_der(), and MHD_bit_mask.
Referenced by MHD__asn1_write_value().
MHD__asn1_retCode MHD__asn1_create_element | ( | ASN1_TYPE | definitions, | |
const char * | source_name, | |||
ASN1_TYPE * | element | |||
) |
MHD__asn1_create_element - Creates a structure of type SOURCE_NAME. : pointer to the structure returned by "parser_asn1" function : the name of the type of the new structure (must be inside p_structure). : pointer to the structure created.
Creates a structure of type . Example using "pkix.asn":
rc = MHD__asn1_create_structure(cert_def, "PKIX1.Certificate", certptr);
Returns:
ASN1_SUCCESS: Creation OK.
ASN1_ELEMENT_NOT_FOUND: SOURCE_NAME isn't known
Definition at line 566 of file structure.c.
References ASN1_ELEMENT_NOT_FOUND, MHD__asn1_copy_structure2(), MHD__asn1_expand_identifier(), MHD__asn1_set_name(), and MHD__asn1_type_choice_config().
Referenced by MHD__gnutls_cert_get_issuer_dn(), MHD__gnutls_privkey_decode_pkcs1_rsa_key(), MHD__gnutls_x509_decode_octet_string(), MHD__gnutls_x509_der_encode(), MHD__gnutls_x509_ext_extract_keyUsage(), MHD__gnutls_x509_read_rsa_params(), MHD__gnutls_x509_write_rsa_params(), and MHD_gnutls_x509_crt_init().
MHD__asn1_retCode MHD__asn1_delete_structure | ( | ASN1_TYPE * | structure | ) |
MHD__asn1_delete_structure - Deletes the structure pointed by *ROOT. : pointer to the structure that you want to delete.
Deletes the structure *. At the end, * is set to ASN1_TYPE_EMPTY.
Returns:
ASN1_SUCCESS: Everything OK.
ASN1_ELEMENT_NOT_FOUND: * was ASN1_TYPE_EMPTY.
Definition at line 220 of file structure.c.
References ASN1_ELEMENT_NOT_FOUND, ASN1_SUCCESS, ASN1_TYPE_EMPTY, node_asn_struct::down, node_asn_struct::left, MHD__asn1_find_left(), MHD__asn1_find_up(), MHD__asn1_remove_node(), MHD__asn1_set_down(), MHD__asn1_set_right(), and node_asn_struct::right.
Referenced by MHD__asn1_delete_not_used(), MHD__asn1_der_coding(), MHD__asn1_der_decoding(), MHD__asn1_type_choice_config(), MHD__asn1_write_value(), MHD__gnutls_cert_get_issuer_dn(), MHD__gnutls_global_deinit(), MHD__gnutls_global_init(), MHD__gnutls_privkey_decode_pkcs1_rsa_key(), MHD__gnutls_x509_decode_octet_string(), MHD__gnutls_x509_der_encode(), MHD__gnutls_x509_ext_extract_keyUsage(), MHD__gnutls_x509_read_rsa_params(), MHD__gnutls_x509_write_rsa_params(), MHD_gnutls_x509_crt_deinit(), and MHD_gnutls_x509_privkey_deinit().
MHD__asn1_retCode MHD__asn1_der_coding | ( | ASN1_TYPE | element, | |
const char * | name, | |||
void * | ider, | |||
int * | len, | |||
char * | ErrorDescription | |||
) |
Definition at line 849 of file coding.c.
References ASN1_DER_ERROR, ASN1_ELEMENT_NOT_FOUND, ASN1_MEM_ERROR, ASN1_SUCCESS, ASN1_VALUE_NOT_FOUND, CONST_DEFAULT, node_asn_struct::down, DOWN, MHD__asn1_complete_explicit_tag(), MHD__asn1_copy_structure3(), MHD__asn1_delete_structure(), MHD__asn1_error_description_value_not_found(), MHD__asn1_find_node(), MHD__asn1_find_up(), MHD__asn1_get_length_der(), MHD__asn1_insert_tag_der(), MHD__asn1_length_der(), MHD__asn1_ltostr(), MHD__asn1_objectid_der(), MHD__asn1_ordering_set(), MHD__asn1_ordering_set_of(), MHD__asn1_set_value(), MHD__asn1_time_der(), node_asn_struct::right, RIGHT, SIZEOF_UNSIGNED_LONG_INT, node_asn_struct::type, TYPE_ANY, TYPE_BIT_STRING, TYPE_BOOLEAN, TYPE_ENUMERATED, type_field, TYPE_GENERALSTRING, TYPE_INTEGER, TYPE_NULL, TYPE_OBJECT_ID, TYPE_OCTET_STRING, TYPE_SEQUENCE, TYPE_SEQUENCE_OF, TYPE_SET, TYPE_SET_OF, TYPE_SIZE, TYPE_TAG, TYPE_TIME, UP, node_asn_struct::value, and node_asn_struct::value_len.
Referenced by MHD__gnutls_x509_der_encode(), and MHD__gnutls_x509_export_int().
MHD__asn1_retCode MHD__asn1_der_decoding | ( | ASN1_TYPE * | element, | |
const void * | ider, | |||
int | len, | |||
char * | errorDescription | |||
) |
MHD__asn1_der_decoding - Fill the structure *ELEMENT with values of a DER encoding string. : pointer to an ASN1 structure. : vector that contains the DER encoding. : number of bytes of *: [0]..[len-1]. : null-terminated string contains details when an error occurred.
Fill the structure *ELEMENT with values of a DER encoding string. The sructure must just be created with function 'create_stucture'. If an error occurs during the decoding procedure, the *ELEMENT is deleted and set equal to ASN1_TYPE_EMPTY.
Returns:
ASN1_SUCCESS: DER encoding OK.
ASN1_ELEMENT_NOT_FOUND: ELEMENT is ASN1_TYPE_EMPTY.
ASN1_TAG_ERROR,ASN1_DER_ERROR: The der encoding doesn't match the structure NAME. *ELEMENT deleted.
Definition at line 763 of file decoding.c.
References ASN1_DER_ERROR, ASN1_ELEMENT_NOT_FOUND, ASN1_ERROR_TYPE_ANY, ASN1_GENERIC_ERROR, ASN1_MEM_ALLOC_ERROR, ASN1_SUCCESS, ASN1_TAG_ERROR, ASN1_TYPE_EMPTY, CONST_DEFAULT, CONST_NOT_USED, CONST_OPTION, CONST_SET, CONST_TAG, node_asn_struct::down, DOWN, MHD__asn1_afree, MHD__asn1_alloca, MHD__asn1_append_sequence_set(), MHD__asn1_delete_not_used(), MHD__asn1_delete_structure(), MHD__asn1_error_description_tag_error(), MHD__asn1_extract_tag_der(), MHD__asn1_find_up(), MHD__asn1_get_indefinite_length_string(), MHD__asn1_get_length_der(), MHD__asn1_get_objectid_der(), MHD__asn1_get_octet_string(), MHD__asn1_get_tag_der(), MHD__asn1_get_time_der(), MHD__asn1_length_der(), MHD__asn1_ltostr(), MHD__asn1_octet_der(), MHD__asn1_set_value(), RIGHT, node_asn_struct::right, node_asn_struct::type, TYPE_ANY, TYPE_BIT_STRING, TYPE_BOOLEAN, TYPE_CHOICE, TYPE_ENUMERATED, type_field, TYPE_GENERALSTRING, TYPE_INTEGER, TYPE_NULL, TYPE_OBJECT_ID, TYPE_OCTET_STRING, TYPE_SEQUENCE, TYPE_SEQUENCE_OF, TYPE_SET, TYPE_SET_OF, TYPE_SIZE, TYPE_TAG, TYPE_TIME, UP, and node_asn_struct::value.
Referenced by MHD__gnutls_cert_get_issuer_dn(), MHD__gnutls_privkey_decode_pkcs1_rsa_key(), MHD__gnutls_x509_decode_octet_string(), MHD__gnutls_x509_ext_extract_keyUsage(), MHD__gnutls_x509_read_rsa_params(), and MHD_gnutls_x509_crt_import().
MHD__asn1_retCode MHD__asn1_der_decoding_startEnd | ( | ASN1_TYPE | element, | |
const void * | ider, | |||
int | len, | |||
const char * | name_element, | |||
int * | start, | |||
int * | end | |||
) |
MHD__asn1_der_decoding_startEnd - Find the start and end point of an element in a DER encoding string. : pointer to an ASN1 element : vector that contains the DER encoding. : number of bytes of *: [0]..[len-1] : an element of NAME structure. : the position of the first byte of NAME_ELEMENT decoding ([*start]) : the position of the last byte of NAME_ELEMENT decoding ([*end])
Find the start and end point of an element in a DER encoding string. I mean that if you have a der encoding and you have already used the function "MHD__asn1_der_decoding" to fill a structure, it may happen that you want to find the piece of string concerning an element of the structure.
Example: the sequence "tbsCertificate" inside an X509 certificate.
Returns:
ASN1_SUCCESS: DER encoding OK.
ASN1_ELEMENT_NOT_FOUND: ELEMENT is ASN1_TYPE EMPTY or NAME_ELEMENT is not a valid element.
ASN1_TAG_ERROR,ASN1_DER_ERROR: the der encoding doesn't match the structure ELEMENT.
Definition at line 1345 of file decoding.c.
References ASN1_DER_ERROR, ASN1_ELEMENT_NOT_FOUND, ASN1_GENERIC_ERROR, ASN1_SUCCESS, ASN1_TAG_ERROR, ASN1_TYPE_EMPTY, CONST_DEFAULT, CONST_NOT_USED, CONST_OPTION, CONST_SET, CONST_TAG, node_asn_struct::down, DOWN, MHD__asn1_extract_tag_der(), MHD__asn1_find_node(), MHD__asn1_find_up(), MHD__asn1_get_indefinite_length_string(), MHD__asn1_get_length_der(), MHD__asn1_get_octet_string(), MHD__asn1_get_tag_der(), RIGHT, node_asn_struct::right, node_asn_struct::type, TYPE_ANY, TYPE_BIT_STRING, TYPE_BOOLEAN, TYPE_CHOICE, TYPE_ENUMERATED, type_field, TYPE_GENERALSTRING, TYPE_INTEGER, TYPE_NULL, TYPE_OBJECT_ID, TYPE_OCTET_STRING, TYPE_SEQUENCE, TYPE_SEQUENCE_OF, TYPE_SET, TYPE_SET_OF, TYPE_SIZE, TYPE_TAG, TYPE_TIME, UP, and node_asn_struct::value.
Referenced by MHD__gnutls_cert_get_issuer_dn().
Definition at line 96 of file parser_aux.c.
References node_asn_struct::down, MAX_NAME_SIZE, MHD__asn1_str_cpy(), node_asn_struct::name, and node_asn_struct::right.
Referenced by MHD__asn1_check_identifier(), MHD__asn1_copy_structure2(), MHD__asn1_der_coding(), MHD__asn1_der_decoding_startEnd(), MHD__asn1_expand_object_id(), MHD__asn1_read_value(), and MHD__asn1_write_value().
MHD__asn1_retCode MHD__asn1_get_bit_der | ( | const unsigned char * | der, | |
int | der_len, | |||
int * | ret_len, | |||
unsigned char * | str, | |||
int | str_size, | |||
int * | bit_len | |||
) |
MHD__asn1_get_bit_der: : DER data to decode containing the BIT SEQUENCE. : Length of DER data to decode. : Output variable containing the length of the DER data. : Pre-allocated output buffer to put decoded BIT SEQUENCE in. : Length of pre-allocated output buffer. : Output variable containing the size of the BIT SEQUENCE.
Extract a BIT SEQUENCE from DER data.
Return value: Return ASN1_SUCCESS on success, or an error.
Definition at line 289 of file decoding.c.
References ASN1_DER_ERROR, ASN1_GENERIC_ERROR, ASN1_MEM_ERROR, ASN1_SUCCESS, and MHD__asn1_get_length_der().
Referenced by MHD__asn1_read_value().
signed long MHD__asn1_get_length_der | ( | const unsigned char * | der, | |
int | der_len, | |||
int * | len | |||
) |
MHD__asn1_get_length_der: : DER data to decode. : Length of DER data to decode. : Output variable containing the length of the DER length field.
Extract a length field from DER data.
Return value: Return the decoded length value, or -1 on indefinite length, or -2 when the value was too big.
Definition at line 61 of file decoding.c.
Referenced by MHD__asn1_der_coding(), MHD__asn1_der_decoding(), MHD__asn1_der_decoding_startEnd(), MHD__asn1_extract_tag_der(), MHD__asn1_get_bit_der(), MHD__asn1_get_indefinite_length_string(), MHD__asn1_get_objectid_der(), MHD__asn1_get_octet_der(), MHD__asn1_get_octet_string(), MHD__asn1_get_time_der(), MHD__asn1_ordering_set(), MHD__asn1_ordering_set_of(), and MHD__asn1_read_value().
MHD__asn1_retCode MHD__asn1_get_octet_der | ( | const unsigned char * | der, | |
int | der_len, | |||
int * | ret_len, | |||
unsigned char * | str, | |||
int | str_size, | |||
int * | str_len | |||
) |
MHD__asn1_get_octet_der: : DER data to decode containing the OCTET SEQUENCE. : Length of DER data to decode. : Output variable containing the length of the DER data. : Pre-allocated output buffer to put decoded OCTET SEQUENCE in. : Length of pre-allocated output buffer. : Output variable containing the length of the OCTET SEQUENCE.
Extract an OCTET SEQUENCE from DER data.
Return value: Returns ASN1_SUCCESS on success, or an error.
Definition at line 181 of file decoding.c.
References ASN1_DER_ERROR, ASN1_GENERIC_ERROR, ASN1_MEM_ERROR, ASN1_SUCCESS, and MHD__asn1_get_length_der().
Referenced by MHD__asn1_read_value().
int MHD__asn1_get_tag_der | ( | const unsigned char * | der, | |
int | der_len, | |||
unsigned char * | cls, | |||
int * | len, | |||
unsigned long * | tag | |||
) |
MHD__asn1_get_tag_der: : DER data to decode. : Length of DER data to decode. : Output variable containing decoded class. : Output variable containing the length of the DER TAG data. : Output variable containing the decoded tag.
Decode the class and TAG from DER code.
Return value: Returns ASN1_SUCCESS on success, or an error.
Definition at line 120 of file decoding.c.
References ASN1_DER_ERROR, and ASN1_SUCCESS.
Referenced by MHD__asn1_der_decoding(), MHD__asn1_der_decoding_startEnd(), MHD__asn1_extract_tag_der(), MHD__asn1_get_indefinite_length_string(), MHD__asn1_ordering_set(), and MHD__asn1_ordering_set_of().
void MHD__asn1_length_der | ( | unsigned long int | len, | |
unsigned char * | ans, | |||
int * | ans_len | |||
) |
MHD__asn1_length_der: : value to convert. : string returned. : number of meaningful bytes of ANS (ans[0]..ans[ans_len-1]).
Creates the DER coding for the LEN parameter (only the length). The buffer is pre-allocated and must have room for the output.
Definition at line 73 of file coding.c.
References SIZEOF_UNSIGNED_LONG_INT.
Referenced by MHD__asn1_bit_der(), MHD__asn1_complete_explicit_tag(), MHD__asn1_der_coding(), MHD__asn1_der_decoding(), MHD__asn1_get_octet_string(), MHD__asn1_objectid_der(), MHD__asn1_octet_der(), MHD__asn1_time_der(), and MHD__asn1_write_value().
void MHD__asn1_octet_der | ( | const unsigned char * | str, | |
int | str_len, | |||
unsigned char * | der, | |||
int * | der_len | |||
) |
MHD__asn1_octet_der: : OCTET string. : STR length (str[0]..str[str_len-1]). : string returned. : number of meaningful bytes of DER (der[0]..der[ans_len-1]).
Creates the DER coding for an OCTET type (length included).
Definition at line 156 of file coding.c.
References MHD__asn1_length_der().
Referenced by MHD__asn1_change_integer_value(), MHD__asn1_der_decoding(), and MHD__asn1_write_value().
MHD__asn1_retCode MHD__asn1_parser2array | ( | const char * | inputFileName, | |
const char * | outputFileName, | |||
const char * | vectorName, | |||
char * | errorDescription | |||
) |
MHD__asn1_retCode MHD__asn1_parser2tree | ( | const char * | file_name, | |
ASN1_TYPE * | definitions, | |||
char * | errorDescription | |||
) |
MHD__asn1_retCode MHD__asn1_read_value | ( | ASN1_TYPE | root, | |
const char * | name, | |||
void * | ivalue, | |||
int * | len | |||
) |
Definition at line 739 of file element.c.
References ADD_STR_VALUE, ASN1_DER_ERROR, ASN1_ELEMENT_NOT_FOUND, ASN1_MEM_ERROR, ASN1_SUCCESS, ASN1_VALUE_NOT_FOUND, CONST_ASSIGN, CONST_DEFAULT, CONST_TRUE, node_asn_struct::down, MHD__asn1_convert_integer(), MHD__asn1_find_node(), MHD__asn1_get_bit_der(), MHD__asn1_get_length_der(), MHD__asn1_get_octet_der(), node_asn_struct::name, PUT_STR_VALUE, PUT_VALUE, node_asn_struct::right, node_asn_struct::type, TYPE_ANY, TYPE_BIT_STRING, TYPE_BOOLEAN, TYPE_CHOICE, TYPE_CONSTANT, TYPE_DEFAULT, TYPE_ENUMERATED, type_field, TYPE_GENERALSTRING, TYPE_INTEGER, TYPE_NULL, TYPE_OBJECT_ID, TYPE_OCTET_STRING, TYPE_TIME, node_asn_struct::value, and node_asn_struct::value_len.
Referenced by MHD__gnutls_x509_crt_get_extension(), MHD__gnutls_x509_decode_octet_string(), MHD__gnutls_x509_ext_extract_keyUsage(), MHD__gnutls_x509_get_pk_algorithm(), MHD__gnutls_x509_read_int(), MHD__gnutls_x509_read_value(), and MHD_gnutls_x509_crt_get_version().
MHD__asn1_retCode MHD__asn1_write_value | ( | ASN1_TYPE | node_root, | |
const char * | name, | |||
const void * | ivalue, | |||
int | len | |||
) |
Definition at line 268 of file element.c.
References ASN1_ELEMENT_NOT_FOUND, ASN1_MEM_ALLOC_ERROR, ASN1_SUCCESS, ASN1_VALUE_NOT_FOUND, ASN1_VALUE_NOT_VALID, CONST_DEFAULT, CONST_FALSE, CONST_LIST, CONST_OPTION, CONST_TRUE, CONST_UTC, node_asn_struct::down, MHD__asn1_afree, MHD__asn1_alloca, MHD__asn1_append_sequence_set(), MHD__asn1_bit_der(), MHD__asn1_convert_integer(), MHD__asn1_delete_structure(), MHD__asn1_find_node(), MHD__asn1_length_der(), MHD__asn1_octet_der(), MHD__asn1_set_value(), node_asn_struct::name, node_asn_struct::right, SIZEOF_UNSIGNED_LONG_INT, node_asn_struct::type, TYPE_ANY, TYPE_BIT_STRING, TYPE_BOOLEAN, TYPE_CHOICE, TYPE_CONSTANT, TYPE_DEFAULT, TYPE_ENUMERATED, type_field, TYPE_GENERALSTRING, TYPE_INTEGER, TYPE_OBJECT_ID, TYPE_OCTET_STRING, TYPE_SEQUENCE_OF, TYPE_SET_OF, TYPE_SIZE, TYPE_TAG, TYPE_TIME, and node_asn_struct::value.
Referenced by MHD__gnutls_x509_der_encode(), and MHD__gnutls_x509_write_int().