23 if (!next[0] && !next[1]) {
36 return (next -
buffer) + 2;
51 object->
offset = start_pointer ? (
buffer - start_pointer) : 0;
59 object->sector =
buffer + 2;
60 if (length8 && length8 <
length - 2) {
63 for (i8 = 0; i8 < length8; i8++) {
71 object->sector += length8;
75 object->length = (
ut32)length64;
77 object->length = (
ut32)length8;
78 object->sector =
buffer + 2;
108 if (!
object || next == object->
sector) {
112 next =
object->sector +
object->length;
123 const ut8 *next =
object->sector;
124 const ut8 *
end = next +
object->length;
131 object->list.length =
count;
140 if (!inner || next == inner->
sector) {
145 object->list.objects[
i] = inner;
173 if (!
object || !object->
sector) {
183 for (
i = 0;
i <
object->length &&
p <
end;
i++) {
196 if (object->
form && !*
v) {
199 switch (object->
tag) {
222 char readable[20] = { 0 };
234 for (
i = 0, j = 0;
i <
object->length;
i++, j++) {
235 ut8 c =
object->sector[
i];
236 if (
i > 0 && (
i % 16) == 0) {
238 memset(readable, 0,
sizeof(readable));
245 while ((
i % 16) != 0) {
271 static char temp_name[4096] = { 0 };
272 const char *
name =
"";
273 const char *
string =
"";
275 switch (object->
klass) {
277 switch (object->
tag) {
284 string = (
object->sector[0] != 0) ?
"true" :
"false";
289 if (object->
length < 16) {
299 if (object->
length < 16) {
308 name =
"OCTET_STRING";
312 if (object->
length < 16) {
324 name =
"OBJECT_IDENTIFIER";
328 name =
"OBJECT_DESCRIPTOR";
341 name =
"EMBEDDED_PDV";
354 name =
"NumericString";
358 name =
"PrintableString";
362 name =
"TeletexString";
366 name =
"VideotexString";
378 name =
"GeneralizedTime";
382 name =
"GraphicString";
386 name =
"VisibleString";
390 name =
"GeneralString";
393 name =
"UniversalString";
401 snprintf(temp_name,
sizeof(temp_name),
"Universal_%u", object->
tag);
407 snprintf(temp_name,
sizeof(temp_name),
"Application_%u", object->
tag);
411 snprintf(temp_name,
sizeof(temp_name),
"Context [%u]", object->
tag);
415 snprintf(temp_name,
sizeof(temp_name),
"Private_%u", object->
tag);
425 depth, object->
form ?
"cons" :
"prim",
name,
string);
428 for (
i = 0;
i <
object->list.length;
i++) {
436 for (
i = 0;
i <
object->list.length;
i++) {
451 object->sector =
NULL;
453 for (
i = 0;
i <
object->list.length;
i++) {
458 object->list.objects =
NULL;
459 object->list.length = 0;
static int ASN1_STD_FORMAT
RZ_API char * rz_asn1_to_string(RASN1Object *object, ut32 depth, RzStrBuf *sb)
RZ_API void rz_asn1_free_object(RASN1Object *object)
static ut32 rz_asn1_count_objects(const ut8 *buffer, ut32 length)
RZ_API void asn1_setformat(int fmt)
static RASN1String * rz_asn1_print_hexdump_padded(RASN1Object *object, ut32 depth)
static void rz_asn1_print_padded(RzStrBuf *sb, RASN1Object *object, int depth, const char *k, const char *v)
RZ_API RASN1Binary * rz_asn1_create_binary(const ut8 *buffer, ut32 length)
RZ_API void rz_asn1_free_binary(RASN1Binary *bin)
RZ_API RASN1Object * rz_asn1_create_object(const ut8 *buffer, ut32 length, const ut8 *start_pointer)
RZ_API void rz_asn1_print_hex(RASN1Object *object, char *buffer, ut32 size, ut32 depth)
static RASN1Object * asn1_parse_header(const ut8 *buffer, ut32 length, const ut8 *start_pointer)
static ut32 asn1_ber_indefinite(const ut8 *buffer, ut32 length)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
RZ_API void Ht_() free(HtName_(Ht) *ht)
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void * calloc(size_t number, size_t size)
static void pad(RzStrBuf *sb, ut32 count)
#define TAG_GRAPHICSTRING
RZ_API void rz_asn1_free_string(RASN1String *string)
RZ_API RASN1String * rz_asn1_stringify_time(const ut8 *buffer, ut32 length)
#define TAG_GENERALIZEDTIME
#define TAG_GENERALSTRING
RZ_API RASN1String * rz_asn1_create_string(const char *string, bool allocated, ut32 length)
#define TAG_UNIVERSALSTRING
RZ_API RASN1String * rz_asn1_stringify_utctime(const ut8 *buffer, ut32 length)
#define TAG_OBJDESCRIPTOR
RZ_API RASN1String * rz_asn1_stringify_oid(const ut8 *buffer, ut32 length)
#define TAG_PRINTABLESTRING
#define TAG_VISIBLESTRING
RZ_API RASN1String * rz_asn1_stringify_string(const ut8 *buffer, ut32 length)
#define CLASS_APPLICATION
#define TAG_NUMERICSTRING
#define TAG_VIDEOTEXSTRING
RZ_API bool rz_str_is_printable_limited(const char *str, int size)
RZ_API const char * rz_str_trim_head_ro(const char *str)
RZ_API const char * rz_str_pad(const char ch, int len)
RZ_API RZ_OWN char * rz_strbuf_drain(RzStrBuf *sb)
RZ_API RzStrBuf * rz_strbuf_new(const char *s)
RZ_API bool rz_strbuf_appendf(RzStrBuf *sb, const char *fmt,...) RZ_PRINTF_CHECK(2
struct rz_asn1_object_t ** objects
ut64(WINAPI *w32_GetEnabledXStateFeatures)()