How to run OpenSSL command line utility under debugger?

Dmitry Belyavsky beldmit at gmail.com
Tue Oct 15 06:57:10 UTC 2019


Dear Anton,

On Tue, Oct 15, 2019 at 9:00 AM Anton Schmidt <schmidt.ajax at gmail.com>
wrote:

> I've got an error in openssl library function when trying to read a pkcs7
> message
>
> [schmidt at localhost ssl]$ ./bin/openssl version
> OpenSSL 3.0.0-dev xx XXX xxxx (Library: OpenSSL 3.0.0-dev xx XXX xxxx)
> [schmidt at localhost ssl]$ ./bin/openssl pkcs7 -in
> /tmp/55b0822e148e4ffaa0bd9ebc41814f54.der -inform DER -print_certs
> unable to load PKCS7 object
> 40:57:70:89:A5:7F:00:00:error:asn1 encoding routines:(unknown
> function):sequence length
> mismatch:crypto/asn1/tasn_dec.c:388:Type=PKCS7_ENVELOPE
> 40:57:70:89:A5:7F:00:00:error:asn1 encoding routines:(unknown
> function):nested asn1 error:crypto/asn1/tasn_dec.c:629:
> 40:57:70:89:A5:7F:00:00:error:asn1 encoding routines:(unknown
> function):nested asn1 error:crypto/asn1/tasn_dec.c:479:Field=d.enveloped,
> Type=PKCS7
>
> openssl asn1parse and other online tools correctly parse and display ASN1
> of pkcs7 envelopedData.
>
> I want to run openssl utility under debugger to see what is happening
> inside the library function.
>
> I've found OpenSSL library source code https://github.com/openssl/openssl but
> not the sources for command line utility. Are the sources available?
>
> Or as an option is there a guide how I could write a simple pkcs7
> envelopedData reader to debug the library function?
>

You can build openssl using the following steps:
./config -ggdb
make

and then debug
LD_LIBRARY_PATH=. gdb --args apps/openssl ...

-- 
SY, Dmitry Belyavsky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20191015/307e411b/attachment.html>


More information about the openssl-users mailing list