ASN.1 Failure With OPENSSL Generated Key: Unexpected tag (got 30, expecting 02)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dkimpy |
Invalid
|
High
|
Unassigned |
Bug Description
Relayed from offline mail: The problem can be reproduced easily:
$ dkimsign.py test example.com testkey.key <dkim/tests/
Unexpected tag (got 30, expecting 02)
Received: from localhost
Message-ID: <email address hidden>
Date: Mon, 01 Jan 2011 01:02:03 +0400
From: Test User <email address hidden>
To: <email address hidden>
Subject: Testing
This is a test message.
I went back and checked with older dkimpy versions (back to 0.5.2) and I get the same error for all of them, so whatever it is, it's not a recent change.
I can extract the public key from it manually using openssl 1.0.1f, so at least openssl appears to be able to parse the key.
The key was generated via OpenSSL (whatever version was current 3+ years ago) and had not caused any problems previously (though I probably had not tried to use it for over 18months and just updated to the latest dkimpy package yesterday).
Note: The key is used for examples, so it is not really a 'private key', no need to worry about it being in the bug tracker.
It looks like asn1 (on pypi) can parse this:
>>> decoder. start(bytes( data)) start(bytes( value)) start(bytes( value)) start(bytes( value))
>>> tag, value = decoder.read()
>>> print tag
Tag(nr=16, typ=32, cls=0)
>>> decoder.
>>> tag, value = decoder.read()
>>> print tag
Tag(nr=2, typ=32, cls=64)
>>> decoder.
>>> tag, value = decoder.read()
>>> print tag
Tag(nr=22, typ=32, cls=0)
>>> decoder.
>>> tag, value = decoder.read()
>>> print tag
Tag(nr=19, typ=32, cls=0)