#include "buffer.h"#include "asn1_tool.h"

Go to the source code of this file.
Defines | |
| #define | JBXL_ASN1_ANCHOR 0xff |
| ANCHOR. | |
| #define | JBXL_ASN1_PRIMITIVE 0x00 |
| PRIMITIVE. | |
| #define | JBXL_ASN1_CNSTRCTD 0x20 |
| CONSTRUCTED 構造化フラグ. | |
| #define | JBXL_ASN1_UNIVERSAL 0x00 |
| UNIVERSAL. | |
| #define | JBXL_ASN1_APPLI 0x40 |
| APPLICATION. | |
| #define | JBXL_ASN1_CONTEXT 0x80 |
| CONTEXT-DEFINED. | |
| #define | JBXL_ASN1_PRIVATE 0xc0 |
| PRIVATE. | |
| #define | JBXL_ASN1_END 0x00 |
| DATA_END. | |
| #define | JBXL_ASN1_BOOL 0x01 |
| BOOLEAN. | |
| #define | JBXL_ASN1_INT 0x02 |
| INTEGER. | |
| #define | JBXL_ASN1_BIT 0x03 |
| BIT_STRING. | |
| #define | JBXL_ASN1_OCT 0x04 |
| OCTET_STRING. | |
| #define | JBXL_ASN1_NULL 0x05 |
| NULL. | |
| #define | JBXL_ASN1_OBJ 0x06 |
| OBJECT_IDENTIFIER. | |
| #define | JBXL_ASN1_DSC 0x07 |
| OBJECT_DESCRITOR. | |
| #define | JBXL_ASN1_EXT 0x08 |
| EXTERNAL. | |
| #define | JBXL_ASN1_REAL 0x09 |
| REAL. | |
| #define | JBXL_ASN1_ENU 0x0a |
| ENUMERATED. | |
| #define | JBXL_ASN1_EMB 0x0b |
| EMBEDDED_PDV. | |
| #define | JBXL_ASN1_UTF8 0x0c |
| UTF8_STRING. | |
| #define | JBXL_ASN1_OID 0x0d |
| RELATIVE-OID. | |
| #define | JBXL_ASN1_SEQ 0x10 |
| SEQUENCE. | |
| #define | JBXL_ASN1_SET 0x11 |
| SET. | |
| #define | JBXL_ASN1_NMSTR 0x12 |
| NUMERIC_STRING. | |
| #define | JBXL_ASN1_PRSTR 0x13 |
| PRINTABLE_STRING. | |
| #define | JBXL_ASN1_TLSTR 0x14 |
| TELETEX_STRING. | |
| #define | JBXL_ASN1_VDSTR 0x15 |
| VIDEOTEX_STRING. | |
| #define | JBXL_ASN1_IA5 0x16 |
| IA5_STRING. | |
| #define | JBXL_ASN1_UTC 0x17 |
| UTC_TIME. | |
| #define | JBXL_ASN1_GTM 0x18 |
| GENERALIZED_TIME. | |
| #define | JBXL_ASN1_GRSTR 0x19 |
| GRAPHIC_STRING. | |
| #define | JBXL_ASN1_VSSTR 0x1a |
| VISIBLE_STRING. | |
| #define | JBXL_ASN1_GNSTR 0x1b |
| GENERAL_STRING. | |
| #define | JBXL_ASN1_UNSTR 0x1c |
| UNIVERSAL_STRING. | |
| #define | JBXL_ASN1_CHSTR 0x1d |
| CHARACTER_STRING. | |
| #define | JBXL_ASN1_BMSTR 0x1e |
| BMP_STRING. | |
| #define | JBXL_ASN1_SEQ_CNSTRCTD 0x30 |
| SEQUENCE + CONSTRUCTED (構造化フラグ). | |
| #define | JBXL_ASN1_SET_CNSTRCTD 0x31 |
| SET + CONSTRUCTED (構造化フラグ). | |
Functions | |
| void | asn1_print_id (FILE *fp, int id) |
| void | asn1_id_type (int id, int *type, int *cnst, int *tag) |
| void | asn1_print_tag_value (FILE *fp, int tag, Buffer buf) |
| #define JBXL_ASN1_ANCHOR 0xff |
Definition at line 12 of file asn1_node.h.
Referenced by DER_parse().
| #define JBXL_ASN1_APPLI 0x40 |
Definition at line 18 of file asn1_node.h.
| #define JBXL_ASN1_BIT 0x03 |
Definition at line 25 of file asn1_node.h.
Referenced by get_DHYkey(), get_size_toDER(), join_DHpubkey(), and node2DER().
| #define JBXL_ASN1_BMSTR 0x1e |
Definition at line 51 of file asn1_node.h.
| #define JBXL_ASN1_BOOL 0x01 |
Definition at line 23 of file asn1_node.h.
| #define JBXL_ASN1_CHSTR 0x1d |
Definition at line 50 of file asn1_node.h.
| #define JBXL_ASN1_CNSTRCTD 0x20 |
Definition at line 15 of file asn1_node.h.
Referenced by _DER_parse_children(), and asn1_id_type().
| #define JBXL_ASN1_CONTEXT 0x80 |
Definition at line 19 of file asn1_node.h.
| #define JBXL_ASN1_DSC 0x07 |
Definition at line 29 of file asn1_node.h.
| #define JBXL_ASN1_EMB 0x0b |
Definition at line 33 of file asn1_node.h.
| #define JBXL_ASN1_END 0x00 |
Definition at line 22 of file asn1_node.h.
| #define JBXL_ASN1_ENU 0x0a |
Definition at line 32 of file asn1_node.h.
| #define JBXL_ASN1_EXT 0x08 |
Definition at line 30 of file asn1_node.h.
| #define JBXL_ASN1_GNSTR 0x1b |
Definition at line 48 of file asn1_node.h.
| #define JBXL_ASN1_GRSTR 0x19 |
Definition at line 46 of file asn1_node.h.
| #define JBXL_ASN1_GTM 0x18 |
Definition at line 45 of file asn1_node.h.
| #define JBXL_ASN1_IA5 0x16 |
Definition at line 43 of file asn1_node.h.
| #define JBXL_ASN1_INT 0x02 |
Definition at line 24 of file asn1_node.h.
Referenced by asn1_print_tag_value(), get_DHGkey(), get_DHPkey(), get_DHYkey(), join_DHpubkey(), and node2DER().
| #define JBXL_ASN1_NMSTR 0x12 |
Definition at line 39 of file asn1_node.h.
| #define JBXL_ASN1_NULL 0x05 |
Definition at line 27 of file asn1_node.h.
| #define JBXL_ASN1_OBJ 0x06 |
Definition at line 28 of file asn1_node.h.
Referenced by get_DHalgorism(), get_DHGkey(), and get_DHPkey().
| #define JBXL_ASN1_OCT 0x04 |
Definition at line 26 of file asn1_node.h.
Referenced by asn1_print_tag_value().
| #define JBXL_ASN1_OID 0x0d |
Definition at line 35 of file asn1_node.h.
| #define JBXL_ASN1_PRIMITIVE 0x00 |
Definition at line 14 of file asn1_node.h.
| #define JBXL_ASN1_PRIVATE 0xc0 |
Definition at line 20 of file asn1_node.h.
| #define JBXL_ASN1_PRSTR 0x13 |
Definition at line 40 of file asn1_node.h.
| #define JBXL_ASN1_REAL 0x09 |
Definition at line 31 of file asn1_node.h.
| #define JBXL_ASN1_SEQ 0x10 |
Definition at line 36 of file asn1_node.h.
| #define JBXL_ASN1_SEQ_CNSTRCTD 0x30 |
Definition at line 53 of file asn1_node.h.
Referenced by get_DHalgorism(), get_DHGkey(), get_DHPkey(), get_DHYkey(), and join_DHpubkey().
| #define JBXL_ASN1_SET 0x11 |
Definition at line 37 of file asn1_node.h.
| #define JBXL_ASN1_SET_CNSTRCTD 0x31 |
Definition at line 54 of file asn1_node.h.
| #define JBXL_ASN1_TLSTR 0x14 |
Definition at line 41 of file asn1_node.h.
| #define JBXL_ASN1_UNIVERSAL 0x00 |
Definition at line 17 of file asn1_node.h.
| #define JBXL_ASN1_UNSTR 0x1c |
Definition at line 49 of file asn1_node.h.
| #define JBXL_ASN1_UTC 0x17 |
Definition at line 44 of file asn1_node.h.
| #define JBXL_ASN1_UTF8 0x0c |
Definition at line 34 of file asn1_node.h.
| #define JBXL_ASN1_VDSTR 0x15 |
Definition at line 42 of file asn1_node.h.
| #define JBXL_ASN1_VSSTR 0x1a |
Definition at line 47 of file asn1_node.h.
| void asn1_id_type | ( | int | id, | |
| int * | type, | |||
| int * | cnst, | |||
| int * | tag | |||
| ) |
Definition at line 64 of file asn1_node.c.
References JBXL_ASN1_CNSTRCTD.
Referenced by asn1_print_id().
00065 { 00066 if (cnst!=NULL) { 00067 if (id & JBXL_ASN1_CNSTRCTD) *cnst = 1; // Constructed 00068 else *cnst = 0; 00069 } 00070 if (type!=NULL) *type = (id & 0xc0) >> 6; // Class Type 00071 if (tag!=NULL) *tag = id & 0x1f; // Tag 00072 00073 return; 00074 }

| void asn1_print_id | ( | FILE * | fp, | |
| int | id | |||
| ) |
Definition at line 77 of file asn1_node.c.
References _ASN1_NODE_CLASS, _ASN1_NODE_CONST, _ASN1_NODE_TAG, and asn1_id_type().
Referenced by print_tDER().
00078 { 00079 int cnst, type, tag; 00080 00081 asn1_id_type(id, &type, &cnst, &tag); 00082 00083 fprintf(fp, "[%02x] ", id); // Identifier data 00084 fprintf(fp, "%s ", _ASN1_NODE_CLASS[type]); // Class 00085 fprintf(fp, "%s ", _ASN1_NODE_CONST[cnst]); // Primitive/Constructed 00086 if (type==0x00) fprintf(fp, "%s ", _ASN1_NODE_TAG[tag]); // Tag: if Class is UNIVERSAL 00087 else fprintf(fp, "(%02x) ", tag); // 00088 00089 return; 00090 }


| void asn1_print_tag_value | ( | FILE * | fp, | |
| int | tag, | |||
| Buffer | buf | |||
| ) |
Definition at line 94 of file asn1_node.c.
References bin2int_DER(), Buffer::buf, JBXL_ASN1_INT, JBXL_ASN1_OCT, and Buffer::vldsz.
Referenced by print_tDER().
00095 { 00096 if (buf.vldsz<=0) return; 00097 00098 fprintf(fp, ": "); 00099 00100 int tag = id & 0x1f; 00101 if (tag==JBXL_ASN1_INT) { 00102 long int n = bin2int_DER(buf); 00103 fprintf(fp, "INT = %ld ", n); 00104 } 00105 else if (tag==JBXL_ASN1_OCT) { 00106 if (buf.buf!=NULL) fprintf(fp, "\"%s\" ", buf.buf); 00107 else fprintf(fp, "\"\" "); 00108 } 00109 else if (buf.buf!=NULL) { // その他 00110 fprintf(fp, "....... "); 00111 } 00112 00113 return; 00114 }


1.6.1