Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

CERT Resolver Support? #21

Closed
aviars opened this Issue · 3 comments

2 participants

@aviars

I was looking for a python DNS library that handled CERT records. Although this is defined as dns.rdtypes.ANY.CERT, it the following code does not work:

import dns.resolve
for rdata in dns.resolver.query('alan.direct.transparenthealth.org', 'CERT')
   print rdata.target

I get:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/dns/resolver.py", line 770, in query
   raise_on_no_answer)
File "/usr/lib/python2.7/dist-packages/dns/resolver.py", line 709, in query
    raise_on_no_answer)
File "/usr/lib/python2.7/dist-packages/dns/resolver.py", line 129, in __init__
    raise NoAnswer
dns.resolver.NoAnswer

If I do it using the command line utility, I do indeed get the certificate back.

>dig alan.direct.transparenthealth.org CERT

dig alan.direct.transparenthealth.org CERT +noall +answer
;; Truncated, retrying in TCP mode.

; <<>> DiG 9.8.1-P1 <<>> alan.direct.transparenthealth.org CERT +noall +answer
;; global options: +cmd
alan.direct.transparenthealth.org. 83828 IN CERT PKIX 38725 RSASHA1
MIIDtzCCAyCgAwIBAgIIexSV8b464C8wDQYJKoZIhvcNAQEFBQAwgaEx
MDAuBgkqhkiG9w0BCQEWIXJvb3RAZGlyZWN0LnRyYW5zcGFyZW50aGVh
.
.
.

Is this functionality possible with this library? Am I doing it wrong? I couldn’t find any examples of doing this in Python

@rthalley
Owner
@aviars

Bob:

Yep thanks that was it. I was using the version packaged with Ubuntu 12.04, which is 1.9. I just removed it and reinstalled dnspython with pip and it worked! Thanks so much! Any idea how I would print out just the certificate and/or just the just the algorithm instead of the getting everything?

print rdata.certificate()

Seems to print a binary version, (that I assume I could write to .der file??). I think i want to just fetch the cert. Is this possible?

Best,

Alan

@rthalley
Owner
@rthalley rthalley closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.