It looks like they use different encoding schemes, and are probably not compatible (barring a way to convert one signature format to another).
If you’re just looking for a Python-based way to verify a JWT using a JOSE signature, there’s always jsontokens-py. It’s no longer maintained, but the code is small and should still work. I tested as follows:
$ python
Python 2.7.16 (default, May 6 2019, 19:28:45)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import jsontokens
>>> v = jsontokens.TokenVerifier()
>>> v.verify('eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3N1ZWRBdCI6IjE0NDA3MTM0MTQuMTkifQ.7UpSjte-bbk0CsBgC3AJyogLKu6SGzyigFgo2qZeUN6zKHaQsBlz_pFwHkPGLmiz4yvOd5gfWu8R2BwFX55okQ', '027d28f9951ce46538951e3697c62588a87f1f1f295de4a14fdd4c780fc52cfe69')
/usr/lib/python2.7/site-packages/jsontokens-0.0.5-py2.7.egg/jsontokens/token_verifier.py:188: CryptographyDeprecationWarning: signer and verifier have been deprecated. Please use sign and verify instead.
return verifying_key.verifier(signature, self.signing_function)
True
>>>
and
$ node
> jsontokens = require('jsontokens')
{ TokenSigner: [Function: TokenSigner],
createUnsecuredToken: [Function: createUnsecuredToken],
TokenVerifier: [Function: TokenVerifier],
decodeToken: [Function: decodeToken],
MissingParametersError: [Function: MissingParametersError],
InvalidTokenError: [Function: InvalidTokenError],
SECP256K1Client:
{ [Function: SECP256K1Client]
ec:
EC {
curve: [ShortCurve],
n:
<BN: fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141>,
nh:
<BN: 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0>,
g:
<EC Point x: 79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 y: 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8>,
hash: [Function] },
algorithmName: 'ES256K',
keyEncoder: KeyEncoder { options: [Object], algorithmID: [Array] } },
cryptoClients:
{ ES256K:
{ [Function: SECP256K1Client] ec: [EC], algorithmName: 'ES256K', keyEncoder: [KeyEncoder] } } }
> (node:27870) [DEP0079] DeprecationWarning: Custom inspection function on Objects via .inspect() is deprecated
> v = new jsontokens.TokenVerifier('ES26K', '027d28f9951ce46538951e3697c62588a87f1f1f295de4a14fdd4c780fc52cfe69')
Thrown: 'invalid signing algorithm'
> v = new jsontokens.TokenVerifier('ES256K', '027d28f9951ce46538951e3697c62588a87f1f1f295de4a14fdd4c780fc52cfe69')
TokenVerifier {
tokenType: 'JWT',
cryptoClient:
{ [Function: SECP256K1Client]
ec:
EC {
curve: [ShortCurve],
n:
<BN: fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141>,
nh:
<BN: 7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0>,
g:
<EC Point x: 79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 y: 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8>,
hash: [Function] },
algorithmName: 'ES256K',
keyEncoder: KeyEncoder { options: [Object], algorithmID: [Array] } },
rawPublicKey:
'027d28f9951ce46538951e3697c62588a87f1f1f295de4a14fdd4c780fc52cfe69' }
> v.verify('eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3N1ZWRBdCI6IjE0NDA3MTM0MTQuMTkifQ.7UpSjte-bbk0CsBgC3AJyogLKu6SGzyigFgo2qZeUN6zKHaQsBlz_pFwHkPGLmiz4yvOd5gfWu8R2BwFX55okQ')
true