Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Classes | |
struct | rz_asn1_string_t |
struct | rz_asn1_list_t |
struct | rz_asn1_bin_t |
struct | rz_asn1_object_t |
Macros | |
#define | ASN1_JSON_NULL "null" |
#define | ASN1_JSON_EMPTY "{}" |
#define | ASN1_OID_LEN 64 |
#define | ASN1_CLASS 0xC0 /* Bits 8 and 7 */ |
#define | ASN1_FORM 0x20 /* Bit 6 */ |
#define | ASN1_TAG 0x1F /* Bits 5 - 1 */ |
#define | ASN1_LENLONG 0x80 /* long form */ |
#define | ASN1_LENSHORT 0x7F /* Bits 7 - 1 */ |
#define | CLASS_UNIVERSAL 0x00 /* 0 = Universal (defined by ITU X.680) */ |
#define | CLASS_APPLICATION 0x40 /* 1 = Application */ |
#define | CLASS_CONTEXT 0x80 /* 2 = Context-specific */ |
#define | CLASS_PRIVATE 0xC0 /* 3 = Private */ |
#define | FORM_PRIMITIVE 0x00 /* 0 = primitive */ |
#define | FORM_CONSTRUCTED 0x20 /* 1 = constructed */ |
#define | TAG_EOC 0x00 /* 0: End-of-contents octets */ |
#define | TAG_BOOLEAN 0x01 /* 1: Boolean */ |
#define | TAG_INTEGER 0x02 /* 2: Integer */ |
#define | TAG_BITSTRING 0x03 /* 2: Bit string */ |
#define | TAG_OCTETSTRING 0x04 /* 4: Byte string */ |
#define | TAG_NULL 0x05 /* 5: NULL */ |
#define | TAG_OID 0x06 /* 6: Object Identifier */ |
#define | TAG_OBJDESCRIPTOR 0x07 /* 7: Object Descriptor */ |
#define | TAG_EXTERNAL 0x08 /* 8: External */ |
#define | TAG_REAL 0x09 /* 9: Real */ |
#define | TAG_ENUMERATED 0x0A /* 10: Enumerated */ |
#define | TAG_EMBEDDED_PDV 0x0B /* 11: Embedded Presentation Data Value */ |
#define | TAG_UTF8STRING 0x0C /* 12: UTF8 string */ |
#define | TAG_SEQUENCE 0x10 /* 16: Sequence/sequence of */ |
#define | TAG_SET 0x11 /* 17: Set/set of */ |
#define | TAG_NUMERICSTRING 0x12 /* 18: Numeric string */ |
#define | TAG_PRINTABLESTRING 0x13 /* 19: Printable string (ASCII subset) */ |
#define | TAG_T61STRING 0x14 /* 20: T61/Teletex string */ |
#define | TAG_VIDEOTEXSTRING 0x15 /* 21: Videotex string */ |
#define | TAG_IA5STRING 0x16 /* 22: IA5/ASCII string */ |
#define | TAG_UTCTIME 0x17 /* 23: UTC time */ |
#define | TAG_GENERALIZEDTIME 0x18 /* 24: Generalized time */ |
#define | TAG_GRAPHICSTRING 0x19 /* 25: Graphic string */ |
#define | TAG_VISIBLESTRING 0x1A /* 26: Visible string (ASCII subset) */ |
#define | TAG_GENERALSTRING 0x1B /* 27: General string */ |
#define | TAG_UNIVERSALSTRING 0x1C /* 28: Universal string */ |
#define | TAG_BMPSTRING 0x1E /* 30: Basic Multilingual Plane/Unicode string */ |
Typedefs | |
typedef struct rz_asn1_string_t | RASN1String |
typedef struct rz_asn1_list_t | ASN1List |
typedef struct rz_asn1_bin_t | RASN1Binary |
typedef struct rz_asn1_object_t | RASN1Object |
#define CLASS_UNIVERSAL 0x00 /* 0 = Universal (defined by ITU X.680) */ |
#define TAG_BMPSTRING 0x1E /* 30: Basic Multilingual Plane/Unicode string */ |
#define TAG_EMBEDDED_PDV 0x0B /* 11: Embedded Presentation Data Value */ |
#define TAG_GENERALIZEDTIME 0x18 /* 24: Generalized time */ |
#define TAG_PRINTABLESTRING 0x13 /* 19: Printable string (ASCII subset) */ |
#define TAG_UNIVERSALSTRING 0x1C /* 28: Universal string */ |
#define TAG_VISIBLESTRING 0x1A /* 26: Visible string (ASCII subset) */ |
typedef struct rz_asn1_list_t ASN1List |
typedef struct rz_asn1_bin_t RASN1Binary |
typedef struct rz_asn1_object_t RASN1Object |
typedef struct rz_asn1_string_t RASN1String |
Definition at line 12 of file asn1.c.
References ASN1_STD_FORMAT.
Referenced by cmd_print_fromage().
RZ_API RASN1Binary* rz_asn1_create_binary | ( | const ut8 * | buffer, |
ut32 | length | ||
) |
Definition at line 152 of file asn1.c.
References calloc(), free(), length, memcpy(), NULL, and RZ_NEW0.
Referenced by rz_pkcs7_parse_attribute(), rz_pkcs7_parse_contentinfo(), rz_pkcs7_parse_issuerandserialnumber(), rz_pkcs7_parse_signerinfo(), rz_pkcs7_parse_spcdata(), rz_pkcs7_parse_spcmessagedigest(), rz_x509_parse_certificate(), rz_x509_parse_crlentry(), rz_x509_parse_extension(), rz_x509_parse_subjectpublickeyinfo(), and rz_x509_parse_tbscertificate().
RZ_API RASN1Object* rz_asn1_create_object | ( | const ut8 * | buffer, |
ut32 | length, | ||
const ut8 * | start_pointer | ||
) |
Definition at line 120 of file asn1.c.
References asn1_parse_header(), count, test_evm::end, rz_asn1_object_t::form, FORM_CONSTRUCTED, free(), i, rz_asn1_object_t::length, length, rz_asn1_object_t::list, NULL, rz_asn1_list_t::objects, rz_asn1_count_objects(), rz_asn1_create_object(), rz_asn1_free_object(), RZ_NEWS0, rz_asn1_object_t::sector, rz_asn1_object_t::tag, TAG_BITSTRING, and TAG_OCTETSTRING.
Referenced by cmd_print_fromage(), rz_asn1_create_object(), rz_pkcs7_parse_cms(), rz_pkcs7_parse_spcinfo(), and rz_x509_parse_certificate2().
RZ_API RASN1String* rz_asn1_create_string | ( | const char * | string, |
bool | allocated, | ||
ut32 | length | ||
) |
Definition at line 10 of file astr.c.
References length, NULL, RZ_NEW0, and s.
Referenced by newstr(), rz_asn1_concatenate_strings(), rz_asn1_print_hexdump_padded(), rz_asn1_stringify_bits(), rz_asn1_stringify_bytes(), rz_asn1_stringify_integer(), rz_asn1_stringify_oid(), rz_asn1_stringify_string(), rz_asn1_stringify_time(), and rz_asn1_stringify_utctime().
RZ_API void rz_asn1_free_binary | ( | RASN1Binary * | string | ) |
Definition at line 463 of file asn1.c.
References free().
Referenced by rz_pkcs7_free_attribute(), rz_pkcs7_free_contentinfo(), rz_pkcs7_free_issuerandserialnumber(), rz_pkcs7_free_signerinfo(), rz_pkcs7_free_spcdata(), rz_pkcs7_free_spcmessagedigest(), rz_x509_free_certificate(), rz_x509_free_crlentry(), rz_x509_free_extension(), rz_x509_free_subjectpublickeyinfo(), and rz_x509_free_tbscertificate().
RZ_API void rz_asn1_free_object | ( | RASN1Object * | object | ) |
Definition at line 445 of file asn1.c.
References free(), i, rz_asn1_object_t::list, NULL, rz_asn1_list_t::objects, rz_asn1_free_object(), and RZ_FREE.
Referenced by cmd_print_fromage(), rz_asn1_create_object(), rz_asn1_free_object(), rz_pkcs7_parse_cms(), rz_pkcs7_parse_spcinfo(), and rz_x509_parse_certificate().
RZ_API void rz_asn1_free_string | ( | RASN1String * | string | ) |
Definition at line 313 of file astr.c.
References free(), and cmd_descs_generate::str.
Referenced by rz_asn1_concatenate_strings(), rz_asn1_to_string(), rz_pkcs7_free_attribute(), rz_pkcs7_free_cms(), rz_pkcs7_free_contentinfo(), rz_pkcs7_free_spcdata(), rz_x509_certificate_json(), rz_x509_crlentry_dump(), rz_x509_crlentry_json(), rz_x509_extensions_json(), rz_x509_free_algorithmidentifier(), rz_x509_free_crl(), rz_x509_free_crlentry(), rz_x509_free_extension(), rz_x509_free_name(), rz_x509_free_tbscertificate(), rz_x509_free_validity(), rz_x509_signedinfo_dump(), rz_x509_signedinfo_json(), rz_x509_subjectpublickeyinfo_dump(), rz_x509_subjectpublickeyinfo_json(), rz_x509_tbscertificate_dump(), and rz_x509_tbscertificate_json().
RZ_API RASN1String* rz_asn1_stringify_bits | ( | const ut8 * | buffer, |
ut32 | length | ||
) |
Definition at line 150 of file astr.c.
References c, free(), i, k, length, malloc(), NULL, rz_asn1_create_string(), cmd_descs_generate::str, and ut64().
Referenced by asn1_stringify_sector().
RZ_API RASN1String* rz_asn1_stringify_boolean | ( | const ut8 * | buffer, |
ut32 | length | ||
) |
RZ_API RASN1String* rz_asn1_stringify_bytes | ( | const ut8 * | buffer, |
ut32 | length | ||
) |
Definition at line 213 of file astr.c.
References _hex, c, free(), i, k, length, malloc(), memset(), NULL, rz_asn1_create_string(), cmd_descs_generate::str, and ut64().
Referenced by asn1_stringify_sector().
RZ_API RASN1String* rz_asn1_stringify_integer | ( | const ut8 * | buffer, |
ut32 | length | ||
) |
Definition at line 185 of file astr.c.
References _hex, c, free(), i, length, malloc(), memset(), NULL, rz_asn1_create_string(), cmd_descs_generate::str, and ut64().
Referenced by asn1_stringify_sector(), rz_x509_certificate_json(), rz_x509_crlentry_dump(), rz_x509_crlentry_json(), rz_x509_extensions_json(), rz_x509_parse_tbscertificate(), rz_x509_signedinfo_dump(), rz_x509_signedinfo_json(), rz_x509_subjectpublickeyinfo_dump(), rz_x509_subjectpublickeyinfo_json(), rz_x509_tbscertificate_dump(), and rz_x509_tbscertificate_json().
RZ_API RASN1String* rz_asn1_stringify_oid | ( | const ut8 * | buffer, |
ut32 | length | ||
) |
Definition at line 249 of file astr.c.
References ASN1_OID_LEN, bits(), c, calloc(), test_evm::end, free(), i, length, regress::m, n, newstr(), NULL, rz_asn1_create_string(), snprintf, start, cmd_descs_generate::str, ut64(), and X509OIDList.
Referenced by asn1_stringify_sector(), rz_asn1_to_string(), rz_pkcs7_parse_attribute(), rz_pkcs7_parse_cms(), rz_pkcs7_parse_contentinfo(), rz_pkcs7_parse_spcdata(), rz_x509_parse_algorithmidentifier(), rz_x509_parse_extension(), and rz_x509_parse_name().
RZ_API RASN1String* rz_asn1_stringify_string | ( | const ut8 * | buffer, |
ut32 | length | ||
) |
Definition at line 55 of file astr.c.
References length, NULL, rz_asn1_create_string(), rz_str_filter(), rz_str_ndup(), and cmd_descs_generate::str.
Referenced by asn1_stringify_sector(), rz_asn1_to_string(), and rz_x509_parse_name().
RZ_API RASN1String* rz_asn1_stringify_time | ( | const ut8 * | buffer, |
ut32 | length | ||
) |
Definition at line 108 of file astr.c.
References free(), length, malloc(), NULL, rz_asn1_create_string(), and cmd_descs_generate::str.
Referenced by asn1_stringify_sector(), rz_asn1_to_string(), and rz_x509_parse_validity().
RZ_API RASN1String* rz_asn1_stringify_utctime | ( | const ut8 * | buffer, |
ut32 | length | ||
) |
Definition at line 67 of file astr.c.
References free(), length, malloc(), NULL, rz_asn1_create_string(), and cmd_descs_generate::str.
Referenced by asn1_stringify_sector(), rz_asn1_to_string(), rz_x509_parse_crl(), rz_x509_parse_crlentry(), and rz_x509_parse_validity().
RZ_API char* rz_asn1_to_string | ( | RASN1Object * | object, |
ut32 | depth, | ||
RzStrBuf * | sb | ||
) |
Definition at line 259 of file asn1.c.
References ASN1_STD_FORMAT, CLASS_APPLICATION, CLASS_CONTEXT, CLASS_PRIVATE, CLASS_UNIVERSAL, rz_asn1_object_t::form, i, rz_asn1_object_t::klass, rz_asn1_object_t::length, rz_asn1_object_t::list, NULL, rz_asn1_list_t::objects, rz_asn1_object_t::offset, PFMT64d, root, rz_asn1_free_string(), rz_asn1_print_hex(), rz_asn1_print_hexdump_padded(), rz_asn1_print_padded(), rz_asn1_stringify_oid(), rz_asn1_stringify_string(), rz_asn1_stringify_time(), rz_asn1_stringify_utctime(), rz_asn1_to_string(), rz_str_is_printable_limited(), rz_strbuf_appendf(), rz_strbuf_drain(), rz_strbuf_new(), sb, rz_asn1_object_t::sector, snprintf, rz_asn1_string_t::string, rz_asn1_object_t::tag, TAG_BITSTRING, TAG_BMPSTRING, TAG_BOOLEAN, TAG_EMBEDDED_PDV, TAG_ENUMERATED, TAG_EOC, TAG_EXTERNAL, TAG_GENERALIZEDTIME, TAG_GENERALSTRING, TAG_GRAPHICSTRING, TAG_IA5STRING, TAG_INTEGER, TAG_NULL, TAG_NUMERICSTRING, TAG_OBJDESCRIPTOR, TAG_OCTETSTRING, TAG_OID, TAG_PRINTABLESTRING, TAG_REAL, TAG_SEQUENCE, TAG_SET, TAG_T61STRING, TAG_UNIVERSALSTRING, TAG_UTCTIME, TAG_UTF8STRING, TAG_VIDEOTEXSTRING, and TAG_VISIBLESTRING.
Referenced by cmd_print_fromage(), and rz_asn1_to_string().