Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while parsing DER certificate with script #1

Open
dsoprea opened this issue Apr 12, 2014 · 0 comments
Open

Error while parsing DER certificate with script #1

dsoprea opened this issue Apr 12, 2014 · 0 comments

Comments

@dsoprea
Copy link

dsoprea commented Apr 12, 2014

As requested:

I used M2Crypto to build a certificate and add an subjectAltName "otherName" extension.

$ x509_parse.py test.der 
Traceback (most recent call last):
  File "/usr/local/bin/x509_parse.py", line 8, in <module>
    load_entry_point('pyx509==0.1.4', 'console_scripts', 'x509_parse.py')()
  File "/Library/Python/2.7/site-packages/pyx509/commands.py", line 36, in print_certificate_info_cmd
    print_certificate_info(file(sys.argv[1]).read())
  File "/Library/Python/2.7/site-packages/pyx509/commands.py", line 29, in print_certificate_info
    X509Certificate.from_der(derData).display()
  File "/Library/Python/2.7/site-packages/pyx509/models.py", line 56, in from_der
    return cls(asn1[0])
  File "/Library/Python/2.7/site-packages/pyx509/models.py", line 754, in __init__
    self.tbsCertificate = Certificate(tbsCert)
  File "/Library/Python/2.7/site-packages/pyx509/models.py", line 724, in __init__
    self.extensions = self._create_extensions_list(tbsCertificate.getComponentByName('extensions'))
  File "/Library/Python/2.7/site-packages/pyx509/models.py", line 737, in _create_extensions_list
    return [Extension(ext) for ext in extensions]
  File "/Library/Python/2.7/site-packages/pyx509/models.py", line 676, in __init__
    self.value = decoderFunction(v)
  File "/Library/Python/2.7/site-packages/pyx509/models.py", line 630, in <lambda>
    "2.5.29.17": (asn1_cert_ext.GeneralNames(), lambda v: SubjectAltNameExt(v),
  File "/Library/Python/2.7/site-packages/pyx509/models.py", line 281, in __init__
    value = Name(comp)
  File "/Library/Python/2.7/site-packages/pyx509/models.py", line 131, in __init__
    type = str(attr.getComponentByPosition(0).getComponentByName('type'))
AttributeError: 'int' object has no attribute 'getComponentByPosition'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant