First public contribution.
3 This Perl application recursively parses a set of text files translating the
4 contents into a DER encoding. This should now support all of the ASN.1
5 tags required to create a PKCS#12 file.
11 * tabs + whitespace up to command ignored
13 * $1 .. $N for textual substitution of args
14 * escape character is \
17 Simple types are of the form
18 SIMPLE_COMMAND=arg1,arg2,arg3
23 Output an DER bit string
24 ARG0=A sequence of 0s and 1s.
26 Encodes ascii text as BMPSTRING
27 ARG0=ascii text to encode
29 Includes a BMPSTRING file as a BMPSTRING element
30 ARG0=name of file to include
32 Encodes and enumerated value
33 ARG0=integer value of enum
35 Encodes ascii text as BMPSTRING
36 ARG0=ascii text to encode
38 Includes a IA5STRING file as an IA5STRING element
39 ARG0=name of file to include
41 Includes raw binary data from a file
42 ARG0=filename to include
45 ARG0=Integer in decimal or hex format (leading 0x)
47 A null entry (no args)
49 An ASN.1 object identifier
50 ARG0=Raw form (1.2.840.113549.1) or one of the defined key words (look in the source)
52 Encodes ascii text as PRINTABLESTRING
53 ARG0=ascii text to encode
55 Includes a UTF8STRING file as an UTF8STRING element
56 ARG0=name of file to include
58 Allows raw hex to be inserted into the file
59 ARG0=AA:BB:CC:DD:EE:FF
61 Encodes a utc time. N.B. no attempt is made to validate the format of the time.
64 Encodes ascii text as UTF8STRING
65 ARG0=ascii text to encode
67 Includes a UTF8STRING file as an UTF8STRING element
68 ARG0=name of file to include
71 Compound types are of the form and apply an encoding to the result of
72 recursively concatenating the embedded types.
85 Wraps the nested content inside a BITSTRING
87 Allows nesting of dergen script file. Arguments may also be passed for textual substitution. Refer to arguments as $1 .. $N
88 ARG0=filename to include
89 ARG1 (optional)=argument to subtitute for $1 in include file
90 ARGN (optional)=argument
93 Changes the tag of the embedded type according to the tag number and class arguments.
94 The default tag number is 0 and the default class is CONTEXT-SPECIFIC.
95 ARG1 (optional)=tag nummber (in hex)
96 ARG2 (optional)=class (UNIVERSAL,APPLICATION,CONTEXT-SPECIFIC,PRIVATE)
99 Encrypts the nested data. (Requires OpenSSL)
100 ARG0=cipher (as defined by openssl without the leading hyphen)
104 Wraps the embedded type with a new tag defined by the tag number and class arguments.
105 The default tag number is 0 and the default class is CONTEXT-SPECIFIC.
106 ARG0 (optional)=tag nummber (in hex)
107 ARG1 (optional)class (UNIVERSAL,APPLICATION,CONTEXT-SPECIFIC,PRIVATE)
109 Embeds the hash of the nested data. (Requries OpenSSL)
110 ARG0=algorithm (as defined by OpenSSL without the leading hyphen)
112 Embeds a HMAC for the nested data.
113 ARG0=algorithm (SHA1|MD5)
116 Wraps the nested content in an OCTETSTRING tag
118 Outputs the nested data in binary form to the named file and optionally includes the nested data in the
119 encoding stream as well.
120 ARG0=The filename to write the data to
121 ARG1=Set this to 1 to also include the binary content int he output stream (Optional)
123 Embeds content in a SEQ tag
124 SIGN Creates a PKCS#7 signed data object of the nested data using OpenSSL's SMIME command
125 ARG0=signing certificate filename (PEM format)
126 ARG1=signing key filename (PEM format)
128 Embeds content in a SET tag
130 Executes an arbitrary shell command
132 ARG1 (optional)=first argument to shell command
133 ARGN (optional)=last largument to shell command
135 command line arguments
136 **********************
137 --in <filename> : script file
138 --out <filename> : output file
139 --hex : output hex instead of binary
140 --debug : set the debug level. 0=off,1=parsing information,2=parsing & encoding information,3=everything
144 If it doesn't work then then try setting the DEBUG global variable to 1 (or 2
145 or 3 for more increased verbosity)