#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
Data Structures | |
struct | ASN1_ITEM |
struct | tagOIDINFO |
Defines | |
#define | FALSE 0 |
#define | TRUE ( !FALSE ) |
#define | SEEK_SET 0 |
#define | SEEK_CUR 2 |
#define | EXIT_FAILURE 1 |
#define | EXIT_SUCCESS ( !EXIT_FAILURE ) |
#define | FILENAME_MAX 512 |
#define | min(a, b) ( ( a ) < ( b ) ? ( a ) : ( b ) ) |
#define | LENGTH_MAGIC 177545L |
#define | CLASS_MASK 0xC0 |
#define | UNIVERSAL 0x00 |
#define | APPLICATION 0x40 |
#define | CONTEXT 0x80 |
#define | PRIVATE 0xC0 |
#define | FORM_MASK 0x20 |
#define | PRIMITIVE 0x00 |
#define | CONSTRUCTED 0x20 |
#define | TAG_MASK 0x1F |
#define | EOC 0x00 |
#define | BOOLEAN 0x01 |
#define | INTEGER 0x02 |
#define | BITSTRING 0x03 |
#define | OCTETSTRING 0x04 |
#define | NULLTAG 0x05 |
#define | OID 0x06 |
#define | OBJDESCRIPTOR 0x07 |
#define | EXTERNAL 0x08 |
#define | REAL 0x09 |
#define | ENUMERATED 0x0A |
#define | EMBEDDED_PDV 0x0B |
#define | UTF8STRING 0x0C |
#define | SEQUENCE 0x10 |
#define | SET 0x11 |
#define | NUMERICSTRING 0x12 |
#define | PRINTABLESTRING 0x13 |
#define | T61STRING 0x14 |
#define | VIDEOTEXSTRING 0x15 |
#define | IA5STRING 0x16 |
#define | UTCTIME 0x17 |
#define | GENERALIZEDTIME 0x18 |
#define | GRAPHICSTRING 0x19 |
#define | VISIBLESTRING 0x1A |
#define | GENERALSTRING 0x1B |
#define | UNIVERSALSTRING 0x1C |
#define | BMPSTRING 0x1E |
#define | LEN_XTND 0x80 |
#define | LEN_MASK 0x7F |
#define | MAX_OID_SIZE 32 |
#define | CONFIG_NAME "dumpasn1.cfg" |
#define | isEnvTerminator(c) |
#define | P 1 |
#define | I 2 |
#define | PI 3 |
#define | CPM_EOF 0x1A |
#define | MAX_LINESIZE 512 |
Typedefs | |
typedef tagOIDINFO | OIDINFO |
Enumerations | |
enum | STR_OPTION { STR_NONE, STR_UTCTIME, STR_PRINTABLE, STR_IA5, STR_BMP } |
Functions | |
char * | idstr (const int tagID) |
static OIDINFO * | getOIDinfo (char *oid, const int oidLength) |
static int | addAttribute (char **buffer, char *attribute) |
static int | isPrintable (int ch) |
static int | isIA5 (int ch) |
static int | readLine (FILE *file, char *buffer) |
static int | processHexOID (OIDINFO *oidInfo, char *string) |
static int | readConfig (const char *path, const int isDefaultConfig) |
static int | testConfigPath (const char *path) |
static void | buildConfigPath (char *path, const char *pathTemplate) |
static int | readGlobalConfig (const char *path) |
static void | doIndent (const int level) |
static void | complain (const char *message, const int level) |
static void | dumpHex (FILE *inFile, long length, int level, int isInteger) |
static void | dumpBitString (FILE *inFile, const int length, const int unused, const int level) |
static void | displayString (FILE *inFile, long length, int level, STR_OPTION strOption) |
static long | getValue (FILE *inFile, const long length) |
int | getItem (FILE *inFile, ASN1_ITEM *item) |
static int | checkEncapsulate (FILE *inFile, const int tag, const int length) |
int | zeroLengthOK (const ASN1_ITEM *item) |
static int | looksLikeText (FILE *inFile, const int length) |
static void | dumpHeader (FILE *inFile, const ASN1_ITEM *item) |
int | printAsn1 (FILE *inFile, const int level, long length, const int isIndefinite) |
static void | printConstructed (FILE *inFile, int level, const ASN1_ITEM *item) |
void | printASN1object (FILE *inFile, ASN1_ITEM *item, int level) |
void | usageExit (void) |
int | main (int argc, char *argv[]) |
Variables | |
static int | printDots = 0 |
static int | doPure = 0 |
static int | doDumpHeader = 0 |
static int | extraOIDinfo = 0 |
static int | doHexValues = 0 |
static int | useStdin = 0 |
static int | zeroLengthAllowed = 0 |
static int | dumpText = 0 |
static int | printAllData = 0 |
static int | checkEncaps = ( ! 0 ) |
static int | noErrors = 0 |
static int | noWarnings = 0 |
static int | fPos = 0 |
static FILE * | output |
static OIDINFO * | oidList = NULL |
static const char * | configPaths [] |
static int | charFlags [] |
static int | lineNo |
|
Definition at line 100 of file dumpasn1.c. |
|
Definition at line 116 of file dumpasn1.c. Referenced by checkEncapsulate(), idstr(), and printASN1object(). |
|
Definition at line 139 of file dumpasn1.c. Referenced by idstr(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 114 of file dumpasn1.c. Referenced by idstr(), and printASN1object(). |
|
Definition at line 98 of file dumpasn1.c. Referenced by checkEncapsulate(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 211 of file dumpasn1.c. Referenced by buildConfigPath(), and readGlobalConfig(). |
|
Definition at line 108 of file dumpasn1.c. Referenced by checkEncapsulate(), and printASN1object(). |
|
Definition at line 101 of file dumpasn1.c. Referenced by checkEncapsulate(). |
|
Definition at line 386 of file dumpasn1.c. Referenced by readLine(). |
|
Definition at line 124 of file dumpasn1.c. Referenced by idstr(). |
|
Definition at line 123 of file dumpasn1.c. Referenced by checkEncapsulate(), idstr(), and printASN1object(). |
|
Definition at line 113 of file dumpasn1.c. Referenced by idstr(), printAsn1(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 58 of file dumpasn1.c. |
|
Definition at line 59 of file dumpasn1.c. Referenced by main(), and rpmcliAllArgCallback(). |
|
Definition at line 121 of file dumpasn1.c. Referenced by idstr(). |
|
Definition at line 43 of file dumpasn1.c. Referenced by addAttribute(), checkEncapsulate(), displayString(), dumpHex(), getItem(), isIA5(), isPrintable(), looksLikeText(), main(), printAsn1(), printASN1object(), processHexOID(), readConfig(), readLine(), testConfigPath(), and zeroLengthOK(). |
|
Definition at line 62 of file dumpasn1.c. Referenced by buildConfigPath(), and readGlobalConfig(). |
|
Definition at line 106 of file dumpasn1.c. Referenced by printASN1object(). |
|
Definition at line 134 of file dumpasn1.c. Referenced by checkEncapsulate(), idstr(), and printASN1object(). |
|
Definition at line 137 of file dumpasn1.c. Referenced by idstr(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 135 of file dumpasn1.c. Referenced by idstr(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 341 of file dumpasn1.c. Referenced by isIA5(). |
|
Definition at line 132 of file dumpasn1.c. Referenced by checkEncapsulate(), idstr(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 115 of file dumpasn1.c. Referenced by checkEncapsulate(), idstr(), and printASN1object(). |
|
Value: ( ( ( c ) == '/' ) || ( ( c ) == '.' ) || ( ( c ) == '$' ) || \ ( ( c ) == '\0' ) || ( ( c ) == '~' ) ) Definition at line 235 of file dumpasn1.c. Referenced by buildConfigPath(). |
|
Definition at line 144 of file dumpasn1.c. Referenced by getItem(). |
|
Definition at line 143 of file dumpasn1.c. Referenced by getItem(). |
|
Definition at line 94 of file dumpasn1.c. Referenced by main(), and printAsn1(). |
|
Definition at line 390 of file dumpasn1.c. Referenced by buildConfigPath(), readConfig(), and readLine(). |
|
Definition at line 195 of file dumpasn1.c. Referenced by printASN1object(), and processHexOID(). |
|
Definition at line 80 of file dumpasn1.c. Referenced by looksLikeText(), and vfs_parse_ls_lga(). |
|
Definition at line 118 of file dumpasn1.c. Referenced by idstr(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 128 of file dumpasn1.c. Referenced by idstr(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 120 of file dumpasn1.c. Referenced by idstr(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 117 of file dumpasn1.c. Referenced by checkEncapsulate(), idstr(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 119 of file dumpasn1.c. Referenced by checkEncapsulate(), idstr(), and printASN1object(). |
|
Definition at line 340 of file dumpasn1.c. Referenced by isPrintable(). |
|
Definition at line 342 of file dumpasn1.c. |
|
Definition at line 107 of file dumpasn1.c. |
|
Definition at line 129 of file dumpasn1.c. Referenced by idstr(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 102 of file dumpasn1.c. |
|
Definition at line 122 of file dumpasn1.c. Referenced by idstr(), and zeroLengthOK(). |
|
Definition at line 55 of file dumpasn1.c. |
|
Definition at line 54 of file dumpasn1.c. |
|
Definition at line 126 of file dumpasn1.c. Referenced by checkEncapsulate(), idstr(), and zeroLengthOK(). |
|
Definition at line 127 of file dumpasn1.c. Referenced by fts_build(), Fts_children(), Fts_open(), Fts_read(), idstr(), and zeroLengthOK(). |
|
Definition at line 130 of file dumpasn1.c. Referenced by idstr(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 112 of file dumpasn1.c. Referenced by getItem(). |
|
Definition at line 44 of file dumpasn1.c. Referenced by addAttribute(), checkEncapsulate(), displayString(), dumpHex(), getItem(), isIA5(), isPrintable(), looksLikeText(), main(), printAsn1(), printASN1object(), processHexOID(), readConfig(), readGlobalConfig(), readLine(), testConfigPath(), and zeroLengthOK(). |
|
Definition at line 99 of file dumpasn1.c. Referenced by checkEncapsulate(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 138 of file dumpasn1.c. Referenced by idstr(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 133 of file dumpasn1.c. Referenced by idstr(), and printASN1object(). |
|
Definition at line 125 of file dumpasn1.c. Referenced by idstr(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 131 of file dumpasn1.c. Referenced by idstr(), printASN1object(), and zeroLengthOK(). |
|
Definition at line 136 of file dumpasn1.c. Referenced by idstr(), printASN1object(), and zeroLengthOK(). |
|
|
|
Definition at line 148 of file dumpasn1.c. |
|
Definition at line 327 of file dumpasn1.c. Referenced by readConfig(). |
|
Definition at line 626 of file dumpasn1.c. References CONFIG_NAME, FILENAME_MAX, getenv(), isEnvTerminator, and MAX_LINESIZE. Referenced by readGlobalConfig(). |
|
Definition at line 1136 of file dumpasn1.c. References BITSTRING, checkEncaps, CLASS_MASK, CONSTRUCTED, CONTEXT, ENUMERATED, FALSE, fPos, GENERALIZEDTIME, getItem(), IA5STRING, ASN1_ITEM::id, INTEGER, ASN1_ITEM::length, OCTETSTRING, OID, SEEK_CUR, SEQUENCE, ASN1_ITEM::tag, TRUE, and UNIVERSAL. Referenced by printASN1object(). |
|
Definition at line 739 of file dumpasn1.c. References doIndent(), doPure, noErrors, and output. Referenced by displayString(), dumpBitString(), dumpHex(), and printASN1object(). |
|
Definition at line 920 of file dumpasn1.c. References complain(), doIndent(), doPure, FALSE, fPos, isIA5(), isPrintable(), output, STR_BMP, STR_IA5, STR_PRINTABLE, STR_UTCTIME, and TRUE. Referenced by printASN1object(). |
|
Definition at line 729 of file dumpasn1.c. References output, and printDots. Referenced by complain(), displayString(), dumpBitString(), dumpHex(), printAsn1(), printASN1object(), and printConstructed(). |
|
Definition at line 842 of file dumpasn1.c. References complain(), doIndent(), doPure, fPos, and output. Referenced by printASN1object(). |
|
Definition at line 1277 of file dumpasn1.c. References doDumpHeader, doPure, ASN1_ITEM::header, ASN1_ITEM::headerSize, ASN1_ITEM::indefinite, ASN1_ITEM::length, output, and SEEK_CUR. Referenced by printAsn1(). |
|
Definition at line 750 of file dumpasn1.c. References complain(), doIndent(), doPure, dumpText, FALSE, fPos, output, printAllData, SEEK_CUR, TRUE, and useStdin. Referenced by printASN1object(). |
|
Definition at line 1071 of file dumpasn1.c. References FALSE, fPos, ASN1_ITEM::header, ASN1_ITEM::headerSize, ASN1_ITEM::id, ASN1_ITEM::indefinite, LEN_MASK, LEN_XTND, ASN1_ITEM::length, ASN1_ITEM::tag, TAG_MASK, and TRUE. Referenced by checkEncapsulate(), main(), and printAsn1(). |
|
Definition at line 312 of file dumpasn1.c. References tagOIDINFO::next, tagOIDINFO::oid, and tagOIDINFO::oidLength. Referenced by printASN1object(). |
|
Definition at line 1054 of file dumpasn1.c. References fPos. Referenced by printASN1object(). |
|
Definition at line 247 of file dumpasn1.c. References BITSTRING, BMPSTRING, BOOLEAN, EMBEDDED_PDV, ENUMERATED, EOC, EXTERNAL, GENERALIZEDTIME, GENERALSTRING, GRAPHICSTRING, IA5STRING, INTEGER, NULLTAG, NUMERICSTRING, OBJDESCRIPTOR, OCTETSTRING, OID, PRINTABLESTRING, REAL, SEQUENCE, SET, T61STRING, UNIVERSALSTRING, UTCTIME, UTF8STRING, VIDEOTEXSTRING, and VISIBLESTRING. Referenced by printASN1object(). |
|
Definition at line 370 of file dumpasn1.c. References charFlags, FALSE, I, and TRUE. Referenced by displayString(). |
|
Definition at line 363 of file dumpasn1.c. References charFlags, FALSE, P, and TRUE. Referenced by displayString(). |
|
Definition at line 1249 of file dumpasn1.c. References FALSE, min, SEEK_CUR, and TRUE. Referenced by printASN1object(). |
|
Definition at line 1740 of file dumpasn1.c. References checkEncaps, doDumpHeader, doHexValues, doPure, dumpText, EXIT_FAILURE, EXIT_SUCCESS, extraOIDinfo, FALSE, getItem(), ASN1_ITEM::header, ASN1_ITEM::headerSize, ASN1_ITEM::indefinite, ASN1_ITEM::length, LENGTH_MAGIC, noErrors, noWarnings, output, printAllData, printAsn1(), printDots, readConfig(), readGlobalConfig(), SEEK_SET, TRUE, usageExit(), useStdin, and zeroLengthAllowed. |
|
Definition at line 1608 of file dumpasn1.c. References doDumpHeader, doHexValues, doIndent(), doPure, dumpHeader(), EOC, EXIT_FAILURE, FALSE, fPos, getItem(), ASN1_ITEM::headerSize, ASN1_ITEM::id, ASN1_ITEM::indefinite, ASN1_ITEM::length, LENGTH_MAGIC, noErrors, output, printASN1object(), ASN1_ITEM::tag, and TRUE. Referenced by main(), and printConstructed(). |
|
Definition at line 1346 of file dumpasn1.c. References BITSTRING, BMPSTRING, BOOLEAN, checkEncapsulate(), CLASS_MASK, tagOIDINFO::comment, complain(), CONSTRUCTED, tagOIDINFO::description, displayString(), doIndent(), doPure, dumpBitString(), dumpHex(), dumpText, ENUMERATED, EOC, EXIT_FAILURE, extraOIDinfo, FALSE, FORM_MASK, fPos, GENERALIZEDTIME, GENERALSTRING, getOIDinfo(), getValue(), GRAPHICSTRING, ASN1_ITEM::header, ASN1_ITEM::headerSize, IA5STRING, ASN1_ITEM::id, idstr(), ASN1_ITEM::indefinite, INTEGER, ASN1_ITEM::length, looksLikeText(), MAX_OID_SIZE, noErrors, noWarnings, NULLTAG, NUMERICSTRING, OBJDESCRIPTOR, OCTETSTRING, OID, output, PRINTABLESTRING, printConstructed(), STR_BMP, STR_IA5, STR_NONE, STR_PRINTABLE, STR_UTCTIME, T61STRING, ASN1_ITEM::tag, TRUE, UNIVERSAL, UNIVERSALSTRING, useStdin, UTCTIME, UTF8STRING, VIDEOTEXSTRING, VISIBLESTRING, tagOIDINFO::warn, and zeroLengthOK(). Referenced by printAsn1(). |
|
Definition at line 1318 of file dumpasn1.c. References doIndent(), doPure, ASN1_ITEM::indefinite, ASN1_ITEM::length, noErrors, output, printAsn1(), and printDots. Referenced by printASN1object(). |
|
Definition at line 461 of file dumpasn1.c. References FALSE, lineNo, MAX_OID_SIZE, tagOIDINFO::oid, tagOIDINFO::oidLength, and TRUE. Referenced by readConfig(). |
|
Definition at line 492 of file dumpasn1.c. References addAttribute(), FALSE, file, lineNo, MAX_LINESIZE, tagOIDINFO::next, processHexOID(), readLine(), and TRUE. Referenced by main(), and readGlobalConfig(). |
|
Definition at line 687 of file dumpasn1.c. References buildConfigPath(), CONFIG_NAME, configPaths, FILENAME_MAX, readConfig(), testConfigPath(), and TRUE. Referenced by main(). |
|
Definition at line 396 of file dumpasn1.c. References CPM_EOF, FALSE, lineNo, MAX_LINESIZE, and TRUE. |
|
Definition at line 612 of file dumpasn1.c. References FALSE, file, and TRUE. Referenced by readGlobalConfig(). |
|
Definition at line 1710 of file dumpasn1.c. References EXIT_FAILURE. Referenced by main(). |
|
Definition at line 1207 of file dumpasn1.c. References BMPSTRING, CLASS_MASK, EOC, FALSE, GENERALSTRING, GRAPHICSTRING, IA5STRING, ASN1_ITEM::id, NULLTAG, NUMERICSTRING, OBJDESCRIPTOR, OCTETSTRING, PRINTABLESTRING, REAL, SEQUENCE, SET, T61STRING, ASN1_ITEM::tag, TRUE, UNIVERSAL, UNIVERSALSTRING, UTF8STRING, VIDEOTEXSTRING, VISIBLESTRING, and zeroLengthAllowed. Referenced by printASN1object(). |
|
Initial value: { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3 , 2 , 2 , 2 , 2 , 2 , 2 , 3 , 3 , 3 , 2 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 2 , 2 , 3 , 2 , 3 , 2 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 2 , 2 , 2 , 2 , 2 , 2 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 2 , 2 , 2 , 2 , 0 } Definition at line 344 of file dumpasn1.c. Referenced by isIA5(), and isPrintable(). |
|
Definition at line 178 of file dumpasn1.c. Referenced by checkEncapsulate(), and main(). |
|
Initial value: { "/bin/", "/usr/bin/", "/usr/local/bin/", "c:\\dos\\", "d:\\dos\\", "c:\\windows\\", "d:\\windows\\", "c:\\winnt\\", "d:\\winnt\\", "$HOME/BIN/", "c:\\program files\\bin\\", "$HOME/", "$HOME/bin/", "$DUMPASN1_PATH/", NULL } Definition at line 213 of file dumpasn1.c. Referenced by readGlobalConfig(). |
|
Definition at line 171 of file dumpasn1.c. Referenced by dumpHeader(), main(), and printAsn1(). |
|
Definition at line 173 of file dumpasn1.c. Referenced by main(), and printAsn1(). |
|
Definition at line 170 of file dumpasn1.c. Referenced by complain(), displayString(), dumpBitString(), dumpHeader(), dumpHex(), main(), printAsn1(), printASN1object(), and printConstructed(). |
|
Definition at line 176 of file dumpasn1.c. Referenced by dumpHex(), main(), and printASN1object(). |
|
Definition at line 172 of file dumpasn1.c. Referenced by main(), and printASN1object(). |
|
Definition at line 187 of file dumpasn1.c. Referenced by checkEncapsulate(), displayString(), dumpBitString(), dumpHex(), getItem(), getValue(), printAsn1(), and printASN1object(). |
|
Definition at line 394 of file dumpasn1.c. Referenced by processHexOID(), readConfig(), and readLine(). |
|
Definition at line 182 of file dumpasn1.c. Referenced by complain(), main(), printAsn1(), printASN1object(), and printConstructed(). |
|
Definition at line 183 of file dumpasn1.c. Referenced by main(), and printASN1object(). |
|
Definition at line 204 of file dumpasn1.c. |
|
Definition at line 191 of file dumpasn1.c. Referenced by complain(), displayString(), doIndent(), dumpBitString(), dumpHeader(), dumpHex(), main(), printAsn1(), printASN1object(), and printConstructed(). |
|
Definition at line 177 of file dumpasn1.c. |
|
Definition at line 169 of file dumpasn1.c. Referenced by doIndent(), main(), and printConstructed(). |
|
Definition at line 174 of file dumpasn1.c. Referenced by dumpHex(), main(), and printASN1object(). |
|
Definition at line 175 of file dumpasn1.c. Referenced by main(), and zeroLengthOK(). |