Skip to content

Encrypt generates corrupt signature #9

@mwillbanks

Description

@mwillbanks

When utilizing the encrypt method there are times when you want to decrypt and verify the token. Unfortunately this is not possible as the encryption passes the claims encrypted to the encode method. This causes a corrupt signature thus rendering the verification of the token useless.

There are a few different pathways to a solution here...

  1. Generate the signature always leveraging the set claims (aka encode does not utilized the passed in claims to generate the signature but rather the classes assigned claims).
  2. Pass in a signature and generate it within the encrypt method.

Other Thought and Better Approach
The library should likely treat decode and encode as a pre-processor and a post-processor. Meaning that they should only be run on a generated token. This would then mean the encode and decode have the responsibility of finding their area (aka claims by delimiter), and encoding the result from that standpoint vs. encoding the raw data. This would make it significantly more clean whilst not destroying the signature.

It would be up to the clients in this case to be able to understand how to decode the item.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions