Questions tagged [pyasn1]
42 questions
1
vote
1 answer
[Pyasn1]: raise error.PyAsn1Error('Component type error %r vs %r' % (t, value))
I have only one choice and within that choice I want to pass the object of the class with only one field.
Here is my code snippet:-
from pyasn1.type import univ, namedtype, tag, char, namedval, useful
from pyasn1.codec.ber import encoder
class…

sam
- 635
- 4
- 9
- 18
1
vote
1 answer
Error while creating an X509 certificate with extensions in PyASN1
I'm trying to create a X509v3 certificate and encode it in DER and save it into a file. I'm using PyASN1 0.1.7 and Python 2.7.6 on Ubuntu 14.04.
The code can be summarized as this:
tbs = rfc2459.TBSCertificate()
tbs.setComponentByName('XYZ', xyz) #…

zaadeh
- 1,711
- 2
- 23
- 37
1
vote
1 answer
Simpler way to add tagged items in pyasn1
The best way I found to add explicitly tagged items in pyasn1 is to... explicitly tag them. But this looks overly verbose:
cert['tbsCertificate']['extensions'] = rfc2459.Extensions().subtype(explicitTag=tag.Tag(tag.tagClassContext,…

viraptor
- 33,322
- 10
- 107
- 191
1
vote
1 answer
pyasn1 and strange mismatch when setting component
I'm running into a strange issue when setting a component using pyasn1. I construct and empty certificate and put a certificate to be signed in it:
empty = rfc2459.Certificate()
empty['tbsCertificate'] = rfc2459.TBSCertificate()
Now I want to set a…

viraptor
- 33,322
- 10
- 107
- 191
0
votes
1 answer
Cant perform SNMP_SET via PyASN1 modules
I am trying to perform simple snmp-set request with following code:
import socket
import sys
from pyasn1.codec.ber import decoder
from pyasn1.codec.ber import encoder
from pyasn1_modules import rfc1155
from pyasn1_modules import rfc1157
from…

Dart
- 1
- 1
0
votes
1 answer
How to work around ASN.1 library not supporting RELATIVE-OID
I’m trying to use the asn1tools Python library to decode and encode BER messages conforming to the Ember+ standard.
That standard’s DTD uses ASN.1’s RELATIVE-OID type in some places. However, asn1tools doesn’t know about this type, probably because…

scy
- 7,132
- 2
- 27
- 35
0
votes
1 answer
How to create a GeneralName with pyasn1?
Being fairly new to pyasn1 (pyasn1 0.4.8, pyasn1-modules 0.2.8) and ASN.1 in general, I'm trying to construct a GeneralName:
>>> from pyasn1.codec.der.encoder import encode
>>> from pyasn1.type import char
>>> from pyasn1_modules import rfc2459
>>>…

user686249
- 669
- 6
- 17
0
votes
2 answers
ParseError: Invalid ASN.1 syntax at line 1, column 1: '>!<"': Expected modulereference
I am new to asn1 ,my agenda is i want to convert python dictionary into .asn format.
when i ran the below code i got the following error
ParseError: Invalid ASN.1 syntax at line 1, column 1: '>!<"': Expected modulereference.
from __future__ import…

ganesh j
- 1
- 1
0
votes
1 answer
How to run pyasn1 installed with pip
Apparently I'm doing something wrong, and all instructions I have found literally everywhere say how to install (program name here) with PIP but not how to execute it.
I am trying to run pyasn1, using a python3 virtual environment.
I have also tried…

c.fogelklou
- 1,781
- 1
- 13
- 26
0
votes
1 answer
python.pyasn1 to express below strcture
I am a new to Python and PYASN1, how to express below strcture? is there any docuement I can refer to? I search on the internect, there's a little document about the PYASN1
OtherInfo ::= SEQUENCE {
keyInfo KeySpecificInfo,
partyAInfo…

sic wang
- 3
- 1
0
votes
1 answer
How to prettyprint as hex a pyasn1 octect string that is printed as ascii
I have some pyasn1 octect string objects defined like this:
LInfo.componentType = namedtype.NamedTypes(namedtype.NamedType('XXX', univ.OctetString().subtype(subtypeSpec=constraint.ValueSizeConstraint(2,…

mikah
- 3
- 3
0
votes
1 answer
Python pyasn1 conflict via sqlalchemy
I have a Python code using sqlalchemy library. It's running fine in my dev environment. The error happened after I moved into prod.
The error message is
pkg_resources.ContextualVersionConflict: (pyasn1 0.4.4
…
0
votes
0 answers
How do I get access to RSA-encrypted AES key data from EncryptedKey object? Python
I am trying to access key data bytes from an EncryptedKey object. I am unclear on whether this is a PyAsn1 object or a Python object or a Python cryptography object. How do I access the key data? I have tried…

Sheela Singla
- 93
- 1
- 6
0
votes
1 answer
Can't get encrypted key out of pkcs7 envelope with PyAsn1 Python
I am trying to extract a RSA-encrypted AES key from a PKCS7 envelope and am getting an error that says the encrypted key is a schema, not a value. Why is this when in the envelope there is a line that says encryptedKey=....
content, rest =…

Sheela Singla
- 93
- 1
- 6
0
votes
1 answer
Not able to install scikit-survival package. Get a Pyasn1 error and a "dill' Error
I have been trying to install scikit-survival package for survival analysis but whenever I try to do this I get the error shown below.
Error
pyasn1-modules 0.1.5 has requirement pyasn1<0.4.0,>=0.3.4, but you'll have pyasn1 0.1.9 which is…

Pads
- 51
- 6