Sunbin Kim
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
Sunbin Kim and Cole Smith, Friday November 1 # CS161 Proj 2: An End-to-End Encrypted File Sharing System ## Section 1: System Design 1) How is each client initialized? A client is initialized with a struct `UserHolder` that contains an encrypted `User` struct (symmetrically encrypted with the password as the key) as well as a hash of the password. A UUID is generated for this object and it is stored in the datastore. The UUID and username are then placed in a map in the datastore so they can be accessed in `GetUser`. When getting a User, we will retrieve the `UserHolder` struct and first check if the hash of the inputted password matches the stored hash of the password. If they match, we use the password to decrypt the `User` struct. The `User` object will contain the username, the user's private RSA key, the user's DSA signing key, as well as a UUID of a dictionary of file UUIDs with filenames as keys. 2) How is a file stored on the server? Files will be stored on the server with a `FileHolder` object that contains a link to the last chunk (4kb) of a file encrypted with a file specific symmetric key as well as a hash of the decrypted file. This allows us to check if the file has been altered by hashing the decrypted chunk and comparing it to the stored hash. Each file chunk contains the UUID of the previous chunk, allowing us to traverse backwards and build the file incrementally while checking that it has not been altered. The `FileHolder` object also contains a map of usernames to RSA encrypted versions of the symmetric key for all users with access to the file. 3) How are file names on the server determined? The keys for the files in the DataStore will be random UUIDs which will point to the `FileHolder` for the file. The UUIDs and corresponding filename will be stored in an encrypted user-specific map object so that a user can later access it. 4) What is the process of sharing a file with a user? To share a file with another user, we decrypt the symmetric key for the file using the user's private key. We then encrypt the symmetric key using the public key of the target user and add it to the map of usernames to encrypted keys in the `FileHolder`. Finally, we send the target user a magic string which contains the UUID of the `FileHolder` for the file enncrypted with their public key, as well as a signature for authenticity. 5) What is the process of revoking a user’s access to a file? To revoke access, we remove the target user's name/encrypted key from the map in the `FileHolder`. Then, we re-encrypt the file with a new symmetric key and RSA encrypt this new key for each user who still has access. When the revoked user attempts to load the file, they will therefore be unable to decrypt it while the users who retain access will still be able to do so. 6) How were each of these components tested? - User - We test to ensure that the user files persist correctly in the datastore and can be accessed again through `GetUser`. We also test to ensure that the user objects are updated correctly after new files are shared/added. - Storage - We tested if the file is stored correctly by first storing the file and then loading it to see if the files match. For appending, we check if the file was tampered before we append and store. - Sharing - We tested multiple aspects of sharing. First, we check the validity of the user who participate in sharing. We test sharing with nonexistent user, nonexistent file, and/or receiving from a wrong user. We also test trying to receive file with wrong magic string. We also test trying to recieve file with the old magic string after the access is revoked. - Revoking - We tested revoking user after we share. Then we checked if the revoked user can still access the file by loading and appending because they shouldn't be able to load or append. We also checked revoking on nonexistent files/users. Finally, we make sure that they can't still access the file through direct UUID access (explained below). ## Section 2: Security Analysis 1) Access Revoked File Directly Through Datastore In this case, we imagined that a user with shared access to file F may user a malicious client to store the UUIDs of the file chunks or the `FileHolder`. Therefore, even after their access is revoked, they could try to access the file directly through the datastore. To protect against this, we added measures to re-encrypt the file after access to anyone is revoked. While the malicious user may still be able to access the objects in the datastore, they will be unable to read them as have encrypted them all with a new symmetric key. We also make sure to encrypt and store the symmetric key using the RSA public keys of all users who should still have access so that they can access the decrypt the file. 2) Tamper In this case, we ensure that a malicious client/server cannot edit a file that is stored within the database. We test if a file has been tampered when we load the file because that's when we can check if the file has been altered or not. First, we test when the same user that stored the file tries to load the file after it has been tampered. Second, we test if the file is tampered before a user tries to append to the file because we do not want to append or store the tampered file. Lastly, we check if the file is tampered after sharing and before receiving the file to make sure that the shared user doesn't receive or load a tampered file. 3) Misuse Magic String/Generate Fake Magic String In these cases, a malicious user uses fake magic strings or misuses acutal magic strings. In the first case, a user tries to use a magic string meant to be shared with another user. We prevent this by encrypting the magic string with the public key of the designated user. In the next case, a user attempts to use an old magic string to access a file even though their access has already been revoked. We prevent this by re-encrypting the entire file with a new symmetric key, so even though the user can access the `FileHolder` with the old magic string, they cannot access the file. Finally, there is the case where a user attempts to generate a fake magic string. This is prevented by attaching a DSA signature to the magic string that can be verified by checking the signature with the verification key of the user who shared it to ensure authenticity.

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully