Skip to content

Commit 62149fa

Browse files
adding asn1 functionality. testing has been set up matches flag names
with openssl. added help to explain oid command added comments to header file resolved configure.ac merge conflict added oid support to header includes added man page for asn1parse and fixed more skoll oid are properly handled Made -out output DER of input after processing Removed extra fmt file and put all in parse custom oid now compiled out for 5.9.2
1 parent 69e2177 commit 62149fa

21 files changed

Lines changed: 7263 additions & 10 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ config.log
1111
config.status
1212
configure
1313
configure~
14-
clu_src/config.h.in*
14+
wolfclu/config.h.in*
1515
*.lo
1616
*.Plo
1717
*.o

Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ man_MANS+= manpages/wolfssl-hash.1
5353
man_MANS+= manpages/wolfssl-enc.1
5454
man_MANS+= manpages/wolfssl-ca.1
5555
man_MANS+= manpages/wolfssl-x509.1
56+
man_MANS+= manpages/wolfssl-asn1parse.1
5657
man_MANS+= manpages/wolfssl-req.1
5758
man_MANS+= manpages/wolfssl-verify.1
5859
man_MANS+= manpages/wolfssl-crl.1
@@ -95,6 +96,7 @@ include tests/dsa/include.am
9596
include tests/pkey/include.am
9697
include tests/dgst/include.am
9798
include tests/rand/include.am
99+
include tests/asn1/include.am
98100
include tests/base64/include.am
99101
include tests/ocsp/include.am
100102
include tests/ocsp-scgi/include.am

configure.ac

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,19 @@ AC_ARG_ENABLE([manpages],
9090

9191
AM_CONDITIONAL([ENABLE_MANPAGES], [test "x$ENABLED_MANPAGES" != "xno"])
9292

93+
# OID Name Table Build
94+
ENABLED_OIDTABLE_DEFAULT=no
95+
AC_ARG_ENABLE([oid-table],
96+
[AS_HELP_STRING([--enable-oid-table],[Enable OID-to-name lookup table (default: disabled)])],
97+
[ ENABLED_OIDTABLE=$enableval ],
98+
[ ENABLED_OIDTABLE=$ENABLED_OIDTABLE_DEFAULT ]
99+
)
100+
101+
if test "$ENABLED_OIDTABLE" = "yes"
102+
then
103+
AM_CFLAGS="$AM_CFLAGS -DHAVE_OID_TABLE"
104+
fi
105+
93106

94107
#wolfssl
95108
AC_MSG_CHECKING([for wolfSSL])
@@ -136,6 +149,21 @@ AC_CHECK_FUNC([wc_EncodeObjectId],
136149
[],
137150
[AM_CFLAGS="$AM_CFLAGS -DNO_WC_ENCODE_OBJECT_ID"])
138151

152+
# wc_EncodeObjectId is not usable in libwolfssl <= 5.9.1, so disable it based
153+
# on the version when the symbol is present but too old.
154+
AC_MSG_CHECKING([whether libwolfssl version supports wc_EncodeObjectId])
155+
AC_COMPILE_IFELSE(
156+
[AC_LANG_PROGRAM(
157+
[[#include <wolfssl/version.h>]],
158+
[[
159+
#if LIBWOLFSSL_VERSION_HEX <= 0x05009001
160+
#error "libwolfssl version too old for wc_EncodeObjectId"
161+
#endif
162+
]])],
163+
[AC_MSG_RESULT([yes])],
164+
[AC_MSG_RESULT([no])
165+
AM_CFLAGS="$AM_CFLAGS -DNO_WC_ENCODE_OBJECT_ID"])
166+
139167

140168
###############################################
141169
# #
@@ -198,3 +226,4 @@ echo " * C Compiler: $CC_VERSION"
198226
echo " * C Flags: $CFLAGS"
199227
echo " * CPP Flags: $CPPFLAGS"
200228
echo " * LIB Flags: $LIB"
229+
echo " * OID Name Table: $ENABLED_OIDTABLE"

manpages/wolfssl-asn1parse.1

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
.\" Manpage for wolfssl asn1parse.
2+
.\" Contact facts@wolfssl.com to correct errors or typos.
3+
.TH wolfSSL SSL1 "June 2026" "0.2.0" "wolfssl asn1parse man page"
4+
.SH NAME
5+
wolfssl-asn1parse, asn1parse \- ASN.1 parsing utility
6+
.SH SYNOPSIS
7+
wolfssl asn1parse [-in file] [-inform DER|PEM|B64] [-out file] [-oid file] [-offset n] [-length n] [-strparse n[,n...]] [-i] [-dump] [-noout] [-help]
8+
.SH DESCRIPTION
9+
Parses an ASN.1 encoded structure (for example a certificate, key, or CRL)
10+
and prints a human readable listing of its tags, lengths, and contents.
11+
Input may be read in DER, PEM, or Base64 form.
12+
.SH GENERAL OPTIONS
13+
-help print the asn1parse help summary and exit.
14+
.br
15+
.LP
16+
-oid file file of extra OID definitions. Each line uses the
17+
.br
18+
format: <oid> <shortName> <long name with spaces>.
19+
.br
20+
To use the built in OID table, configure wolfCLU with
21+
.br
22+
--enable-oid-table.
23+
.SH I/O OPTIONS
24+
-in file input file to read the ASN.1 structure from.
25+
.br
26+
.LP
27+
-inform DER|PEM|B64 input file format. One of DER, PEM, or B64 (Base64).
28+
.br
29+
.LP
30+
-out file output file for the ASN.1 DER data after processing.
31+
.br
32+
Best used with -strparse.
33+
.br
34+
.LP
35+
-noout do not print the parsed output.
36+
.br
37+
.LP
38+
-offset n offset into the file at which to begin parsing.
39+
.br
40+
.LP
41+
-length n number of bytes to parse.
42+
.br
43+
.LP
44+
-strparse n[,n...] offset to an OCTET/BIT STRING to parse. A comma
45+
.br
46+
separated list may be given, e.g. -strparse 702,64.
47+
.SH FORMATTING OPTIONS
48+
-i indent the output according to structure depth.
49+
.br
50+
.LP
51+
-dump print unknown data in hex form.
52+
.SH OUTPUT
53+
Each line is formatted as:
54+
.RS
55+
0: 4 [1187] (0) SEQUENCE
56+
.RE
57+
.LP
58+
where the first number is the offset, the second is the header length, the
59+
value in brackets is the data length, and the value in parentheses is the
60+
depth. Brackets indicate constructed types and a plus indicates a primitive
61+
type.
62+
.SH EXAMPLES
63+
Parse a DER encoded certificate with indented output:
64+
.RS
65+
wolfssl asn1parse -inform DER -in cert.der -i
66+
.RE
67+
.LP
68+
Parse a PEM file and dump unknown data as hex:
69+
.RS
70+
wolfssl asn1parse -in cert.pem -inform PEM -dump
71+
.RE
72+
.SH SEE ALSO
73+
.BR wolfssl-x509(1) ", " wolfssl-req(1)
74+
.SH NOTES
75+
Available only when wolfSSL is built with WOLFSSL_ASN_PRINT and without
76+
NO_FILESYSTEM. The -oid option additionally requires object id encoding
77+
support (NO_WC_ENCODE_OBJECT_ID must not be defined). For OpenSSL
78+
compatibility the tool reserves additional flags (e.g. -genstr, -genconf,
79+
-item, -strictpem, -dlimit) that are not yet implemented.
80+
.SH BUGS
81+
No known bugs at this time.
82+
.SH AUTHOR
83+
wolfSSL, Inc. (facts@wolfssl.com)
84+
.SH COPYRIGHT
85+
Copyright 2026 wolfSSL Inc. All rights reserved.
86+
.SH REPORTING BUGS
87+
Report wolfssl bugs to support@wolfssl.com

0 commit comments

Comments
 (0)