libksba
1.6.0
About: KSBA is a library to make the tasks of working with X.509 certificates, CMS data and related objects more easy.
![]() ![]() |
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "util.h"
#include "asn1-func.h"
#include "ber-help.h"
#include "ber-decoder.h"
#include "stringbuf.h"
Go to the source code of this file.
Macros | |
#define | N 0x00 |
#define | P 0x01 |
Functions | |
static void | append_quoted (struct stringbuf *sb, const unsigned char *value, size_t length, int skip) |
static void | append_utf8_value (const unsigned char *value, size_t length, struct stringbuf *sb) |
static void | append_latin1_value (const unsigned char *value, size_t length, struct stringbuf *sb) |
static void | append_ucs4_value (const unsigned char *value, size_t length, struct stringbuf *sb) |
static void | append_ucs2_value (const unsigned char *value, size_t length, struct stringbuf *sb) |
static gpg_error_t | append_atv (const unsigned char *image, AsnNode root, struct stringbuf *sb) |
static gpg_error_t | dn_to_str (const unsigned char *image, AsnNode root, struct stringbuf *sb) |
gpg_error_t | _ksba_dn_to_str (const unsigned char *image, AsnNode node, char **r_string) |
static gpg_error_t | create_and_run_decoder (ksba_reader_t reader, const char *elem_name, AsnNode *r_root, unsigned char **r_image, size_t *r_imagelen) |
gpg_error_t | _ksba_derdn_to_str (const unsigned char *der, size_t derlen, char **r_string) |
static const char * | count_quoted_string (const char *string, size_t *result, int v2compat, int *stringtype) |
static gpg_error_t | write_escaped (ksba_writer_t w, const unsigned char *buffer, size_t nbytes) |
static gpg_error_t | parse_rdn (const unsigned char *string, const char **endp, ksba_writer_t writer, size_t *roff, size_t *rlen) |
gpg_error_t | _ksba_dn_from_str (const char *string, char **rbuf, size_t *rlength) |
gpg_error_t | _ksba_dn_der2str (const void *der, size_t derlen, char **rstring) |
gpg_error_t | _ksba_dn_str2der (const char *string, unsigned char **rder, size_t *rderlen) |
gpg_error_t | _ksba_dn_teststr (const char *string, int seq, size_t *rerroff, size_t *rerrlen) |
Variables | |
struct { | |
const char * name | |
int source | |
const char * description | |
size_t oidlen | |
const unsigned char * oid | |
const char * oidstr | |
} | oid_name_tbl [] |
static unsigned char | charclasses [128] |
gpg_error_t _ksba_derdn_to_str | ( | const unsigned char * | der, |
size_t | derlen, | ||
char ** | r_string | ||
) |
Definition at line 622 of file dn.c.
References _ksba_asn_release_nodes(), _ksba_dn_to_str(), create_and_run_decoder(), der, derlen, asn_node_struct::down, ksba_reader_new(), ksba_reader_release(), ksba_reader_set_mem(), and xfree.
Referenced by _ksba_dn_der2str(), _ksba_name_new_from_der(), and parse_response_data().
gpg_error_t _ksba_dn_der2str | ( | const void * | der, |
size_t | derlen, | ||
char ** | rstring | ||
) |
Definition at line 1150 of file dn.c.
References _ksba_derdn_to_str(), der, and derlen.
gpg_error_t _ksba_dn_from_str | ( | const char * | string, |
char ** | rbuf, | ||
size_t * | rlength | ||
) |
Definition at line 1054 of file dn.c.
References _ksba_ber_write_tl(), stringbuf::buf, CLASS_UNIVERSAL, GPG_ERR_SYNTAX, gpg_error, ksba_writer_new(), ksba_writer_release(), ksba_writer_set_mem(), ksba_writer_snatch_mem(), ksba_writer_write(), parse_rdn(), TYPE_SEQUENCE, xfree, xtrymalloc, and xtryrealloc.
Referenced by _ksba_certreq_add_subject(), _ksba_certreq_set_issuer(), and _ksba_dn_str2der().
gpg_error_t _ksba_dn_str2der | ( | const char * | string, |
unsigned char ** | rder, | ||
size_t * | rderlen | ||
) |
Definition at line 1157 of file dn.c.
References _ksba_dn_from_str().
gpg_error_t _ksba_dn_teststr | ( | const char * | string, |
int | seq, | ||
size_t * | rerroff, | ||
size_t * | rerrlen | ||
) |
Definition at line 1174 of file dn.c.
References GPG_ERR_SYNTAX, gpg_error, stringbuf::len, and parse_rdn().
gpg_error_t _ksba_dn_to_str | ( | const unsigned char * | image, |
AsnNode | node, | ||
char ** | r_string | ||
) |
Definition at line 551 of file dn.c.
References deinit_stringbuf(), dn_to_str(), get_stringbuf(), GPG_ERR_INV_VALUE, gpg_error, init_stringbuf(), asn_node_struct::type, and TYPE_SEQUENCE_OF.
Referenced by _ksba_cms_get_issuer_serial(), _ksba_crl_get_issuer(), _ksba_derdn_to_str(), and get_name().
|
static |
Definition at line 412 of file dn.c.
References append_latin1_value(), append_ucs2_value(), append_ucs4_value(), append_utf8_value(), asn_node_struct::down, gpg_error, ksba_oid_to_str(), asn_node_struct::len, name, asn_node_struct::nhdr, asn_node_struct::off, oid_name_tbl, oidstr, put_stringbuf(), asn_node_struct::right, source, asn_node_struct::type, TYPE_BMP_STRING, TYPE_IA5_STRING, TYPE_OBJECT_ID, TYPE_PRINTABLE_STRING, TYPE_TELETEX_STRING, TYPE_UNIVERSAL_STRING, TYPE_UTF8_STRING, and xfree.
Referenced by dn_to_str().
|
static |
Definition at line 220 of file dn.c.
References append_quoted(), and put_stringbuf_mem().
Referenced by append_atv().
|
static |
Definition at line 107 of file dn.c.
References put_stringbuf_mem(), and put_stringbuf_mem_skip().
Referenced by append_latin1_value(), append_ucs2_value(), append_ucs4_value(), and append_utf8_value().
|
static |
Definition at line 351 of file dn.c.
References append_quoted(), and put_stringbuf_mem().
Referenced by append_atv().
|
static |
Definition at line 262 of file dn.c.
References append_quoted(), and put_stringbuf_mem().
Referenced by append_atv().
|
static |
Definition at line 148 of file dn.c.
References append_quoted(), and put_stringbuf_mem().
Referenced by append_atv().
|
static |
Definition at line 664 of file dn.c.
References charclasses, hexdigitp, TYPE_IA5_STRING, TYPE_PRINTABLE_STRING, TYPE_UTF8_STRING, and xtoi_2.
Referenced by parse_rdn().
|
static |
Definition at line 577 of file dn.c.
References _ksba_ber_decoder_decode(), _ksba_ber_decoder_new(), _ksba_ber_decoder_release(), _ksba_ber_decoder_set_module(), _ksba_ber_decoder_set_reader(), gpg_error, ksba_asn_create_tree(), and ksba_asn_tree_release().
Referenced by _ksba_derdn_to_str().
|
static |
Definition at line 507 of file dn.c.
References append_atv(), asn_node_struct::down, gpg_error, asn_node_struct::left, put_stringbuf(), asn_node_struct::right, asn_node_struct::type, TYPE_SEQUENCE, and TYPE_SET_OF.
Referenced by _ksba_dn_to_str().
|
static |
Definition at line 793 of file dn.c.
References _ksba_ber_count_tl(), _ksba_ber_write_tl(), ascii_memcasecmp, charclasses, CLASS_UNIVERSAL, count_quoted_string(), digitp, GPG_ERR_INV_VALUE, GPG_ERR_SYNTAX, gpg_error, hexdigitp, ksba_oid_from_str(), ksba_writer_write(), name, oid, oid_name_tbl, oidlen, TYPE_IA5_STRING, TYPE_OBJECT_ID, TYPE_PRINTABLE_STRING, TYPE_SEQUENCE, TYPE_SET, TYPE_UTF8_STRING, write_escaped(), xfree, xtoi_2, and xtrymalloc.
Referenced by _ksba_dn_from_str(), and _ksba_dn_teststr().
|
static |
Definition at line 746 of file dn.c.
References stringbuf::buf, hexdigitp, ksba_writer_write(), and xtoi_2.
Referenced by parse_rdn().
|
static |
Definition at line 87 of file dn.c.
Referenced by count_quoted_string(), and parse_rdn().
const char* name |
Definition at line 47 of file dn.c.
Referenced by _ksba_asn1_yyparse(), _ksba_asn_expand_tree(), _ksba_asn_find_node(), _ksba_asn_lookup_table(), _ksba_asn_set_name(), _ksba_asn_tree_dump(), _ksba_cert_get_issuer(), _ksba_cert_get_subject(), _ksba_certreq_add_subject(), _ksba_certreq_set_issuer(), _ksba_cms_set_enc_val(), _ksba_cms_set_sig_val(), _ksba_name_enum(), _ksba_name_get_uri(), _ksba_name_new_from_der(), _ksba_name_ref(), _ksba_name_release(), append_atv(), find_node(), insert_string(), parse_rdn(), set_name(), and sort_string_table().
const unsigned char* oid |
Definition at line 56 of file dn.c.
Referenced by parse_rdn().
oid_name_tbl[] { ... } const struct |
Referenced by append_atv(), and parse_rdn().
size_t oidlen |
Definition at line 55 of file dn.c.
Referenced by _ksba_asn_find_type_value(), _ksba_certreq_add_extension(), _ksba_keyinfo_to_sexp(), cryptval_to_sexp(), and parse_rdn().
const char* oidstr |
Definition at line 57 of file dn.c.
Referenced by _ksba_der_add_oid(), and append_atv().
int source |
Definition at line 48 of file dn.c.
Referenced by append_atv().