Questions tagged [jwcrypto]
9 questions
3
votes
1 answer
How to create a signed JWT token using python
Im using the jwcrypto library to create a signed JWT. The requirement is to produce a JWT signed by the private component of an RSA key. I took the steps below
Create JWK key pair
from jwcrypto import jwk,jwt
key = jwk.JWK.generate(
…

West
- 2,350
- 5
- 31
- 67
3
votes
1 answer
How to encrypt dictionary data?
I am using jwcrypto to encrypt data using public key. I have gone through the documentation and the JWE class only takes plaintext as payload.
But I have a dictionary to encrypt as a payload.
I can convert the dictionary to json and encrypt the…

varad
- 7,309
- 20
- 60
- 112
1
vote
1 answer
Validating JWT with root certificate
I'm trying to load the FIDO Alliance Metadata in Python using JWCrypto, but I always get a jwcrypto.jws.InvalidJWSSignature('Verification failed') error.
FIDO Alliance provides an endpoint with authenticator metadata as they state here. The data is…

MinistrChleba
- 31
- 1
- 5
1
vote
1 answer
error when importing jwcrypto in python2.7
I am using jwcrypto in python2.7, and here comes a problem.
>>> import jwcrypto
>>> from jwcrypto import jwk, jws
Traceback (most recent call last):
File "", line 1, in
File…

lsqqqq
- 11
- 1
1
vote
1 answer
How do I sign a JWT using ES256?
I am trying to sign using pyjwt
key = jwk.JWK.from_pem(pkey_contents)
token = jwt.JWT(header={"alg": "ES256"},
claims=Token.serialize())
token.make_encrypted_token(key)
and I am getting this error
app_1 | File…

wonton
- 7,568
- 9
- 56
- 93
1
vote
1 answer
How to add expiry to JWE?
I am trying to add expiry time to JWE which I am generating using jwcrypto library in the following way
from jwcrypto import jwe, jwk, jwt
from datetime import datetime, timedelta
import time
# create JWK from existing key
jwk_str =…

nishith
- 1,223
- 1
- 12
- 21
0
votes
2 answers
How to use a jwt.io provisioned token with jwcrypto?
I am trying to use a jwt.io generated JWT within my python code using jwcrypto with some success. I am saying some success because I am able to retrieve the claims (the wrong way) without validating the signature.
Here's my code
from jwcrypto…

George
- 2,758
- 12
- 16
0
votes
1 answer
App Store Connect returns 401 Status Code for all my requests
What am I doing wrong here? I get 401 status code for all my requests although something meaningful is printed for the serialized token.
from jwcrypto import jwk, jwt
import time
import os
import requests
kid = os.getenv("appstoreconnect_kid")
iss…

hisaf
- 1
- 1
0
votes
1 answer
jwe cannot encrypt data correctly by jwcrypto
I has a requirement to generate encrypted data by jwe. The implementation of ruby can work correctly. But the python implementation cannot work correctly.
The ruby implementation
require 'jwe'
key = OpenSSL::PKey::RSA.new File.read…

neal
- 164
- 3
- 15