GithubHelp home page GithubHelp logo

etingof / pyasn1-modules Goto Github PK

View Code? Open in Web Editor NEW
40.0 16.0 42.0 973 KB

ASN.1 modules for pyasn1 library

Home Page: http://snmplabs.com/pyasn1/

License: BSD 2-Clause "Simplified" License

Python 100.00%
pyasn1 python asn1

pyasn1-modules's People

Contributors

etingof avatar franciscosantos-at-irdeto avatar hugovk avatar jamim avatar jdufresne avatar russhousley avatar viraptor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyasn1-modules's Issues

"'Any' object has no attribute '_value'" in x

[pyasn1-modules 0.4.8 with pyasn 0.4.8]

The following code attempts to roundtrip a certificate via the following steps:

  1. decode openssl-generated DER from file
  2. immediately encode it back out again
    f = open("my_cert.der", "rb")
    der = f.read()
    cert, _ = decode_der(der, asn1Spec=rfc5280.Certificate())
    # 'cert' contents can be examined here: e.g.: print(str(cert))
    der2 = encode_der(cert, asn1Spec=rfc5280.Certificate())
                     ^----- exception inside encode_der() here

The generated stack trace is absolutely enormous, actually containing one line that is thousands of characters long, which makes it impossible to read.

FWIW, I have similar roundtripping test-code using the asn1Specs univ.Integer() and rfc5652.ContentInfo(). Since this other code is working, especially the latter one, I suspect this issue might Certificate-oriented.

Thoughts?

Parsing certificate extensions exception in 0.2.1

Parsing certificate extensions with pyasn1 0.4.3 and modules 0.1.5 is successful but fails in 0.2.1 with:

pyasn1.error.PyAsn1Error: <TagSet object at 0x7f66f3050e80 tags 0:32:16> not in asn1Spec: <OctetString schema object at 0x7f66f28410b8 tagSet <TagSet object at 0x7f66f2861438 tags 0:0:4> encoding iso-8859-1>

dependency version pain

Instead of accepting any versions of pyasn1 >= 0.1.8 it would be worthwhile to tie that down to something you've tested with. That would have avoided the problem seen today.

rfc4055 missing *WithRSAEncryption Algorithm Identifiers

The rfc4055 module has identifiers for raw sha224 to sha512, but none for the withRSAEncryption variants.

It has the following, which is discussed in the 5th paragraph of RFC 4055 Section 5:

sha256Identifier = rfc5280.AlgorithmIdentifier()
sha256Identifier['algorithm'] = id_sha256
sha256Identifier['parameters'] = univ.Null("")

But it doesn't have, the following which is discussed in the subsequent paragraphs of Section 5 of the RFC:

sha256WithRSAEncryptionIdentifier = rfc5280.AlgorithmIdentifier()
sha256WithRSAEncryptionIdentifier['algorithm'] = sha256WithRSAEncryption
sha256WithRSAEncryptionIdentifier['parameters'] = univ.Null("")

The same goes for sha224, sha384 and sha512.

pyasn1-modules broken with pyasn1==0.1.9

The requirements.txt for pyasn1-modules 0.2.1 permits pyasn1<0.5.0. But with pyasn1==0.1.9:

>>> from pyasn1_modules.rfc2459 import Certificate
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/pyasn1_modules/rfc2459.py", line 20, in <module>
    from pyasn1.type import opentype
ImportError: cannot import name 'opentype'

Upgrading to pyasn==0.4.2 fixes the issue.

Installation error for version 0.1.2 on Python 2.7

Hi, this morning after the update to 0.1.2 I started receiving an error during pip install of a dependent library, google-api-python-client==1.6.2. I'm using Python 2.7, it's run as a clean Docker build, and there are no other dependencies.

Here's the relevant piece of the error trace:

Downloading/unpacking pyasn1-modules==0.1.2
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1266, in prepare_files
    req_to_install.extras):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2291, in requires
    dm = self._dep_map
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2484, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2508, in _compute_dependencies
    parsed = next(parse_requirements(distvers))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 45, in <lambda>
    next = lambda o: o.next()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2605, in parse_requirements
    line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2573, in scan_list
    raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', 'pyasn1 ~=0.3.4', 'at', ' ~=0.3.4')

I was able to fix this by version locking to pyasn1-modules==0.1.1 in my pip install process.

pyasn1/type/univ.py:711: DeprecationWarning: __int__ returned non-int (type SizedInteger)

Testing reports following warnings:

