You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Such was the code: APNS_AUTH_KEY = './APNsAuthKey_SP7C6832EZ.p8'
f = open(APNS_AUTH_KEY)
secret = f.read()
token = jwt.encode(
payload={
"iss": "8X2A38Q9VD",
"iat": time.time()
},
key= secret,
algorithm= 'ES256',
headers={
"alg": "ES256",
"kid": "SP7C6832EZ",
}
)
But it run with error: Traceback (most recent call last):
File "Http2AuthToken.py", line 31, in
"kid": "SP7C6832EZ",
File "/usr/lib/python2.7/site-packages/jwt/api_jwt.py", line 56, in encode
json_payload, key, algorithm, headers, json_encoder
File "/usr/lib/python2.7/site-packages/jwt/api_jws.py", line 98, in encode
key = alg_obj.prepare_key(key)
File "/usr/lib/python2.7/site-packages/jwt/algorithms.py", line 226, in prepare_key
key = load_pem_private_key(key, password=None, backend=default_backend())
File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/primitives/serialization.py", line 20, in load_pem_private_key
return backend.load_pem_private_key(data, password)
File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/multibackend.py", line 303, in load_pem_private_key
return b.load_pem_private_key(data, password)
File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 1048, in load_pem_private_key
password,
File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 1217, in _load_key
self._handle_key_loading_error()
File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 1289, in _handle_key_loading_error
raise ValueError("Could not unserialize key data.")
ValueError: Could not unserialize key data.
Is there somebody can explain?
The text was updated successfully, but these errors were encountered:
Such was the code:
APNS_AUTH_KEY = './APNsAuthKey_SP7C6832EZ.p8'
f = open(APNS_AUTH_KEY)
secret = f.read()
token = jwt.encode(
payload={
"iss": "8X2A38Q9VD",
"iat": time.time()
},
key= secret,
algorithm= 'ES256',
headers={
"alg": "ES256",
"kid": "SP7C6832EZ",
}
)
But it run with error:
Traceback (most recent call last):
File "Http2AuthToken.py", line 31, in
"kid": "SP7C6832EZ",
File "/usr/lib/python2.7/site-packages/jwt/api_jwt.py", line 56, in encode
json_payload, key, algorithm, headers, json_encoder
File "/usr/lib/python2.7/site-packages/jwt/api_jws.py", line 98, in encode
key = alg_obj.prepare_key(key)
File "/usr/lib/python2.7/site-packages/jwt/algorithms.py", line 226, in prepare_key
key = load_pem_private_key(key, password=None, backend=default_backend())
File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/primitives/serialization.py", line 20, in load_pem_private_key
return backend.load_pem_private_key(data, password)
File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/multibackend.py", line 303, in load_pem_private_key
return b.load_pem_private_key(data, password)
File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 1048, in load_pem_private_key
password,
File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 1217, in _load_key
self._handle_key_loading_error()
File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 1289, in _handle_key_loading_error
raise ValueError("Could not unserialize key data.")
ValueError: Could not unserialize key data.
Is there somebody can explain?
The text was updated successfully, but these errors were encountered: