+++ /dev/null
-[submodule "tool/hexio"]
- path = tool/hexio
- url = https://github.com/vanrein/hexio
-[submodule "tool/asn1ate"]
- path = tool/asn1ate
- url = https://github.com/vanrein/asn2quickder
The basic installation that provides you with the library:
./configure
- #OPTIONAL# make mount
make all
make install
Other customary build targets include `clean`, `uninstall`.
-There is an additional build target `mount` that will incorporate two
-other GIT repositories, and use them during building and installing.
-The result will be additional resources:
+There a few additional utilities that you may need to use alongside
+Quick DER.
+
+ * Include files based on standards, such as RFCs. The intention is to have
+ a growing set of standards-based include files that can readily be included
+ into a DER project for analysis with Quick-DER. To build those, there
+ is a need to have an executable `asn2quickder` installed while building
+ Quick DER.
+ You can find the tool in the
+ [asn2quickder](https://github.com/vanrein/asn2quickder)
+ webpage. This tool is based on
+ [asn1ate](https://github.com/kimgr/asn1ate)
+ and relies on [pyparsing](https://pypi.python.org/pypi/pyparsing).
+ Note that `asn2quickder` is "good enough" for the mapping of at least
+ an important part of the RFCs, but it is work that can still be improved.
* A utility `derdump` that is dumps even *wrongly formatted* DER-encoded
data. This is extremely useful to ASN.1 developers, and there does not
seem to be a comparable tool anywhere else (?)
+ You can find the tool in the [hexio](https://github.com/vanrein/hexio)
+ which is suggested as a co-install for Quick DER.
- * Include files based on standards, such as RFCs. The intention is to have
- a growing set of standards-based include files that can readily be included
- into a DER project for analysis with Quick-DER.
-
-Note that after `make mount` you may need extra facilities to be able to run
-the [asn2quickder](https://github.com/vanrein/asn2quickder) submodule.
-Specifically, it relies on [pyparsing](https://pypi.python.org/pypi/pyparsing).
DESTDIR ?=
PREFIX ?= /usr/local
-# SUBDIRS = lib asn2qder test rfc arpa2
+# SUBDIRS = lib asn2qder test rfc arpa2 itu
SUBDIRS = lib tool test rfc
SUBMAKE=$(MAKE) PREFIX='$(PREFIX)' DESTDIR='$(DESTDIR)'
clean:
@ $(foreach d,$(SUBDIRS),$(SUBMAKE) -C '$d' clean &&) echo "Cleaned all subdirectories"
-mount:
- git submodule update --init
Your source code dealing with DER should read the entire block, and pass it to
the DER parser. Initially, it would include:
- #include <der/qparse.h>
+ #include <quick-der/api.h>
#include "myderparser.h"
and builing should include:
gcc -o myparser.o myparser.c
- gcc ... myderparser.o -lqder
+ gcc ... myderparser.o -lquickder
You may be lucky, and find your favourite spec precompiled. In that case, you
can limit yourself to things like:
#define RFC5280_PREFIX pkix_
- #include <der/qparse.h>
+ #include <quick-der/api.h>
#include <der/rfc5280.h>
and link with simply:
- gcc ... -lqder
+ gcc ... -lquickder
### Parsing DER structures
Now, to invoke the parser, you setup a cursor describing the entire content,
- dercursor_t thelot;
- thelot.derptr = ...pointer-to-data...;
- thelot.derlen = ...length-of-data...;
+ dercursor_t thelot;
+ thelot.derptr = ...pointer-to-data...;
+ thelot.derlen = ...length-of-data...;
then you invoke the parser, providing it with storage space and the
precompiled structure to follow while parsing:
- struct pkix_Certificate crt;
- int prsok = der_unpack (&thelot, asn1_pkix_Certificate, &crt, 1);
+ struct pkix_Certificate crt;
+ int prsok = der_unpack (&thelot, asn1_pkix_Certificate, &crt, 1);
This will parse the DER-encoded data in `thelot` and store the various fields
in `crt`, so it becomes available as individual cursor structures such as
+++ /dev/null
-#
-# This directory holds .asn1 files derived from the pristine versions in orig/
-# that were adapted (and commented with "--asn1ate" where this is done) to make
-# it pass through the compiler.
-#
-# Current TODO:
-# - order definitions, the compiler now runs into problems
-# - check for undefined names, if possible
-# - map ... to DER_PACK_OPTIONAL, DER_PACK_LEAVE -- and process accordingly
-#
-
-HEADERS = RemotePKCS11.h KXOVER.h
-LITERATE = RemotePKCS11.md RemotePKCS11.rst RemotePKCS11.html RemotePKCS11.epub \
- RemotePKCS11.tex RemotePKCS11.pdf \
- KXOVER.md KXOVER.rst KXOVER.html KXOVER.epub KXOVER.tex KXOVER.pdf \
- KXOVER.txt \
- CommunicationFilter.md
-TARGETS = $(HEADERS) $(LITERATE)
-
-ASN2QUICKDER_DIR = ../tool/asn1ate
-
-ASN2QUICKDER = PYTHONPATH='$(ASN2QUICKDER_DIR)' $(ASN2QUICKDER_DIR)/asn1ate/asn2quickder.py
-
-ASNLITERATE = ../tool/asn1literate.py
-
-KXOVER_DEPS = ../rfc/rfc4120.asn1 ../rfc/rfc5280.asn1
-
-all: $(TARGETS) test
-
-test: $(HEADERS)
- @ $(foreach h,$(HEADERS),echo > '$(h:.h=.c)' '#include "$(h)"' && gcc -c '$(h:.h=.c)' && ) echo 'Passed all header compilation tests'
-
-%.h: %.asn1
- $(ASN2QUICKDER) '$<' $(foreach f,$($(<:.asn1=_DEPS)),$f)
-
-%.md: %.asn1
- @ if grep -q ' ' '$<' ; then echo 'Please remove tabs from $<, they mess up the layout' ; exit 1 ; fi
- $(ASNLITERATE) '$<'
-
-%.txt: %.md
- @ [ -x /usr/bin/pandoc ] && pandoc --self-contained -o '$@' '$<' || echo Pandoc is not installed -- skipping TeX and PDF generation
-
-%.rst: %.md
- @ [ -x /usr/bin/pandoc ] && pandoc --self-contained -o '$@' '$<' || echo Pandoc is not installed -- skipping RST generation
-
-%.html: %.md
- @ [ -x /usr/bin/pandoc ] && pandoc --self-contained -o '$@' '$<' || echo Pandoc is not installed -- skipping HTML generation
-
-%.epub: %.md
- @ [ -x /usr/bin/pandoc ] && pandoc --self-contained -o '$@' '$<' || echo Pandoc is not installed -- skipping EPUB generation
-
-%.tex: %.md
- @ [ -x /usr/bin/pandoc ] && pandoc --self-contained -o '$@' '$<' || echo Pandoc is not installed -- skipping TeX and PDF generation
-
-%.pdf: %.tex
- @ [ -x /usr/bin/pdflatex -a -r '$<' ] && pdflatex '$<' || echo pdfLaTeX is not installed -- skipping PDF generation
-
-clean:
- rm -f $(TARGETS) $(foreach h,$(TARGETS),$(h:.h=.c) $(h:.h=.o))
-
-anew: clean all
-
-install: all
- @ mkdir -p $(DESTDIR)$(PREFIX)/include/quick-der
- @ $(foreach h,$(TARGETS),install '$(h)' '$(DESTDIR)$(PREFIX)/include/quick-der' && ) echo Installed header files
-
-uninstall:
- @ $(foreach h,$(TARGETS),rm -f '$(DESTDIR)$(PREFIX)/include/quick-der/$(h)' && ) echo Removed header files
- @ rmdir --ignore-fail-on-non-empty '$(DESTDIR)$(PREFIX)/include/quick-der'
-
rfc2578.h
#DOWNWARD-SPIRAL-INTO-ITU# TARGETS += InformationFramework.h UsefulDefinitions.h
-ASN2QUICKDER_DIR = ../tool/asn1ate
-
-ASN2QUICKDER_CMD = $(ASN2QUICKDER_DIR)/asn1ate/asn2quickder.py
-ASN2QUICKDER_RUN = PYTHONPATH='$(ASN2QUICKDER_DIR)' $(ASN2QUICKDER_CMD)
+ASN2QUICKDER_CMD = $(shell which asn2quickder)
+ASN2QUICKDER_RUN = $(ASN2QUICKDER_CMD)
all: $(TARGETS) test
test: $(TARGETS)
rm -f quick-der
ln -s . quick-der
- @ $(foreach h,$(TARGETS),echo > '$(h:.h=.c)' '#include "$(h)"' && [ -r $h ] && gcc -I . -c '$(h:.h=.c)' && ) echo 'Passed all header compilation tests' || echo Skipped compilation of skipped header files
+ @ $(foreach h,$(TARGETS),echo > '$(h:.h=.c)' '#include "$(h)"' && [ -r $h ] && gcc -I ../include -I . -c '$(h:.h=.c)' && ) echo 'Passed all header compilation tests' || echo Skipped compilation of skipped header files
%.h: %.asn1
@ [ -r $(ASN2QUICKDER_CMD) ] && $(ASN2QUICKDER_RUN) $< || echo Skipped ASN.1 header file generation for $<