=============================== warnings summary ===============================
tests/test_rfc5913.py::ClearanceTestCase::testOpenTypes
tests/test_rfc5913.py::ClearanceTestCase::testOpenTypes
tests/test_rfc5913.py::ClearanceTestCase::testOpenTypes
tests/test_rfc5913.py::ClearanceTestCase::testDerCodec
tests/test_rfc5913.py::ClearanceTestCase::testDerCodec
tests/test_rfc5913.py::ClearanceTestCase::testDerCodec
tests/test_rfc5917.py::ClearanceSponsorTestCase::testOpenTypes
tests/test_rfc5755.py::CertificateWithClearanceTestCase::testOpenTypes
  $(PYTHON_DIR)/vendor-packages/pyasn1/type/univ.py:711: DeprecationWarning: __int__ returned non-int (type SizedInteger).  The ability to return an instance of a strict subclass of int is deprecated, and may be removed in a future version of Python.
    return SizedInteger(value).setBitLength(len(value))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

rfc4210 cmp implicit confirm

Hi everyone,
I'm using pyasn1-modules to build a small cmp client (subset of rfc4210). I think there is a mistake in the rfc4210 module in the PKIHeader class.
The last entry should be

namedtype.OptionalNamedType(
            'generalInfo', univ.SequenceOf(
                componentType=rfc4210.InfoTypeAndValue().subtype(
                    sizeSpec=constraint.ValueSizeConstraint(1, MAX))
            ).subtype(explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8))
        )

instead of

namedtype.OptionalNamedType(
            'generalInfo', univ.SequenceOf(
                componentType=InfoTypeAndValue().subtype(
                      sizeSpec=constraint.ValueSizeConstraint(1, MAX),
                      explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 8)
              )
)

Stumbled over this when I tried to use cmp implicit confirm. The top code shows how I was able to get it running with a CA-Software.

Thanks,
Alex

Cant perform snmpv2-get query

Hey! I try to create simple snmp GET query using pyasn1-modules lib, with following code:
`
import sys
import socket

from pyasn1_modules.rfc1901 import Message
from pyasn1_modules.rfc1905 import PDUs, VarBindList, VarBind, GetRequestPDU
from pyasn1.type import univ
from pyasn1.codec.ber import decoder
from pyasn1.codec.ber import encoder
from pyasn1 import debug

// Define settings
community = 'test'
host = '1.2.3.4'
oid = '1.3.6.1.2.1.2.2.1.2.1'
// Create msg
msg = Message()
msg.setComponentByPosition(0)
msg.setComponentByPosition(1, community) // Set community
pdus = PDUs() # create pdus
pdus = msg.setComponentByPosition(2, pdus).getComponentByPosition(2)
pdu = pdus.setComponentByPosition(0).getComponentByPosition(0)
pdu.setComponentByPosition(0, 123)
pdu.setComponentByPosition(1, 0)
pdu.setComponentByPosition(2, 0)
vbl = pdu.setComponentByPosition(3).getComponentByPosition(3)
vb = vbl.setComponentByPosition(0).getComponentByPosition(0)
vb.setComponentByPosition(0, oid)
res = vb.getComponentByPosition(1).setComponentByPosition(1).getComponentByPosition(1)

print('sending: %s' % msg.prettyPrint())

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(encoder.encode(msg), (host, 161))

substrate, _ = sock.recvfrom(2048)
rMsg, _ = decoder.decode(substrate, asn1Spec=msg)

print('received: %s' % rMsg.prettyPrint())
`

After running script, got this exception: pyasn1.error.PyAsn1Error: Attempted "eq" operation on ASN.1 schema object. Can anybody help me, please ?
pyasn1.error.PyAsn1Error: Error encoding <Message schema object, tagSet=<TagSet object, tags 0:32:16>, subtypeSpec=, componentType=<NamedTypes object, types <NamedType object, type version=<Integer schema object, tagSet <TagSet object, tags 0:0:2>, namedValues <NamedValues object, enums version-2c=1>>>, <NamedType object, type community=<OctetString schema object, tagSet <TagSet object, tags 0:0:4>, encoding iso-8859-1>>, <NamedType object, type data=<Any schema object, encoding iso-8859-1>>>, sizeSpec=>: Error encoding <Integer schema object, tagSet <TagSet object, tags 0:0:2>, namedValues <NamedValues object, enums version-2c=1>>: Attempted "eq" operation on ASN.1 schema object

Importing Certificate from pyasn1_modules.rfc2459 fails

