Error with asn1Spec

353 views
Skip to first unread message

Joerg Sorge

unread,
Dec 7, 2017, 2:31:49 PM12/7/17
to SleekXMPP Discussion
Hi, 
I'm using this example https://github.com/fritzy/SleekXMPP/blob/master/examples/send_client.py for starting xmpp via python and get this Error. 

INFO     Negotiating TLS
INFO     Using SSL version: TLSv1
ERROR    Connection error.
ERROR    <TagSet object at 0xb6082610 tags 0:32:16> not in asn1Spec: <OctetString schema object at 0xb609a410 tagSet <TagSet object at 0xb62ee110 tags 0:0:4> encoding iso-8859-1>
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 1492, in _process
    if not self.__read_xml():
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 1564, in __read_xml
    self.__spawn_event(xml)
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 1632, in __spawn_event
    handler.prerun(stanza_copy)
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/handler/callback.py", line 64, in prerun
    self.run(payload, True)
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/handler/callback.py", line 76, in run
    self._pointer(payload)
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/features/feature_starttls/starttls.py", line 64, in _handle_starttls_proceed
    if self.xmpp.start_tls():
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 889, in start_tls
    cert.verify(self._expected_server_name, self._der_cert)
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/cert.py", line 134, in verify
    cert_names = extract_names(raw_cert)
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/cert.py", line 73, in extract_names
    asn1Spec=OctetString())[0]
  File "/usr/local/lib/python2.7/dist-packages/pyasn1/codec/ber/decoder.py", line 1318, in __call__
    '%s not in asn1Spec: %r' % (tagSet, asn1Spec)
PyAsn1Error: <TagSet object at 0xb6082610 tags 0:32:16> not in asn1Spec: <OctetString schema object at 0xb609a410 tagSet <TagSet object at 0xb62ee110 tags 0:0:4> encoding iso-8859-1>



What can I do?

I'ts running on Rasperry 2B with Debian Stretch.
Thanks for every hints.

Dmytro Sirenko

unread,
Jan 13, 2018, 4:56:59 PM1/13/18
to SleekXMPP Discussion
Hi Joerg,

I was getting the same error (my XMPP server: ejabberd on Debian 9), and I fixed it by changing lines 72-73 in sleekxmpp.xmlstream.cert from this:

value = decoder.decode(extension.getComponentByName('extnValue'),
                       asn1Spec
=OctetString())[0]

to this:

value = extension.getComponentByName('extnValue')


After that I had to fix a certificate "expiration" issue in sleekxmpp.xmlstream.cert:111 and sleekxmpp.xmlstream.cert:115: UTC time is encoded as 'YYMMDDhhmm[ss]Z' in certificates, but the existing code uses '%Y', which interprets first four digits as the year part, so it should be changed to '%y' to interpret the 'YY' part correctly.

I'd like to make a pull request for these changes, but I've tested my changes with my server only so far, so I am not sure I am not breaking other setups and certificates.  

Regards,
Dmytro.

Rakhi Kasat

unread,
Feb 25, 2020, 5:55:27 AM2/25/20
to SleekXMPP Discussion
Thank you so much for this answer! saved my day :)
Reply all
Reply to author
Forward
0 new messages