summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmc <>2016-07-17 16:33:17 +0000
committerjmc <>2016-07-17 16:33:17 +0000
commit385153236838c0df5ce2bd478435e3d2bc7c7c20 (patch)
treec865c0e7c11fa09e56da2939f0b6eee8d96deb05
parent78336a1536cbd5f8f9cdf9acafe89235a9c44b31 (diff)
downloadopenbsd-385153236838c0df5ce2bd478435e3d2bc7c7c20.tar.gz
openbsd-385153236838c0df5ce2bd478435e3d2bc7c7c20.tar.bz2
openbsd-385153236838c0df5ce2bd478435e3d2bc7c7c20.zip
strip back asn1parse; ok beck jsing
description of -out altered on jsing's advice
-rw-r--r--src/usr.bin/openssl/openssl.1135
1 files changed, 27 insertions, 108 deletions
diff --git a/src/usr.bin/openssl/openssl.1 b/src/usr.bin/openssl/openssl.1
index cad60f2670..08769c56e4 100644
--- a/src/usr.bin/openssl/openssl.1
+++ b/src/usr.bin/openssl/openssl.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: openssl.1,v 1.33 2016/07/16 07:27:53 jmc Exp $ 1.\" $OpenBSD: openssl.1,v 1.34 2016/07/17 16:33:17 jmc Exp $
2.\" ==================================================================== 2.\" ====================================================================
3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
4.\" 4.\"
@@ -112,7 +112,7 @@
112.\" 112.\"
113.\" OPENSSL 113.\" OPENSSL
114.\" 114.\"
115.Dd $Mdocdate: July 16 2016 $ 115.Dd $Mdocdate: July 17 2016 $
116.Dt OPENSSL 1 116.Dt OPENSSL 1
117.Os 117.Os
118.Sh NAME 118.Sh NAME
@@ -207,27 +207,22 @@ is not able to detect pseudo-commands such as
207or 207or
208.Cm no- Ns Ar XXX 208.Cm no- Ns Ar XXX
209itself. 209itself.
210.\"
211.\" ASN1PARSE
212.\"
213.Sh ASN1PARSE 210.Sh ASN1PARSE
214.nr nS 1 211.nr nS 1
215.Nm "openssl asn1parse" 212.Nm "openssl asn1parse"
216.Bk -words
217.Op Fl i 213.Op Fl i
218.Op Fl dlimit Ar number 214.Op Fl dlimit Ar number
219.Op Fl dump 215.Op Fl dump
220.Op Fl genconf Ar file 216.Op Fl genconf Ar file
221.Op Fl genstr Ar str 217.Op Fl genstr Ar str
222.Op Fl in Ar file 218.Op Fl in Ar file
223.Op Fl inform Ar DER | PEM | TXT 219.Op Fl inform Cm der | pem | txt
224.Op Fl length Ar number 220.Op Fl length Ar number
225.Op Fl noout 221.Op Fl noout
226.Op Fl offset Ar number 222.Op Fl offset Ar number
227.Op Fl oid Ar file 223.Op Fl oid Ar file
228.Op Fl out Ar file 224.Op Fl out Ar file
229.Op Fl strparse Ar offset 225.Op Fl strparse Ar offset
230.Ek
231.nr nS 0 226.nr nS 0
232.Pp 227.Pp
233The 228The
@@ -248,9 +243,8 @@ Generate encoded data based on string
248.Ar str , 243.Ar str ,
249file 244file
250.Ar file , 245.Ar file ,
251or both using 246or both, using the format described in
252.Xr ASN1_generate_nconf 3 247.Xr ASN1_generate_nconf 3 .
253format.
254If only 248If only
255.Ar file 249.Ar file
256is present then the string is obtained from the default section 250is present then the string is obtained from the default section
@@ -262,134 +256,59 @@ the contents can thus be examined and written to a file using the
262.Fl out 256.Fl out
263option. 257option.
264.It Fl i 258.It Fl i
265Indents the output according to the 259Indent the output according to the
266.Qq depth 260.Qq depth
267of the structures. 261of the structures.
268.It Fl in Ar file 262.It Fl in Ar file
269The input file; default is standard input. 263The input file; the default is standard input.
270.It Fl inform Ar DER | PEM | TXT 264.It Fl inform Cm der | pem | txt
271The input format. 265The input format.
272.Ar DER 266.Cm der
273.Pq Distinguished Encoding Rules 267.Pq Distinguished Encoding Rules
274is binary format and 268is binary format and
275.Ar PEM 269.Cm pem
276.Pq Privacy Enhanced Mail , 270.Pq Privacy Enhanced Mail ,
277the default, is base64-encoded. 271the default, is base64-encoded.
278.Ar TXT 272.Cm txt
279is plain text. 273is plain text.
280.It Fl length Ar number 274.It Fl length Ar number
281Number of bytes to parse; default is until end of file. 275Number of bytes to parse; the default is until end of file.
282.It Fl noout 276.It Fl noout
283Don't output the parsed version of the input file. 277Don't output the parsed version of the input file.
284.It Fl offset Ar number 278.It Fl offset Ar number
285Starting offset to begin parsing; default is start of file. 279Starting offset to begin parsing; the default is start of file.
286.It Fl oid Ar file 280.It Fl oid Ar file
287A file containing additional object identifiers 281A file containing additional object identifiers
288.Pq OIDs . 282.Pq OIDs .
289The format of this file is described in the
290.Sx ASN1PARSE NOTES
291section below.
292.It Fl out Ar file
293Output file to place the DER-encoded data into.
294If this option is not present, no encoded data will be output.
295This is most useful when combined with the
296.Fl strparse
297option.
298.It Fl strparse Ar offset
299Parse the content octets of the ASN.1 object starting at
300.Ar offset .
301This option can be used multiple times to
302.Qq drill down
303into a nested structure.
304.El
305.Sh ASN1PARSE OUTPUT
306The output will typically contain lines like this:
307.Bd -literal -offset 2n
3080:d=0 hl=4 l= 681 cons: SEQUENCE
309
310\&.....
311
312229:d=3 hl=3 l= 141 prim: BIT STRING
313373:d=2 hl=3 l= 162 cons: cont [ 3 ]
314376:d=3 hl=3 l= 159 cons: SEQUENCE
315379:d=4 hl=2 l= 29 cons: SEQUENCE
316381:d=5 hl=2 l= 3 prim: OBJECT :X509v3 Subject Key Identifier
317386:d=5 hl=2 l= 22 prim: OCTET STRING
318410:d=4 hl=2 l= 112 cons: SEQUENCE
319412:d=5 hl=2 l= 3 prim: OBJECT :X509v3 Authority Key Identifier
320417:d=5 hl=2 l= 105 prim: OCTET STRING
321524:d=4 hl=2 l= 12 cons: SEQUENCE
322
323\&.....
324.Ed
325.Pp
326This example is part of a self-signed certificate.
327Each line starts with the offset in decimal.
328.Cm d=XX
329specifies the current depth.
330The depth is increased within the scope of any SET or SEQUENCE.
331.Cm hl=XX
332gives the header length
333.Pq tag and length octets
334of the current type.
335.Cm l=XX
336gives the length of the content octets.
337.Pp
338The
339.Fl i
340option can be used to make the output more readable.
341.Pp
342Some knowledge of the ASN.1 structure is needed to interpret the output.
343.Pp
344In this example, the BIT STRING at offset 229 is the certificate public key.
345The content octets of this will contain the public key information.
346This can be examined using the option
347.Fl strparse Cm 229
348to yield:
349.Bd -literal
350 0:d=0 hl=3 l= 137 cons: SEQUENCE
351 3:d=1 hl=3 l= 129 prim: INTEGER :E5D21E1F5C8D208EA7A2166C7FA
352F9F6BDF2059669C60876DDB70840F1A5AAFA59699FE471F379F1DD6A487E7D5409AB6A88D4A
3539746E24B91D8CF55DB3521015460C8EDE44EE8A4189F7A7BE77D6CD3A9AF2696F486855CF58
354BF0EDF2B4068058C7A947F52548DDF7E15E96B385F86422BEA9064A3EE9
355 135:d=1 hl=2 l= 3 prim: INTEGER :010001
356.Ed
357.Sh ASN1PARSE NOTES
358If an OID 283If an OID
359.Pq object identifier 284.Pq object identifier
360is not part of 285is not part of
361.Nm OpenSSL Ns Li 's 286.Nm openssl Ns 's
362internal table it will be represented in 287internal table it will be represented in
363numerical form 288numerical form
364.Pq for example 1.2.3.4 . 289.Pq for example 1.2.3.4 .
365The file passed to the 290.Pp
366.Fl oid
367option allows additional OIDs to be included.
368Each line consists of three columns: 291Each line consists of three columns:
369the first column is the OID in numerical format and should be followed by 292the first column is the OID in numerical format and should be followed by
370whitespace. 293whitespace.
371The second column is the 294The second column is the
372.Qq short name 295.Qq short name ,
373which is a single word followed by whitespace. 296which is a single word followed by whitespace.
374The final column is the rest of the line and is the 297The final column is the rest of the line and is the
375.Qq long name . 298.Qq long name .
376.Nm asn1parse 299.Nm asn1parse
377displays the long name. 300displays the long name.
378Example: 301.It Fl out Ar file
379.Pp 302The DER-encoded output file; the default is no encoded output
380.Dl \&"1.2.3.4 shortname A long name\&" 303(useful when combined with
381.Sh ASN1 EXAMPLES 304.Fl strparse ) .
382Parse a file: 305.It Fl strparse Ar offset
383.Pp 306Parse the content octets of the ASN.1 object starting at
384.Dl $ openssl asn1parse -in file.pem 307.Ar offset .
385.Pp 308This option can be used multiple times to
386Parse a DER file: 309.Qq drill down
387.Pp 310into a nested structure.
388.Dl $ openssl asn1parse -inform DER -in file.der 311.El
389.Sh ASN1PARSE BUGS
390There should be options to change the format of output lines.
391The output of some ASN.1 types is not well handled
392.Pq if at all .
393.\" 312.\"
394.\" CA 313.\" CA
395.\" 314.\"