This import is being called from oauth2client and failing in Python 3.6.5, with pyasn1_modules 0.2.1:

from pyasn1_modules.rfc2459 import Certificate

PyAsn1Error                               Traceback (most recent call last)
<ipython-input-18-0626fa13cc97> in <module>()
----> 1 from pyasn1_modules.rfc2459 import Certificate

/usr/local/lib/python3.6/site-packages/pyasn1_modules/rfc2459.py in <module>()
    103 
    104 
--> 105 class X520name(univ.Choice):
    106     componentType = namedtype.NamedTypes(
    107         namedtype.NamedType('teletexString',

/usr/local/lib/python3.6/site-packages/pyasn1_modules/rfc2459.py in X520name()
    106     componentType = namedtype.NamedTypes(
    107         namedtype.NamedType('teletexString',
--> 108                             char.TeletexString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),
    109         namedtype.NamedType('printableString',
    110                             char.PrintableString().subtype(subtypeSpec=constraint.ValueSizeConstraint(1, ub_name))),

/usr/local/lib/python3.6/site-packages/pyasn1/type/univ.py in __init__(self, value, **kwargs)
    817             kwargs['encoding'] = self.encoding
    818 
--> 819         base.AbstractSimpleAsn1Item.__init__(self, value, **kwargs)
    820 
    821     if sys.version_info[0] <= 2:

/usr/local/lib/python3.6/site-packages/pyasn1/type/base.py in __init__(self, value, **kwargs)
    238             value = self.defaultValue
    239         else:
--> 240             value = self.prettyIn(value)
    241             try:
    242                 self.subtypeSpec(value)

/usr/local/lib/python3.6/site-packages/pyasn1/type/char.py in prettyIn(self, value)
    111                     return value.asOctets().decode(self.encoding)
    112                 else:
--> 113                     return str(value)
    114 
    115             except (UnicodeDecodeError, LookupError):

/usr/local/lib/python3.6/site-packages/pyasn1/type/base.py in plug(self, *args, **kw)
    197             def getPlug(name):
    198                 def plug(self, *args, **kw):
--> 199                     raise error.PyAsn1Error('Attempted "%s" operation on ASN.1 schema object' % name)
    200                 return plug
    201 

PyAsn1Error: Attempted "__str__" operation on ASN.1 schema object

0.2.8: pytest warnings

I'm not 100% sure is it pyasn1 or pyasn1-modules issue.

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pyasn1-modules-0.2.8-6.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pyasn1-modules-0.2.8-6.fc35.x86_64/usr/lib/python3.8/site-packages
+ PYTHONDONTWRITEBYTECODE=1
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.9, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/tkloczko/rpmbuild/BUILD/pyasn1-modules-0.2.8
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, httpbin-1.0.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, asyncio-0.15.1, toolbox-0.5, xprocess-0.17.1, aiohttp-0.3.0, checkdocs-2.7.0, mock-3.6.1, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, cases-3.6.1, flaky-3.7.0, hypothesis-6.14.0, benchmark-3.4.1, xdist-2.3.0, Faker-8.8.1
collected 212 items

. .                                                                                                                                                                  [  0%]
tests/test_pem.py .                                                                                                                                                  [  0%]
tests/test_rfc2314.py .                                                                                                                                              [  1%]
tests/test_rfc2315.py ..                                                                                                                                             [  2%]
tests/test_rfc2437.py .                                                                                                                                              [  2%]
tests/test_rfc2459.py ......                                                                                                                                         [  5%]
tests/test_rfc2511.py .                                                                                                                                              [  6%]
tests/test_rfc2560.py ..                                                                                                                                             [  7%]
tests/test_rfc2631.py .                                                                                                                                              [  7%]
tests/test_rfc2634.py ...                                                                                                                                            [  9%]
tests/test_rfc2985.py ..                                                                                                                                             [  9%]
tests/test_rfc2986.py ..                                                                                                                                             [ 10%]
tests/test_rfc3114.py .                                                                                                                                              [ 11%]
tests/test_rfc3161.py ..                                                                                                                                             [ 12%]
tests/test_rfc3274.py ..                                                                                                                                             [ 13%]
tests/test_rfc3279.py ..........                                                                                                                                     [ 18%]
tests/test_rfc3280.py ..                                                                                                                                             [ 18%]
tests/test_rfc3281.py .                                                                                                                                              [ 19%]
tests/test_rfc3447.py .                                                                                                                                              [ 19%]
tests/test_rfc3560.py ...                                                                                                                                            [ 21%]
tests/test_rfc3565.py ...                                                                                                                                            [ 22%]
tests/test_rfc3709.py ....                                                                                                                                           [ 24%]
tests/test_rfc3770.py ..                                                                                                                                             [ 25%]
tests/test_rfc3779.py ..                                                                                                                                             [ 26%]
tests/test_rfc3852.py .                                                                                                                                              [ 27%]
tests/test_rfc4043.py ..                                                                                                                                             [ 27%]
tests/test_rfc4055.py ..........                                                                                                                                     [ 32%]
tests/test_rfc4073.py ..                                                                                                                                             [ 33%]
tests/test_rfc4108.py ..                                                                                                                                             [ 34%]
tests/test_rfc4210.py .                                                                                                                                              [ 35%]
tests/test_rfc4211.py .                                                                                                                                              [ 35%]
tests/test_rfc4334.py ..                                                                                                                                             [ 36%]
tests/test_rfc4985.py ..                                                                                                                                             [ 37%]
tests/test_rfc5035.py ...                                                                                                                                            [ 38%]
tests/test_rfc5083.py ..                                                                                                                                             [ 39%]
tests/test_rfc5084.py ...                                                                                                                                            [ 41%]
tests/test_rfc5208.py ..                                                                                                                                             [ 42%]
tests/test_rfc5280.py ......                                                                                                                                         [ 45%]
tests/test_rfc5480.py ..                                                                                                                                             [ 45%]
tests/test_rfc5649.py ..                                                                                                                                             [ 46%]
tests/test_rfc5652.py ..                                                                                                                                             [ 47%]
tests/test_rfc5751.py .                                                                                                                                              [ 48%]
tests/test_rfc5755.py ....                                                                                                                                           [ 50%]
tests/test_rfc5913.py ..                                                                                                                                             [ 51%]
tests/test_rfc5914.py .                                                                                                                                              [ 51%]
tests/test_rfc5915.py .                                                                                                                                              [ 52%]
tests/test_rfc5916.py ..                                                                                                                                             [ 53%]
tests/test_rfc5917.py ..                                                                                                                                             [ 54%]
tests/test_rfc5924.py .                                                                                                                                              [ 54%]
tests/test_rfc5934.py ....                                                                                                                                           [ 56%]
tests/test_rfc5940.py ..                                                                                                                                             [ 57%]
tests/test_rfc5958.py ..                                                                                                                                             [ 58%]
tests/test_rfc5990.py ..                                                                                                                                             [ 59%]
tests/test_rfc6010.py ...                                                                                                                                            [ 60%]
tests/test_rfc6019.py ..                                                                                                                                             [ 61%]
tests/test_rfc6031.py ..                                                                                                                                             [ 62%]
tests/test_rfc6032.py ..                                                                                                                                             [ 63%]
tests/test_rfc6120.py ..                                                                                                                                             [ 64%]
tests/test_rfc6187.py .                                                                                                                                              [ 64%]
tests/test_rfc6210.py .                                                                                                                                              [ 65%]
tests/test_rfc6211.py ..                                                                                                                                             [ 66%]
tests/test_rfc6402.py ..                                                                                                                                             [ 67%]
tests/test_rfc6482.py ..                                                                                                                                             [ 68%]
tests/test_rfc6486.py ..                                                                                                                                             [ 69%]
tests/test_rfc6487.py ..                                                                                                                                             [ 70%]
tests/test_rfc6664.py ..                                                                                                                                             [ 71%]
tests/test_rfc6955.py ..                                                                                                                                             [ 72%]
tests/test_rfc6960.py ....                                                                                                                                           [ 73%]
tests/test_rfc7030.py ..                                                                                                                                             [ 74%]
tests/test_rfc7191.py ......                                                                                                                                         [ 77%]
tests/test_rfc7229.py .                                                                                                                                              [ 78%]
tests/test_rfc7292.py ..                                                                                                                                             [ 79%]
tests/test_rfc7296.py .                                                                                                                                              [ 79%]
tests/test_rfc7508.py ..                                                                                                                                             [ 80%]
tests/test_rfc7585.py ..                                                                                                                                             [ 81%]
tests/test_rfc7633.py .                                                                                                                                              [ 81%]
tests/test_rfc7773.py .                                                                                                                                              [ 82%]
tests/test_rfc7894.py ..                                                                                                                                             [ 83%]
tests/test_rfc7906.py ..                                                                                                                                             [ 84%]
tests/test_rfc7914.py ..                                                                                                                                             [ 85%]
tests/test_rfc8017.py ..                                                                                                                                             [ 86%]
tests/test_rfc8018.py ..                                                                                                                                             [ 87%]
tests/test_rfc8103.py .                                                                                                                                              [ 87%]
tests/test_rfc8209.py .                                                                                                                                              [ 88%]
tests/test_rfc8226.py ...                                                                                                                                            [ 89%]
tests/test_rfc8358.py .                                                                                                                                              [ 90%]
tests/test_rfc8360.py .                                                                                                                                              [ 90%]
tests/test_rfc8398.py ..                                                                                                                                             [ 91%]
tests/test_rfc8410.py .                                                                                                                                              [ 91%]
tests/test_rfc8418.py .                                                                                                                                              [ 92%]
tests/test_rfc8419.py ......                                                                                                                                         [ 95%]
tests/test_rfc8479.py ..                                                                                                                                             [ 96%]
tests/test_rfc8494.py .                                                                                                                                              [ 96%]
tests/test_rfc8520.py ..                                                                                                                                             [ 97%]
tests/test_rfc8619.py ...                                                                                                                                            [ 99%]
tests/test_rfc8649.py ..                                                                                                                                             [100%]

============================================================================= warnings summary =============================================================================
tests/test_rfc5755.py::CertificateWithClearanceTestCase::testOpenTypes
tests/test_rfc5913.py::ClearanceTestCase::testDerCodec
tests/test_rfc5913.py::ClearanceTestCase::testDerCodec
tests/test_rfc5913.py::ClearanceTestCase::testDerCodec
tests/test_rfc5913.py::ClearanceTestCase::testOpenTypes
tests/test_rfc5913.py::ClearanceTestCase::testOpenTypes
tests/test_rfc5913.py::ClearanceTestCase::testOpenTypes
tests/test_rfc5917.py::ClearanceSponsorTestCase::testOpenTypes
  /usr/lib/python3.8/site-packages/pyasn1/type/univ.py:711: DeprecationWarning: __int__ returned non-int (type SizedInteger).  The ability to return an instance of a strict subclass of int is deprecated, and may be removed in a future version of Python.
    return SizedInteger(value).setBitLength(len(value))

-- Docs: https://docs.pytest.org/en/stable/warnings.html
===================================================================== 211 passed, 8 warnings in 10.29s =====================================================================

Trouble decoding IEC 61850 GOOSE PDU data

I am having trouble decoding IEC 61850 GOOSE PDU data. This data is encoded using BER. You can find the ASN.1 notation that wireshark uses here: https://github.com/boundary/wireshark/blob/master/asn1/goose/goose.asn. My repository is located on gitub: https://github.com/keith-gray-powereng/goose. The pyasn.1 classes corresponding to the ASN.1 notation live in the https://github.com/keith-gray-powereng/goose/blob/master/goose/goose_pdu.py file.

The last three tests in https://github.com/keith-gray-powereng/goose/blob/master/tests/test_goose.py are generating errors while trying to decode the data. These tests cover decoding larger pieces of the data that make use of "SEQUENCE (OF)".

One example of a failing test is as follows. The encoded_data is taken straight from a captured GOOSE packet.

from pyasn1 import debug
    debug.setLogger(debug.Debug('all'))
    encoded_data = (
        "\xa2\x12"
        "\x83\x01\x00\x84\x03\x03\x00\x00\x91\x08\x5a\xaa\xe0\xa4\x6f\xf3"
        "\x5e\x92"
    )
    expected = False
    iec61850_goose_pdu = IECGoosePDU().clone()
    all_data = iec61850_goose_pdu.getComponentByName('allData')
    data_item_1 = all_data.getComponentByPosition(0)
    structure = data_item_1.getComponentByName('structure')
    import pdb; pdb.set_trace()
    decoded_data, unprocessed_trail = decoder.decode(
        encoded_data,
        asn1Spec=Data().clone()
    )
    assert expected == decoded_data

This is expected to decode into a SEQUENCE OF a boolean, a bit-string, and a utc-time which are all members of Data.

The generated error is:

PyAsn1Error: <TagSet object at 0x9c69908 tags 128:0:3-128:32:2> not in asn1Spec: <IECGoosePDU schema object at 0x9c692b0 componentType=<NamedTypes object at 0x9c3ceb8 types <NamedType object at 0x9c32e48 type gocbRef=<VisibleString schema object at 0x9c32ef0 tagSet <TagSet object at 0x9c32f28 tags 128:0:0> encoding us-ascii>>, <NamedType object at 0x9c32e80 type timeAllowedtoLive=<Integer schema object at 0x9c3c0b8 tagSet <TagSet object at 0x9c3c0f0 tags 128:0:1>>>, <NamedType object at 0x9c3c048 type datSet=<VisibleString schema object at 0x9c3c1d0 tagSet <TagSet object at 0x9c3c208 tags 128:0:2> encoding us-ascii>>, <OptionalNamedType object at 0x9c3c160 type goID=<VisibleString schema object at 0x9c3c358 tagSet <TagSet object at 0x9c3c390 tags 128:0:3> encoding us-ascii>>, <NamedType object at 0x9c3c2e8 type t=<UtcTime schema object at 0x9c3c4a8 subtypeSpec <ValueSizeConstraint object at 0x9af64a8 consts 8, 8> tagSet <TagSet object at 0x9c3c4e0 tags 128:0:4> encoding iso-8859-1>>, <NamedType object at 0x9c3c438 type stNum=<Integer schema object at 0x9c3c5f8 tagSet <TagSet object at 0x9c3c630 tags 128:0:5>>>, <NamedType object at 0x9c3c588 type sqNum=<Integer schema object at 0x9c3c710 tagSet <TagSet object at 0x9c3c748 tags 128:0:6>>>, <NamedType object at 0x9c3c6a0 type test=<Boolean value object at 0x9c3c860 namedValues <NamedValues object 0x647d908 enums True=1, False=0> subtypeSpec <ConstraintsIntersection object at 0x647d898 consts <SingleValueConstraint object at 0x647d7f0 consts 0, 1>> tagSet <TagSet object at 0x9c3c898 tags 128:0:7> payload [False]>>, <NamedType object at 0x9c3c7f0 type confRev=<Integer schema object at 0x9c3c9b0 tagSet <TagSet object at 0x9c3c9e8 tags 128:0:8>>>, <NamedType object at 0x9c3c940 type ndsCom=<Boolean value object at 0x9c3cb00 namedValues <NamedValues object 0x647d908 enums True=1, False=0> subtypeSpec <ConstraintsIntersection object at 0x647d898 consts <SingleValueConstraint object at 0x647d7f0 consts 0, 1>> tagSet <TagSet object at 0x9c3cb38 tags 128:0:9> payload [False]>>, <NamedType object at 0x9c3ca90 type numDatSetEntries=<Integer schema object at 0x9c3cc50 tagSet <TagSet object at 0x9c3cc88 tags 128:0:10>>>, <NamedType object at 0x9c3cbe0 type allData=<AllData value object at 0x9c3cdd8 componentType=<Data schema object at 0x9c32dd8 componentType=<NamedTypes object at 0x9c226d8 types <NamedType object at 0x9c11240 type array=<SequenceOf value object at 0x9c112e8 componentType=<Data schema object at 0x9c110b8 componentType=<NamedTypes object at 0x64a4eb8 types > subtypeSpec=<ConstraintsIntersection object at 0x64a4fd0> sizeSpec=<ConstraintsIntersection object at 0x64b3080 consts <ValueSizeConstraint object at 0x64b3048 consts 1, 1>> tagSet=<TagSet object at 0x64a4e48 untagged>> tagSet=<TagSet object at 0x9c11320 tags 128:32:1> subtypeSpec=<ConstraintsIntersection object at 0x64a4550> sizeSpec=<ConstraintsIntersection object at 0x64a4588>>>, <NamedType object at 0x9c11400 type structure=<SequenceOf value object at 0x9c114a8 componentType=<Data schema object at 0x9c11278 componentType=<NamedTypes object at 0x64a4eb8 types > subtypeSpec=<ConstraintsIntersection object at 0x64a4fd0> sizeSpec=<ConstraintsIntersection object at 0x64b3080 consts <ValueSizeConstraint object at 0x64b3048 consts 1, 1>> tagSet=<TagSet object at 0x64a4e48 untagged>> tagSet=<TagSet object at 0x9c114e0 tags 128:32:2> subtypeSpec=<ConstraintsIntersection object at 0x64a4550> sizeSpec=<ConstraintsIntersection object at 0x64a4588>>>, <NamedType object at 0x9c11438 type boolean=<Boolean schema object at 0x9c115f8 namedValues <NamedValues object 0x647d908 enums True=1, False=0> subtypeSpec <ConstraintsIntersection object at 0x647d898 consts <SingleValueConstraint object at 0x647d7f0 consts 0, 1>> tagSet <TagSet object at 0x9c11630 tags 128:0:3>>>, <NamedType object at 0x9c11588 type bit-string=<BitString schema object at 0x9c11710 tagSet <TagSet object at 0x9c11748 tags 128:0:4>>>, <NamedType object at 0x9c116a0 type integer=<Integer schema object at 0x9c11898 tagSet <TagSet object at 0x9c118d0 tags 128:0:5>>>, <NamedType object at 0x9c11828 type unsigned=<Integer schema object at 0x9c119b0 tagSet <TagSet object at 0x9c119e8 tags 128:0:6>>>, <NamedType object at 0x9c11940 type floating-point=<FloatingPoint schema object at 0x9c11b00 tagSet <TagSet object at 0x9c11b38 tags 128:0:7> encoding iso-8859-1>>, <NamedType object at 0x9c11a90 type real=<Real schema object at 0x9c11c88 tagSet <TagSet object at 0x9c11cc0 tags 128:0:8>>>, <NamedType object at 0x9c11c18 type octet-string=<OctetString schema object at 0x9c11da0 tagSet <TagSet object at 0x9c11dd8 tags 128:0:9> encoding iso-8859-1>>, <NamedType object at 0x9c11d30 type visible-string=<VisibleString schema object at 0x9c11f28 tagSet <TagSet object at 0x9c11f60 tags 128:0:10> encoding us-ascii>>, <NamedType object at 0x9c11eb8 type binary-time=<TimeOfDay schema object at 0x9c220b8 subtypeSpec <ConstraintsUnion object at 0x64d1c18 consts <ValueSizeConstraint object at 0x64d1048 consts 4, 4>, <ValueSizeConstraint object at 0x64d10f0 consts 6, 6>> tagSet <TagSet object at 0x9c220f0 tags 128:0:12> encoding iso-8859-1>>, <NamedType object at 0x9c22048 type bcd=<Integer schema object at 0x9c22208 tagSet <TagSet object at 0x9c22240 tags 128:0:13>>>, <NamedType object at 0x9c22198 type booleanArray=<BitString schema object at 0x9c22320 tagSet <TagSet object at 0x9c22358 tags 128:0:14>>>, <NamedType object at 0x9c222b0 type objId=<ObjectIdentifier schema object at 0x9c224a8 tagSet <TagSet object at 0x9c224e0 tags 128:0:15>>>, <NamedType object at 0x9c22438 type mMSString=<MMSString schema object at 0x9c225c0 tagSet <TagSet object at 0x9c225f8 tags 128:0:16> encoding utf-8>>, <NamedType object at 0x9c22550 type utc-time=<UtcTime schema object at 0x9c22748 subtypeSpec <ValueSizeConstraint object at 0x9af64a8 consts 8, 8> tagSet <TagSet object at 0x9c22780 tags 128:0:17> encoding iso-8859-1>>> subtypeSpec=<ConstraintsIntersection object at 0x64a4fd0> sizeSpec=<ConstraintsIntersection object at 0x64b3080 consts <ValueSizeConstraint object at 0x64b3048 consts 1, 1>> tagSet=<TagSet object at 0x64a4e48 untagged>> tagSet=<TagSet object at 0x9c3ce10 tags 128:32:11> subtypeSpec=<ConstraintsIntersection object at 0x64a4550> sizeSpec=<ConstraintsIntersection object at 0x64a4588>>>, <OptionalNamedType object at 0x9c3cd68 type security=<OctetString schema object at 0x9c3cf28 tagSet <TagSet object at 0x9c3cf60 tags 128:0:12> encoding iso-8859-1>>> tagSet=<TagSet object at 0x9c69048 tags 64:32:1> subtypeSpec=<ConstraintsIntersection object at 0x64a4a20> sizeSpec=<ConstraintsIntersection object at 0x64a4a58>>

The following log is also generated:

debug.py 49 DEBUG running pyasn1 0.4.4, debug flags all
debug.py 49 DEBUG debug category 'all' enabled
debug.py 49 DEBUG decoder called at scope with state 0, working with up to 20 octets of substrate:
00000: A2 12 83 01 00 84 03 03 00 00 91 08 5A AA E0 A4
00016: 6F F3 5E 92
debug.py 49 DEBUG tag decoded into <TagSet object at 0x9c69630 tags 128:32:2>, decoding length
debug.py 49 DEBUG value length decoded into 18, payload substrate is:
00000: 83 01 00 84 03 03 00 00 91 08 5A AA E0 A4 6F F3
00016: 5E 92
debug.py 49 DEBUG codec chosen by ASN.1 spec, decoding as explicit tag
debug.py 49 DEBUG codec ExplicitTagDecoder chosen, decoding value
debug.py 49 DEBUG decoder called at scope ? with state 0, working with up to 18 octets of substrate:
00000: 83 01 00 84 03 03 00 00 91 08 5A AA E0 A4 6F F3
00016: 5E 92
debug.py 49 DEBUG tag decoded into <TagSet object at 0x9c69908 tags 128:0:3-128:32:2>, decoding length
debug.py 49 DEBUG value length decoded into 1, payload substrate is:
00000: 00
debug.py 49 DEBUG codec chosen by ASN.1 spec, decoding as explicit tag
debug.py 49 DEBUG codec chosen, decoding as failure

I would appreciate any help with trying to figure this out. Please let me know if there is any more information I can provide.

rfc7508.py test failure (macOS with py27, py34-310)

On macOS 10.14.6, I'm getting a test failure on rfc7508.py (from v0.2.8):

running test
Traceback (most recent call last):
  File "/sw/build.build/pyasn1-modules-py310-0.2.8-1/pyasn1-modules-0.2.8/setup.py", line 137, in <module>
    setup(**params)
  File "/sw/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/sw/lib/python3.10/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/sw/lib/python3.10/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/sw/lib/python3.10/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/sw/build.build/pyasn1-modules-py310-0.2.8-1/pyasn1-modules-0.2.8/setup.py", line 126, in run
    suite = unittest.TestLoader().loadTestsFromNames(
  File "/sw/lib/python3.10/unittest/loader.py", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/sw/lib/python3.10/unittest/loader.py", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/sw/lib/python3.10/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/sw/build.build/pyasn1-modules-py310-0.2.8-1/pyasn1-modules-0.2.8/tests/__main__.py", line 13, in <module>
    suite = unittest.TestLoader().loadTestsFromNames(
  File "/sw/lib/python3.10/unittest/loader.py", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/sw/lib/python3.10/unittest/loader.py", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/sw/lib/python3.10/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/sw/build.build/pyasn1-modules-py310-0.2.8-1/pyasn1-modules-0.2.8/tests/test_rfc7508.py", line 18, in <module>
    from pyasn1_modules import rfc7508
  File "/sw/build.build/pyasn1-modules-py310-0.2.8-1/pyasn1-modules-0.2.8/pyasn1_modules/rfc7508.py", line 44, in <module>
    class HeaderFieldName(char.VisibleString):
  File "/sw/build.build/pyasn1-modules-py310-0.2.8-1/pyasn1-modules-0.2.8/pyasn1_modules/rfc7508.py", line 46, in HeaderFieldName
    constraint.PermittedAlphabetConstraint(*string.printable) -
TypeError: unsupported operand type(s) for -: 'PermittedAlphabetConstraint' and 'PermittedAlphabetConstraint'

This happens with all python versions I've tested, including python3.10.2. There was no issue building v0.2.7.

[PSA] Transfer of ownership

Public Service Announcement

Ilya Etingof is currently unable to maintain pyasn1 and pyasn1-modules. PyPI package ownership for pyasn1 and pyasn1-module has been transfered to me and Simon Pichugin in PyPI support ticket #2090. The upstream repositories for pyasn1 and pyasn1-modules are now in the GitHub organization https://github.com/pyasn1/.

Please join us at https://github.com/pyasn1 if you like to help. We are looking for more contributors and maintainers to spread the workload.

I'm also looking for users to test pyasn1-0.5.0rc1 and pyasn1_modules-0.3.0rc1. You can install the pre-release from PyPI:

pip install --pre pyasn1 pyasn1-modules

pyasn1>=0.4.1 requirement

Hi!

Latest release (0.2.1) depends on pyasn1.type.opentype which has been added in version 0.4.1 of pyasn1, however the setup.py of this package doesn't explicitly depend on that version, instead any version is accepted.

I had a situation where pyasn==0.2.3 was already installed and pyasn1-modules==0.2.1 was installed as a dependency of google-cloud-storage==1.6.0. On my CI this lead to:

  File "<redacted_ve>/lib/python3.6/site-packages/pyasn1_modules/rfc2459.py", line 20, in <module>
    from pyasn1.type import opentype
   ImportError: cannot import name 'opentype'

Fixed this by updating requirements in my project, just wanted to let you know.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.