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

feat: UMass 2022 Pico W Template #8

Merged
merged 15 commits into from
Nov 13, 2022

Conversation

JeremyTubongbanua
Copy link
Member

@JeremyTubongbanua JeremyTubongbanua commented Nov 10, 2022

This is being merged into a separate branch

- What I did

  • Wrote a README.md to get them started

  • Created lib/at_client/ containing:

  • aes.py <- AES CTR

  • at_utils.py <- atSign util functions

  • io_util.py <- settings reading, key reading, functions

  • keys_util.py <- has initialize_keys(atSign:str) to init _pem.json rsa private key files

  • remote_secondary.py <- has connect_to_secondary() and send_verb() functions

  • main2.py run this file to 1. connect to Internet, 2. initialize keys, 3. find secondary, 4. listen/emit data via raw atProtocol and unencrypted data

- How I did it

- How to verify it

- Description for the changelog

  • One thing to note: I tried to convert the Public RSA keys to pem to enable end-to-end encryption, but have no luck with that.
  • Therefore, end-to-end encryption is currently not possible (because then we can't create shared keys or decrypt them).

Update: Nov 12,

  • Figured out how to get n and e from a given RSA Public Key. Turns out, the file uasn1.py is leaking a few hex bytes into other sequences which made decoding a public rsa key a little trickier than it should've been. See the get_public_n_e function in pem_service.py
  • Updated README.md with more detail to get their Picos ready for running atPlatform code.

@cpswan cpswan marked this pull request as draft November 10, 2022 18:20
@cpswan
Copy link
Member

cpswan commented Nov 10, 2022

@JeremyTubongbanua I've just made this a draft, as at first glance it's nowhere near ready to be merged.

There are a bunch of key boilerplate files being overwritten or deleted.

I see another copy of the firmware, which just got purged in #7

@JeremyTubongbanua JeremyTubongbanua marked this pull request as ready for review November 10, 2022 19:14
@JeremyTubongbanua
Copy link
Member Author

JeremyTubongbanua commented Nov 10, 2022

@cpswan I added back the repository files- initially, I removed them so the students wouldn't be overwhelmed but I guess these are important as a company.

Also removed the .uf2 and link them to our fork of micropython.

Actually- let me go through it once more.

@JeremyTubongbanua JeremyTubongbanua marked this pull request as draft November 10, 2022 19:19
@JeremyTubongbanua JeremyTubongbanua marked this pull request as ready for review November 12, 2022 18:43
@JeremyTubongbanua
Copy link
Member Author

JeremyTubongbanua commented Nov 12, 2022

@cpswan

I would like to merge this just to get the students up and running with the Pico Ws.

Lots of prerequisites for the students to go through before they can start sending data between atSigns:

  • getting our special .uf2 Micropython firmware onto their Picos with AES-CTR enabled
  • getting their own atSigns and their associated .atKeys files...
  • then putting their .atKeys through FTP into the Pico W

I will look to make another PR after this one with more at_client characteristics like an at_client class with functions like get, put, delete, maybe an AtKey class to relieve even more stress off the students and also a template.py for the students to use with automatic auth and all the encryption that goes into sending encrypted data between atSigns.

P.S. I've figured out how to get the n and e given a Public RSA key (instead of deriving it from a Private RSA key). Therefore, end-to-end encryption is possible now. Just look inside pem_service.py and the last function in the file.

Big thank you to @realvarx for doing lots of the heavy lifting.

@JeremyTubongbanua JeremyTubongbanua merged commit f448bce into atsign-foundation:umass2022 Nov 13, 2022
@realvarx
Copy link
Collaborator

@cpswan

I would like to merge this just to get the students up and running with the Pico Ws.

Lots of prerequisites for the students to go through before they can start sending data between atSigns:

  • getting our special .uf2 Micropython firmware onto their Picos with AES-CTR enabled
  • getting their own atSigns and their associated .atKeys files...
  • then putting their .atKeys through FTP into the Pico W

I will look to make another PR after this one with more at_client characteristics like an at_client class with functions like get, put, delete, maybe an AtKey class to relieve even more stress off the students and also a template.py for the students to use with automatic auth and all the encryption that goes into sending encrypted data between atSigns.

P.S. I've figured out how to get the n and e given a Public RSA key (instead of deriving it from a Private RSA key). Therefore, end-to-end encryption is possible now. Just look inside pem_service.py and the last function in the file.

Big thank you to @realvarx for doing lots of the heavy lifting.

Everything looks nice at first glance, but be careful with RSA signing part. The privateKey was stored in the JSON (and retrieved in one concrete step, making the user re-launch the Pico W) because the device would run out of memory (it wasn't possible to stablish an SSL connection to the dess after retrieving the DER parameters). I didnt spend too much time trying to solve this, I just decided to do it this way so I could keep making progress. If that happens to you in the future, it could be for this reason.

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

Successfully merging this pull request may close these issues.

3 participants