santoshbt
Hi All,
I need to convert some information to JWE token using a public key. Currently I am considering Jose GitHub - potatosalad/erlang-jose: JSON Object Signing and Encryption (JOSE) for Erlang and Elixir · GitHub. I am getting the signed output in a map. But I am not sure how to convert it to JWE token. If I decrypt it in jwt.io, not getting the proper layload what I have supplied.
Please help.
Thanks
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
Hello,
I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










Showing Posts 1 to 10- Show Best Posts
- Show All Posts (oldest first)
- Show All Posts (newest first)
siddhant3030
Can you show us what the error is? and also what did you try so far maybe then we can help you. Error log will be helpful here
santoshbt
I tried to decode the encrypted token in jwt.io, it says invalid signature and garbled output. There is no error while generating the token. I am also trying Joken to generate the JWT token
tangui
Can you provide some code?
In your initial post you talk only about encryption. In your second post, you say the signature is invalid. What operations are you applying?
One usual secure scheme is to sign then encrypt the payload, which must contain the issuer and the audience of the token. Are you implementing a standard or are you rolling out your own crypto?
Also, encryption is exclusively done with symmetric encryption. Asymmetric keys can be used to generate such symmetric keys (ECDH-ES alg for instance). This is why in JWEs you have both the
"alg"and"enc"fields. Which algorithms do you use exactly?tangui
Also to have the compact representation you have to call the
JOSE.JWE.compact/1function at some point. You have many examples here: JOSE.JWE — JOSE v1.11.12santoshbt
I use “alg” => “RSA-OAEP-256”, “enc” => “A256GCM”
I need to sign using self signed private key and encrypt using public key.
Please let me know, if there is any way
Thanks
tangui
Well the usual way is to first create a signed JWS and get the compact representation, and then to encrypt this payload as a JWE.
First create the keys:
Of course, when encrypting, you won’t have the encryption private key.
Sign the payload and then encrypt it:
Finally you can decrypt and check the signature:
Verification usually involves checking the recipient and the sender of the token, otherwise you can have some subtle but problematic security issues. See https://crypto.stackexchange.com/questions/5458/should-we-sign-then-encrypt-or-encrypt-then-sign and the first link of the first response. Again, rolling out your own crypto is dangerous if this is what you intend to do.
santoshbt
Thanks for the response.
santoshbt
Hi @tangui , can you please let me know how to pass the claim set in this?
Thanks
tangui
To passe the claim set where? What does “this” refers to? When encrypting or decrypting?
santoshbt
I need to add the claimset, which has issuer while generating the encrypted token.
I am currently generating the JWE token in this way,