asmarty
    • 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
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

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

      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.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      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
    • Note Insights New
    • Make a copy
    • 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 Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Make a copy 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
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

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

    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.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Python JOSE Proposal ## Proposed Option Implement required JOSE parts in Python based on https://github.com/lepture/authlib * The plan is to fork authlib and contribute to upstream. An issue with proposal is created: https://github.com/lepture/authlib/issues/370 * If for some reasons they will not accept our contribution, we will just copy the required JOSE part into our DID Comm Python lib. This is basically Option 1 (see below) with Option 3 as a backup plan. **authlib** lacks only the following features that we need: * ECDH-1PU key agreement scheme; * XC20P encryption algorithm; * JSON serialization for JWE and multi-recipient support. ## All Options 1. Fork authlib, implement the lacked features in it and contribute to upstream. In case contribution is not accepted for some reasons, just copy the necessary JOSE part right into DIDComm Python library. (This option is described in details above.) * **Pros:** * Natural separation between DIDComm and JOSE parts in case the contribution is accepted to upstream; * No need to maintain a fork; * The DID Comm lib will be smaller as it will not contain crypto/JOSE specific implementations. * **Cons:** * The new version of autlib may not be released in time (October 2021); * Need to understand and dig into existing authlib implementations; * Having both DIDComm and JOSE parts in the same library in case the contribution is not accepted to upstream. 2. Fork authlib, implement the lacked features in it and use the fork as a dependency in DIDComm Python library. * **Pros:** - Our release doesn't depend on authlib; - Natural separation between DIDComm and JOSE parts in any case; - No contribution to authlibupstream is needed. * **Cons:** - Necessity to maintain the fork and regularly merge with upstream’s master. 3. Copy Authlib into DIDComm Python library then Implement the lacked features not in authlib * **Pros:** - Our release doesn't depend on authlib; - No contribution to authlib upstream is needed; - No fork support is needed. * **Cons:** - DIDComm and JOSE parts are messed over libraries. 4. Fork PyJWT and then contribute to upstream. An issue with proposal is created: https://github.com/jpadilla/pyjwt/issues/672 * **Pros:** - No need to understand the JWE code; - New contributions are welcome. * **Cons:** - Need to implement the lots of lacked feature; - Our release depends on PyJWT. 5. Implement a common DIDComm in Rust and provide a Python wrapper around it. * **Pros:** - Only one DIDComm library to maintain and fix; - Potentially reduce development costs by 2-3 times; - Don’t need to contribute to JOSE, we don’t depend on JOSE releases. * **Cons:** - Needs a wrapper per each language; - It's more difficult for the community to maintain DIDComm library. # Python JOSE libraries comparison This section describe result of OpenSource Python's JOSE libraries comparison. * [PyJWT](https://github.com/jpadilla/pyjwt/) * [python-jose](https://github.com/mpdavis/python-jose/) * [JWCrypto](https://github.com/latchset/jwcrypto/) * [Authlib](https://github.com/lepture/authlib) ## Supported JOSE specs * [RFC7515: JSON Web Signature](https://datatracker.ietf.org/doc/html/RFC7515) * [RFC7516: JSON Web Encryption](https://datatracker.ietf.org/doc/html/RFC7516) * [RFC7517: JSON Web Key](https://datatracker.ietf.org/doc/html/RFC7517) * [RFC7518: JSON Web Algorithms](https://datatracker.ietf.org/doc/html/rfc7518) * [RFC7519: JSON Web Token](https://datatracker.ietf.org/doc/html/RFC7519) * [RFC8037: ECDH in JWS and JWE](https://datatracker.ietf.org/doc/html/RFC8037) * [Public Key Authenticated Encryption for JOSE](https://datatracker.ietf.org/doc/html/draft-madden-jose-ecdh-1pu-04) | Library | JWS | JWE | JWK | JWA | JWT | ECDH-ES | ECHD-1PU | | ----------- |:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:--------:| | PyJWT | :heavy_check_mark: | :x: | :heavy_check_mark: | :x: | :heavy_check_mark: | :x: | :x: | | python-jose | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: | | JWCrypto | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: | | Authlib | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: | ## Supported curves | Library | X25519 | P-384 | P-256 | | ----------- |:------------------:|:------------------:|:------------------:| | PyJWT | :x: | :heavy_check_mark: | :heavy_check_mark: | | python-jose | :x: | :heavy_check_mark: | :heavy_check_mark: | | JWCrypto | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | Authlib | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | ## Supported encryption protocols | Library | XC20P | A256GCM | A256CBC-HS512 | | ----------- |:-----:|:------------------:|:------------------:| | PyJWT | :x: | :x: | :x: | | python-jose | :x: | :heavy_check_mark: | :heavy_check_mark: | | JWCrypto | :x: | :heavy_check_mark: | :heavy_check_mark: | | Authlib | :x: | :heavy_check_mark: | :heavy_check_mark: | ## Supported signature protocols | Library | EdDSA | ES256 | ES256K | | ----------- |:-----:|:------------------:|:------------------:| | PyJWT | :x: | :heavy_check_mark: | :heavy_check_mark: | | python-jose | :x: | :heavy_check_mark: | :x: | | JWCrypto | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | Authlib | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | ## Key Wrapping algorithms supported | Library | ECDH-ES+A256KW | | ----------- |:------------------:| | PyJWT | :x: | | python-jose | :heavy_check_mark: | | JWCrypto | :heavy_check_mark: | | Authlib | :heavy_check_mark: | ## Supported JWS/JWE Serialization | Library | JWS JSON Serialization | JWS Compact Serialization | JWE JSON Serialization | JWE Compact Serialization | | ----------- | -------------------------:|:----------------------:|:-------------------------:|:----------------------:| | PyJWT | :x: | :heavy_check_mark: | :x: | :x: | | python-jose | :x: | :heavy_check_mark: | :x: | :heavy_check_mark: | | JWCrypto | :x: | :heavy_check_mark: | :x: | :heavy_check_mark: | | Authlib | :heavy_check_mark: | :heavy_check_mark: | :x: | :heavy_check_mark: | ## License | Library | License | | ----------- |:-------------------------------------- | | PyJWT | MIT License | | python-jose | MIT License | | JWCrypto | GNU Lesser General Public License v3.0 | | Authlib | BSD 3-Clause License | ## External contributions All libraries are open to external contributions. NOTE: python-jose has rare releases ## How ECDH-1PU can be supported - PyJWT. The better way is implement JWE spec on top - python-jose. Create a fork project - JWCrypto. Create a fork project - Authlib. Lots of code changes required (library API needs to be changed). Two options: - contribution to the upstream - create a fork project ## Crypto lib - PyJWT uses [pyca/cryptography](https://pypi.org/project/cryptography/) - python-jose you can select crypto lib: 1. [pyca/cryptography](https://pypi.org/project/cryptography/) 2. [pycryptodome](https://pycryptodome.readthedocs.io/en/latest/) 3. native python. [python-rsa](https://stuvel.eu/rsa) and [python-ecdsa](https://github.com/warner/python-ecdsa) - JWCrypto uses [pyca/cryptography](https://pypi.org/project/cryptography/) - Authlib uses [pyca/cryptography](https://pypi.org/project/cryptography/) ## Security issues - pyca/cryptography - https://github.com/pyca/cryptography/issues/6167 - https://snyk.io/vuln/pip:cryptography - pycryptodome (no active security issues) - https://snyk.io/vuln/pip:pycryptodome # Conclusion ## Common * Libraries use `pyca/cryptography` as crypto library we can add required alghoritms * Libraries don't support `ECDH-1PU` and also don't have it in roadmap * Libraries don't support `XC20P` * Libraries don't implement JWE JSON Serialization * Libraries don't support Multi-recipient ## JWCrypto This library is distributed under GNU Lesser General Public License v3.0 also there are as same issues as authlib ## python-jose python-jose doesn't implement the lot of features ## PyJWT PyJWT doesn't support JWE specification, we can try to contribute it ## Autlib Authlib implements the lot of features. It has the clearest code base **authlib** lacks only the following features that we need: * ECDH-1PU key agreement scheme, * XC20P encryption algorithm, * JSON serialization for JWE and multi-recipient support. ## Result If we want to contribute to the existing Jose library, two options will work: PyJWT and Authlib. The main issue with Authlib is the large monolithic library. The main issue with PyJWT is that it doesn't support the JWE spec. ## WBS ### PyJWT | Task | Realistic Estimate for Team (man hrs)| | :----------- |:-------------------------------------- | | Ed25519 support | 8 | | Add JSON serialization | 8 | | Save key to JWK format | 16 | | Add ECHD-ES | 16 | | Add ECHD-1PU | 8 | | JWE headers | 8 | |Multi-recipient | 16 | | XC20P support | 16 | | A256GCM support | 8 | | A256CBC-HS512 | 8 | ### Authlib | Task | Realistic Estimate for Team (man hrs)| | :----------- |:-------------------------------------- | | ECDH-1PU | 16 | | Multi-recipient| 16 | | XC20P| 8 | | JSON serialization for JWE| 8 | In conclusion Authlib looks better than JWTIn conclision Authlib looks better than PyJWT

    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
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    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