[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #33428 [Core Tor/Chutney]: Make chutney check for relay microdescriptors before verifying



#33428: Make chutney check for relay microdescriptors before verifying
-------------------------------------------+-------------------------------
 Reporter:  teor                           |          Owner:  (none)
     Type:  enhancement                    |         Status:  new
 Priority:  Medium                         |      Milestone:
Component:  Core Tor/Chutney               |        Version:
 Severity:  Normal                         |     Resolution:
 Keywords:  ipv6, prop311, outreachy-ipv6  |  Actual Points:
Parent ID:  #33050                         |         Points:  1
 Reviewer:                                 |        Sponsor:  Sponsor55-can
-------------------------------------------+-------------------------------

Comment (by teor):

 Replying to [comment:11 anuradha1904]:
 > This is the code that I wrote:
 > {{{
 > with
 open("/home/anuradha/chutney/net/nodes/000a/keys/ed25519_master_id_public_key",
 'r', errors = 'ignore') as f:
 >    f.seek(32)
 >    rest = f.read()
 >    print(rest)
 >    EncodedZip = base64.b64encode(rest)
 >    print(EncodedZip)
 > }}}
 >
 > I am able to print the key that is required but I am not able to perform
 any encoding on it, it gives the error "ValueError: string argument should
 contain only ASCII characters".

 When I search for "python b64encode", I see:
 https://duckduckgo.com/html?q=python%20b64encode

 Here is part of the answer: b64encode expects 'bytes', not 'string':
 https://stackoverflow.com/questions/8908287/why-do-i-need-b-to-encode-a
 -string-with-base64/41437531#41437531

 Here is an explanation of the difference between 'bytes' and 'string':
 https://stackoverflow.com/questions/6224052/what-is-the-difference-
 between-a-string-and-a-byte-string

 Here is the base64.b64encode reference documentation:
 https://docs.python.org/3.5/library/base64.html#base64.b64encode

 You didn't say if you were running python 2 or python 3. But if you're
 getting that error, you're probably running python 3.

 Here is some code that should work for python 3:
 {{{
 with
 open("/home/anuradha/chutney/net/nodes/000a/keys/ed25519_master_id_public_key",
 'rb') as f:
 }}}

 You might also want to delete this line, because it could cause errors:
 {{{
    print(rest)
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/33428#comment:12>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs