ExtendLib/xLib/asn1_node.h File Reference

#include "buffer.h"
#include "asn1_tool.h"
Include dependency graph for asn1_node.h:
This graph shows which files directly or indirectly include this file:

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_node_type (int node, int *cnst, int *type, int *name)
void asn1_print_node (FILE *fp, int node)
void asn1_print_node_value (FILE *fp, int node, Buffer buf)

Define Documentation

#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_size_toDER(), 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_node_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_node_value(), 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.

#define JBXL_ASN1_OCT   0x04

Definition at line 26 of file asn1_node.h.

Referenced by asn1_print_node_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.

#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.


Function Documentation

void asn1_node_type ( int  node,
int *  cnst,
int *  type,
int *  name 
)

Definition at line 65 of file asn1_node.cpp.

References JBXL_ASN1_CNSTRCTD.

Referenced by asn1_print_node().

00066 {
00067     if (cnst!=NULL) {
00068         if (node & JBXL_ASN1_CNSTRCTD) *cnst = 1;
00069         else *cnst = 0;
00070     }
00071     if (type!=NULL) *type = (node & 0xc0) >> 6;
00072     if (name!=NULL) *name = node & 0x1f;
00073 
00074     return;
00075 }

Here is the caller graph for this function:

void asn1_print_node ( FILE *  fp,
int  node 
)

Definition at line 78 of file asn1_node.cpp.

References _ASN1_NODE_CONST, _ASN1_NODE_NAME, _ASN1_NODE_TYPE, and asn1_node_type().

Referenced by print_tDER().

00079 {
00080     int cnst, type, name;
00081 
00082     asn1_node_type(node, &cnst, &type, &name);
00083 
00084     if (cnst==1) fprintf(fp, "%s ", _ASN1_NODE_CONST[cnst]);
00085     fprintf(fp, "%s ", _ASN1_NODE_TYPE[type]);
00086     if (type==0x00) fprintf(fp, "%s ", _ASN1_NODE_NAME[name]);
00087     else fprintf(fp, "%d ", name);
00088     fprintf(fp, "(%02x) ", node);
00089 
00090     return;
00091 }

Here is the call graph for this function:

Here is the caller graph for this function:

void asn1_print_node_value ( FILE *  fp,
int  node,
Buffer  buf 
)

Definition at line 95 of file asn1_node.cpp.

References bin2int_DER(), Buffer::buf, JBXL_ASN1_INT, and JBXL_ASN1_OCT.

Referenced by print_tDER().

00096 {
00097     fprintf(fp, ": ");
00098 
00099     if (node==JBXL_ASN1_INT) {
00100         long int n = bin2int_DER(buf);
00101         fprintf(fp, "INT = %ld ", n);
00102     }
00103     else if (node==JBXL_ASN1_OCT) {
00104         if (buf.buf!=NULL) fprintf(fp, "\"%s\" ", buf.buf);
00105         else               fprintf(fp, "\"\" ");
00106     }
00107     else if (buf.buf!=NULL) {               // その他
00108         fprintf(fp, "....... ");
00109     }
00110 
00111     return;
00112 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on 15 Nov 2023 for JunkBox_Lib++ (for Windows) by  doxygen 1.6.1