Skip to content

OpenSSL issue when decrypting token #22

@saemideluxe

Description

@saemideluxe

Hi there

When I call

JOSE::JWK.from_oct(my_key)
JOSE::JWE.block_decrypt(jwk, token)

I get the following error from OpenSSL:

/home/sam/test_ruby/vendor/bundle/ruby/3.1.0/gems/jose-1.1.3/lib/jose/jwe/enc_aes_gcm.rb:46:in `final': OpenSSL::Cipher::CipherError
        from /home/sam/test_ruby/vendor/bundle/ruby/3.1.0/gems/jose-1.1.3/lib/jose/jwe/enc_aes_gcm.rb:46:in `block_decrypt'
        from /home/sam/test_ruby/vendor/bundle/ruby/3.1.0/gems/jose-1.1.3/lib/jose/jwe.rb:602:in `block_decrypt'
        from /home/sam/test_ruby/vendor/bundle/ruby/3.1.0/gems/jose-1.1.3/lib/jose/jwe.rb:584:in `block_decrypt'
        from /home/sam/test_ruby/test.rb:11:in `<top (required)>'
        from /usr/lib/ruby/3.1.0/bundler/cli/exec.rb:58:in `load'
        from /usr/lib/ruby/3.1.0/bundler/cli/exec.rb:58:in `kernel_load'
        from /usr/lib/ruby/3.1.0/bundler/cli/exec.rb:23:in `run'
        from /usr/lib/ruby/3.1.0/bundler/cli.rb:484:in `exec'
        from /usr/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /usr/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from /usr/lib/ruby/3.1.0/bundler/cli.rb:31:in `dispatch'
        from /usr/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from /usr/lib/ruby/3.1.0/bundler/cli.rb:25:in `start'
        from /usr/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/libexec/bundle:48:in `block in <top (required)>'
        from /usr/lib/ruby/3.1.0/bundler/friendly_errors.rb:103:in `with_friendly_errors'
        from /usr/lib/ruby/gems/3.1.0/gems/bundler-2.3.7/libexec/bundle:36:in `<top (required)>'
        from /usr/bin/bundle3.1:25:in `load'
        from /usr/bin/bundle3.1:25:in `<main>'

Decrypting the token and the key work when using jose for nodejs. Any idea what could be the problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions