pyjwt-rsa


Namepyjwt-rsa JSON
Version 1.1.0 PyPI version JSON
download
home_pageNone
SummaryRSA helpers for PyJWT
upload_time2025-01-06 09:35:49
maintainerNone
docs_urlNone
authorDmitry Orlov
requires_python<4.0,>=3.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            PyJWT RSA Helper
================

jwt-rsa is a versatile command-line utility and Python library for managing JSON Web Tokens (JWT) using RSA
cryptography. It enables you to generate RSA key pairs, issue and verify JWTs, convert keys between various formats,
and perform comprehensive key management tasks with ease.

## Installation

Ensure you have Python 3.10 or higher installed. You can install `pyjwt-rsa` using pip:

```
pip install pyjwt-rsa
```

## Python Library

`pyjwt-rsa` can also be used as a Python library for integrating JWT and RSA key management into
your Python applications.

### JWT Class

The `JWT` class provides methods to encode and decode JWT tokens.

#### Importing and Basic Usage

```python
from jwt_rsa import JWT, generate_rsa

# Generate RSA key pair
key_pair = generate_rsa(bits=2048)

# Initialize JWT with private and public keys
jwt = JWT(private_key=key_pair.private, public_key=key_pair.public)

# Encode a JWT token
token = jwt.encode(foo='bar')

# Decode a JWT token
claims = jwt.decode(token)
print(claims)
```

#### Handling Expiration and Not Before Claims

```python
# Encode with custom expiration and nbf
token = jwt.encode(foo='bar', expired=3600, nbf=0)

# Decode without verification
claims = jwt.decode(token, verify=False)
print(claims)
```

#### RSA Key Management

`pyjwt-rsa` provides functions to generate, load, and convert RSA keys.

**Generating RSA Keys:**

```python
from jwt_rsa import generate_rsa

# Generate a 2048-bit RSA key pair
key_pair = generate_rsa(bits=2048)
private_key = key_pair.private
public_key = key_pair.public
```

**Loading RSA Keys:**

```python
from jwt_rsa import load_private_key, load_public_key
from pathlib import Path

# Load private key from a file in one of the supported formats (PEM, JWK, Base64)
private_key = load_private_key(Path('./private.pem'))

# Load public key from a file in one of the supported formats (PEM, JWK, Base64)
public_key = load_public_key(Path('./public.pem'))
```

**Converting RSA Keys to JWK:**

```python
from jwt_rsa import rsa_to_jwk, generate_rsa

private_key, public_key = generate_rsa(bits=2048)

# Convert private key to JWK
private_jwk = rsa_to_jwk(private_key, kid='my-key-id')

# Convert public key to JWK
public_jwk = rsa_to_jwk(public_key, kid='my-key-id')
```

## Command line utility `jwt-rsa`

**jwt-rsa** is a versatile command-line utility for managing JSON Web Tokens (JWT) using RSA cryptography.
It allows you to generate RSA key pairs, issue and verify JWTs, convert keys between formats, and perform
various other key management tasks with ease.

## Features

- **Generate RSA Key Pairs:** Create new RSA public and private keys with customizable parameters.
- **Issue JWTs:** Generate JWT tokens with configurable claims and expiration.
- **Verify JWTs:** Parse and verify the authenticity of JWT tokens.
- **Key Conversion:** Convert keys between PEM, JWK, and Base64 formats.
- **Extract Public Keys:** Derive the public key from a private key.
- **Key Testing:** Validate the integrity of RSA key pairs.

## Installation

Ensure you have Python 3.10 or higher installed. You can install `pyjwt-rsa` using `pip`:

```bash
pip install jwt-rsa
```

## Usage

`jwt-rsa` is operated via the command line with various subcommands to perform different tasks.
Below is an overview of the available commands and their options.

### Commands

#### `keygen`

Generate a new RSA key pair.

**Usage:**

```bash
jwt-rsa keygen [options]
```

**Options:**

- `-b`, `--bits`: Number of bits for the RSA key (default: 2048). Choices: 1024, 2048, 4096, 8192.
- `--kid`: Key ID. If not provided, one will be generated.
- `-a`, `--algorithm`: Algorithm to use (`RS256`, `RS384`, `RS512`). Default: `RS512`.
- `-u`, `--use`: Key usage (`sig` for signature, `enc` for encryption). Default: `sig`.
- `-o`, `--format`: Output format (`pem`, `jwk`, `base64`). Default: `jwk`.
- `-r`, `--raw`: Output raw JSON without indentation.
- `-k`, `--save-public`: Path to save the public key.
- `-K`, `--save-private`: Path to save the private key.
- `-f`, `--force`: Overwrite existing keys if they exist.

**Examples:**

By default `jwt-rsa keygen` generates keys to the standard output.

```bash
$ jwt-rsa keygen -b 1024 -o jwk
Public key in jwk format:
{
 "alg": "RS256",
 "e": "AQAB",
 "kid": "N-ls95OIH-FhdrfM",
 "kty": "RSA",
 "n": "3QHB3jCki6iFYEsYyQ9L9Jmn05bytXYzeaPckyMEdmhti4VPCVI8inec",
 "use": "sig"
}
Private key in jwk format:
{
 "alg": "RS256",
 "d": "...",
 "dp": "...",
 "dq": "...",
 "e": "AQAB",
 "kid": "N-ls95OIH-FhdrfM",
 "kty": "RSA",
 "n": "3QHB3jCki6iFYEsYyQ9L9Jmn05bytXYzeaPckyMEdmhti4VPCVI8inec",
 "p": "...",
 "q": "...",
 "qi": "...",
 "use": "sig"
}
```

If you want to save the keys to files, you can use the `-K`/`--save-private` and `-k`/`--save-public` options:

```bash

Generate a 4096-bit RSA key pair and save them in PEM format:

```bash
$ jwt-rsa keygen -b 4096 -o pem -K /tmp/private.pem -k /tmp/public.pem
Saving public key to /tmp/public.pem in PEM format
Saving private key to /tmp/private.pem in PEM format
```

Generate shorter version. The public key will be saved in a file with the same name as the private key
but with the `.pub` extension:

```bash
$ jwt-rsa keygen -b 4096 -o pem -K /tmp/key
Public key file not specified, saving public key to /tmp/key.pub
Saving public key to /tmp/key.pub in PEM format
Saving private key to /tmp/key in PEM format
```

#### `testkey`

Test the validity of a JWT key pair. Make a round-trip test signing and verifying a random message.

**Usage:**

```bash
jwt-rsa testkey -K PRIVATE_KEY_PATH -k PUBLIC_KEY_PATH
```

**Options:**

- `-K`, `--private-key`: Path to the private key (required).
- `-k`, `--public-key`: Path to the public key (required).

**Examples:**

Ensure that your RSA key pair is valid:

```bash
$ jwt-rsa testkey -K /tmp/key -k /tmp/key.pub
Signing OK
Verifying OK
```


#### `pubkey`

Extract the public key from a private key.

**Usage:**

```bash
jwt-rsa pubkey -K PRIVATE_KEY_PATH [options]
```

**Options:**

- `-K`, `--private-key`: Path to the private key (required).
- `-o`, `--format`: Output format (`pem`, `jwk`, `base64`). Default: `jwk`.
- `-r`, `--raw`: Output raw JSON without indentation.

**Examples:**

Extract the public key from a private key and save it in Base64 format:

```bash
$ jwt-rsa pubkey -K /tmp/key -o base64
MIICCg...EAAQ==
```

#### `issue`

Issue a new JWT token.

**Usage:**

```bash
jwt-rsa issue -K PRIVATE_KEY_PATH [options]
```

**Options:**

- `-K`, `--private-key`: Path to the private JWT key (required).
- `--expired`: Token expiration time in seconds (default: `2678400` seconds, which is 31 days).
- `--nbf`: "Not Before" claim in seconds (default: `-30`).
- `-I`, `--no-interactive`: Disable interactive mode. By default, interactive mode is enabled.
- `-e`, `--editor`: Editor to use in interactive mode. Defaults to the `EDITOR` environment variable or `vim`.

**Examples:**

Issue a JWT token with default expiration and interactive mode:

```bash
jwt-rsa issue -K ./private.pem
```

By default will be opened the default editor to edit the claims, the format is python dictionary, with comments and
pre-filled values:

```python
# This modules functions and constants are available:

#  * DAY = 86400
#  * HOSTNAME = 'localhost'
#  * HOUR = 3600
#  * YEAR = 31536000
#  * datetime = <class 'datetime.datetime'>
#  * format = <built-in function format>
#  * int = <class 'int'>
#  * now = datetime.datetime(2025, 1, 4, 1, 42, 25, 890287)
#  * sum = <built-in function sum>
#  * time = <module 'time' (built-in)>
#  * timestamp = 1735951345
#  * whoami = pwd.struct_passwd(pw_name='example', pw_passwd='********', pw_uid=1000, pw_gid=1000, pw_gecos='Example User')

{
    # === Standard JWT Claims (As per RFC 7519) ===

    # Issuer of the token
    "iss": "{} <{}@{}>".format(whoami.pw_name, whoami.pw_gecos, HOSTNAME),

    # Subject of the token (usually the user ID)
    "sub": "JohnDoe <johndoe@localhost>",

    # Audience for the token
    "aud": "your-audience",

    # Expiration time (Unix timestamp)
    "exp": timestamp + 2678400,

    ...
}
```

After saving and closing the editor, the token will be issued and printed to the stdout.

If you want to disable interactive mode, you can use the `-I`/`--no-interactive` option:

```bash
$ echo '{"foo": "bar"}' | jwt-rsa issue -K /tmp/key -I --expired 3600
eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJleHAiOjE3Mzg2MzAwNDcsIm5iZiI6MTczNTk1MTYyN30.HRCQ
```

In non interactive mode, the input must be a JSON object with the claims to issue the token.

#### `verify`

Parse and verify a JWT token.

**Usage:**

```bash
jwt-rsa verify [options] TOKEN
```

**Options:**

- `-K`, `--private-key`: Path to the private key.
- `-k`, `--public-key`: Path to the public key. If ommited, the public key will be extracted from the private key.
- `-V`, `--no-verify`: Do not verify the token's signature.
- `-I`, `--no-interactive`: Disable interactive mode. By default, interactive mode is enabled.

**Examples:**

Verify a JWT token using the public key:

```bash
$ echo '{"foo": "bar"}' | jwt-rsa issue -K /tmp/key -I --expired 3600 | jwt-rsa verify -k /tmp/key.pub
Enter JWT token:
Decoded token:

{
 "exp": 1738630217,
 "foo": "bar",
 "nbf": 1735951797
}
```

#### `convert`

Convert a JWT token's key format.

**Usage:**

```bash
jwt-rsa convert PRIVATE_KEY_PATH [options]
```

**Options:**

- `private_key`: Path to the source private key (positional argument).
- `-k`, `--save-public`: Path to save the converted public key. If omitted,
  the public key will be saved to the same directory as the private key with a `.pub` extension.
- `-K`, `--save-private`: Path to save the converted private key.
- `-o`, `--format`: Output format (`pem`, `jwk`, `base64`). Default: `jwk`.
- `-f`, `--force`: Overwrite existing keys if they exist.
- `-r`, `--raw`: Output raw JSON without indentation.

**Examples:**

Convert a private key from PEM to JWK format:

```bash
jwt-rsa convert /tmp/key -o jwk -K /tmp/jwk
Public key file not specified, saving public key to /tmp/jwk.pub
Saving public key to /tmp/jwk.pub in PEM format
Saving private key to /tmp/jwk in PEM format
```

Convert a private key from PEM to base64 format and print the output:

```bash
$ jwt-rsa convert /tmp/key -o base64
Public key in base64 format:
MIICCg...EAAQ==
Private key in base64 format:
MIIJQgIBA....DANBgkqhkiG==
```

## License

This project is licensed under the [MIT License](LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyjwt-rsa",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Dmitry Orlov",
    "author_email": "me@mosquito.su",
    "download_url": "https://files.pythonhosted.org/packages/51/71/b02574bafbf75b440bc8b0d15eee762a32b5cbcc31795a77e1e7f9c5054e/pyjwt_rsa-1.1.0.tar.gz",
    "platform": null,
    "description": "PyJWT RSA Helper\n================\n\njwt-rsa is a versatile command-line utility and Python library for managing JSON Web Tokens (JWT) using RSA\ncryptography. It enables you to generate RSA key pairs, issue and verify JWTs, convert keys between various formats,\nand perform comprehensive key management tasks with ease.\n\n## Installation\n\nEnsure you have Python 3.10 or higher installed. You can install `pyjwt-rsa` using pip:\n\n```\npip install pyjwt-rsa\n```\n\n## Python Library\n\n`pyjwt-rsa` can also be used as a Python library for integrating JWT and RSA key management into\nyour Python applications.\n\n### JWT Class\n\nThe `JWT` class provides methods to encode and decode JWT tokens.\n\n#### Importing and Basic Usage\n\n```python\nfrom jwt_rsa import JWT, generate_rsa\n\n# Generate RSA key pair\nkey_pair = generate_rsa(bits=2048)\n\n# Initialize JWT with private and public keys\njwt = JWT(private_key=key_pair.private, public_key=key_pair.public)\n\n# Encode a JWT token\ntoken = jwt.encode(foo='bar')\n\n# Decode a JWT token\nclaims = jwt.decode(token)\nprint(claims)\n```\n\n#### Handling Expiration and Not Before Claims\n\n```python\n# Encode with custom expiration and nbf\ntoken = jwt.encode(foo='bar', expired=3600, nbf=0)\n\n# Decode without verification\nclaims = jwt.decode(token, verify=False)\nprint(claims)\n```\n\n#### RSA Key Management\n\n`pyjwt-rsa` provides functions to generate, load, and convert RSA keys.\n\n**Generating RSA Keys:**\n\n```python\nfrom jwt_rsa import generate_rsa\n\n# Generate a 2048-bit RSA key pair\nkey_pair = generate_rsa(bits=2048)\nprivate_key = key_pair.private\npublic_key = key_pair.public\n```\n\n**Loading RSA Keys:**\n\n```python\nfrom jwt_rsa import load_private_key, load_public_key\nfrom pathlib import Path\n\n# Load private key from a file in one of the supported formats (PEM, JWK, Base64)\nprivate_key = load_private_key(Path('./private.pem'))\n\n# Load public key from a file in one of the supported formats (PEM, JWK, Base64)\npublic_key = load_public_key(Path('./public.pem'))\n```\n\n**Converting RSA Keys to JWK:**\n\n```python\nfrom jwt_rsa import rsa_to_jwk, generate_rsa\n\nprivate_key, public_key = generate_rsa(bits=2048)\n\n# Convert private key to JWK\nprivate_jwk = rsa_to_jwk(private_key, kid='my-key-id')\n\n# Convert public key to JWK\npublic_jwk = rsa_to_jwk(public_key, kid='my-key-id')\n```\n\n## Command line utility `jwt-rsa`\n\n**jwt-rsa** is a versatile command-line utility for managing JSON Web Tokens (JWT) using RSA cryptography.\nIt allows you to generate RSA key pairs, issue and verify JWTs, convert keys between formats, and perform\nvarious other key management tasks with ease.\n\n## Features\n\n- **Generate RSA Key Pairs:** Create new RSA public and private keys with customizable parameters.\n- **Issue JWTs:** Generate JWT tokens with configurable claims and expiration.\n- **Verify JWTs:** Parse and verify the authenticity of JWT tokens.\n- **Key Conversion:** Convert keys between PEM, JWK, and Base64 formats.\n- **Extract Public Keys:** Derive the public key from a private key.\n- **Key Testing:** Validate the integrity of RSA key pairs.\n\n## Installation\n\nEnsure you have Python 3.10 or higher installed. You can install `pyjwt-rsa` using `pip`:\n\n```bash\npip install jwt-rsa\n```\n\n## Usage\n\n`jwt-rsa` is operated via the command line with various subcommands to perform different tasks.\nBelow is an overview of the available commands and their options.\n\n### Commands\n\n#### `keygen`\n\nGenerate a new RSA key pair.\n\n**Usage:**\n\n```bash\njwt-rsa keygen [options]\n```\n\n**Options:**\n\n- `-b`, `--bits`: Number of bits for the RSA key (default: 2048). Choices: 1024, 2048, 4096, 8192.\n- `--kid`: Key ID. If not provided, one will be generated.\n- `-a`, `--algorithm`: Algorithm to use (`RS256`, `RS384`, `RS512`). Default: `RS512`.\n- `-u`, `--use`: Key usage (`sig` for signature, `enc` for encryption). Default: `sig`.\n- `-o`, `--format`: Output format (`pem`, `jwk`, `base64`). Default: `jwk`.\n- `-r`, `--raw`: Output raw JSON without indentation.\n- `-k`, `--save-public`: Path to save the public key.\n- `-K`, `--save-private`: Path to save the private key.\n- `-f`, `--force`: Overwrite existing keys if they exist.\n\n**Examples:**\n\nBy default `jwt-rsa keygen` generates keys to the standard output.\n\n```bash\n$ jwt-rsa keygen -b 1024 -o jwk\nPublic key in jwk format:\n{\n \"alg\": \"RS256\",\n \"e\": \"AQAB\",\n \"kid\": \"N-ls95OIH-FhdrfM\",\n \"kty\": \"RSA\",\n \"n\": \"3QHB3jCki6iFYEsYyQ9L9Jmn05bytXYzeaPckyMEdmhti4VPCVI8inec\",\n \"use\": \"sig\"\n}\nPrivate key in jwk format:\n{\n \"alg\": \"RS256\",\n \"d\": \"...\",\n \"dp\": \"...\",\n \"dq\": \"...\",\n \"e\": \"AQAB\",\n \"kid\": \"N-ls95OIH-FhdrfM\",\n \"kty\": \"RSA\",\n \"n\": \"3QHB3jCki6iFYEsYyQ9L9Jmn05bytXYzeaPckyMEdmhti4VPCVI8inec\",\n \"p\": \"...\",\n \"q\": \"...\",\n \"qi\": \"...\",\n \"use\": \"sig\"\n}\n```\n\nIf you want to save the keys to files, you can use the `-K`/`--save-private` and `-k`/`--save-public` options:\n\n```bash\n\nGenerate a 4096-bit RSA key pair and save them in PEM format:\n\n```bash\n$ jwt-rsa keygen -b 4096 -o pem -K /tmp/private.pem -k /tmp/public.pem\nSaving public key to /tmp/public.pem in PEM format\nSaving private key to /tmp/private.pem in PEM format\n```\n\nGenerate shorter version. The public key will be saved in a file with the same name as the private key\nbut with the `.pub` extension:\n\n```bash\n$ jwt-rsa keygen -b 4096 -o pem -K /tmp/key\nPublic key file not specified, saving public key to /tmp/key.pub\nSaving public key to /tmp/key.pub in PEM format\nSaving private key to /tmp/key in PEM format\n```\n\n#### `testkey`\n\nTest the validity of a JWT key pair. Make a round-trip test signing and verifying a random message.\n\n**Usage:**\n\n```bash\njwt-rsa testkey -K PRIVATE_KEY_PATH -k PUBLIC_KEY_PATH\n```\n\n**Options:**\n\n- `-K`, `--private-key`: Path to the private key (required).\n- `-k`, `--public-key`: Path to the public key (required).\n\n**Examples:**\n\nEnsure that your RSA key pair is valid:\n\n```bash\n$ jwt-rsa testkey -K /tmp/key -k /tmp/key.pub\nSigning OK\nVerifying OK\n```\n\n\n#### `pubkey`\n\nExtract the public key from a private key.\n\n**Usage:**\n\n```bash\njwt-rsa pubkey -K PRIVATE_KEY_PATH [options]\n```\n\n**Options:**\n\n- `-K`, `--private-key`: Path to the private key (required).\n- `-o`, `--format`: Output format (`pem`, `jwk`, `base64`). Default: `jwk`.\n- `-r`, `--raw`: Output raw JSON without indentation.\n\n**Examples:**\n\nExtract the public key from a private key and save it in Base64 format:\n\n```bash\n$ jwt-rsa pubkey -K /tmp/key -o base64\nMIICCg...EAAQ==\n```\n\n#### `issue`\n\nIssue a new JWT token.\n\n**Usage:**\n\n```bash\njwt-rsa issue -K PRIVATE_KEY_PATH [options]\n```\n\n**Options:**\n\n- `-K`, `--private-key`: Path to the private JWT key (required).\n- `--expired`: Token expiration time in seconds (default: `2678400` seconds, which is 31 days).\n- `--nbf`: \"Not Before\" claim in seconds (default: `-30`).\n- `-I`, `--no-interactive`: Disable interactive mode. By default, interactive mode is enabled.\n- `-e`, `--editor`: Editor to use in interactive mode. Defaults to the `EDITOR` environment variable or `vim`.\n\n**Examples:**\n\nIssue a JWT token with default expiration and interactive mode:\n\n```bash\njwt-rsa issue -K ./private.pem\n```\n\nBy default will be opened the default editor to edit the claims, the format is python dictionary, with comments and\npre-filled values:\n\n```python\n# This modules functions and constants are available:\n\n#  * DAY = 86400\n#  * HOSTNAME = 'localhost'\n#  * HOUR = 3600\n#  * YEAR = 31536000\n#  * datetime = <class 'datetime.datetime'>\n#  * format = <built-in function format>\n#  * int = <class 'int'>\n#  * now = datetime.datetime(2025, 1, 4, 1, 42, 25, 890287)\n#  * sum = <built-in function sum>\n#  * time = <module 'time' (built-in)>\n#  * timestamp = 1735951345\n#  * whoami = pwd.struct_passwd(pw_name='example', pw_passwd='********', pw_uid=1000, pw_gid=1000, pw_gecos='Example User')\n\n{\n    # === Standard JWT Claims (As per RFC 7519) ===\n\n    # Issuer of the token\n    \"iss\": \"{} <{}@{}>\".format(whoami.pw_name, whoami.pw_gecos, HOSTNAME),\n\n    # Subject of the token (usually the user ID)\n    \"sub\": \"JohnDoe <johndoe@localhost>\",\n\n    # Audience for the token\n    \"aud\": \"your-audience\",\n\n    # Expiration time (Unix timestamp)\n    \"exp\": timestamp + 2678400,\n\n    ...\n}\n```\n\nAfter saving and closing the editor, the token will be issued and printed to the stdout.\n\nIf you want to disable interactive mode, you can use the `-I`/`--no-interactive` option:\n\n```bash\n$ echo '{\"foo\": \"bar\"}' | jwt-rsa issue -K /tmp/key -I --expired 3600\neyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJleHAiOjE3Mzg2MzAwNDcsIm5iZiI6MTczNTk1MTYyN30.HRCQ\n```\n\nIn non interactive mode, the input must be a JSON object with the claims to issue the token.\n\n#### `verify`\n\nParse and verify a JWT token.\n\n**Usage:**\n\n```bash\njwt-rsa verify [options] TOKEN\n```\n\n**Options:**\n\n- `-K`, `--private-key`: Path to the private key.\n- `-k`, `--public-key`: Path to the public key. If ommited, the public key will be extracted from the private key.\n- `-V`, `--no-verify`: Do not verify the token's signature.\n- `-I`, `--no-interactive`: Disable interactive mode. By default, interactive mode is enabled.\n\n**Examples:**\n\nVerify a JWT token using the public key:\n\n```bash\n$ echo '{\"foo\": \"bar\"}' | jwt-rsa issue -K /tmp/key -I --expired 3600 | jwt-rsa verify -k /tmp/key.pub\nEnter JWT token:\nDecoded token:\n\n{\n \"exp\": 1738630217,\n \"foo\": \"bar\",\n \"nbf\": 1735951797\n}\n```\n\n#### `convert`\n\nConvert a JWT token's key format.\n\n**Usage:**\n\n```bash\njwt-rsa convert PRIVATE_KEY_PATH [options]\n```\n\n**Options:**\n\n- `private_key`: Path to the source private key (positional argument).\n- `-k`, `--save-public`: Path to save the converted public key. If omitted,\n  the public key will be saved to the same directory as the private key with a `.pub` extension.\n- `-K`, `--save-private`: Path to save the converted private key.\n- `-o`, `--format`: Output format (`pem`, `jwk`, `base64`). Default: `jwk`.\n- `-f`, `--force`: Overwrite existing keys if they exist.\n- `-r`, `--raw`: Output raw JSON without indentation.\n\n**Examples:**\n\nConvert a private key from PEM to JWK format:\n\n```bash\njwt-rsa convert /tmp/key -o jwk -K /tmp/jwk\nPublic key file not specified, saving public key to /tmp/jwk.pub\nSaving public key to /tmp/jwk.pub in PEM format\nSaving private key to /tmp/jwk in PEM format\n```\n\nConvert a private key from PEM to base64 format and print the output:\n\n```bash\n$ jwt-rsa convert /tmp/key -o base64\nPublic key in base64 format:\nMIICCg...EAAQ==\nPrivate key in base64 format:\nMIIJQgIBA....DANBgkqhkiG==\n```\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "RSA helpers for PyJWT",
    "version": "1.1.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "148bfa93f2976951e5e6f25dd1909a0b91578805fb12407f64f3e52d9c4d1a93",
                "md5": "4a569d098e82f8ff53b984707725589b",
                "sha256": "afabdeca98fb8c76981f0143ff1165b0104ac518b862c64e6c9e084242f618d3"
            },
            "downloads": -1,
            "filename": "pyjwt_rsa-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4a569d098e82f8ff53b984707725589b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 15842,
            "upload_time": "2025-01-06T09:35:48",
            "upload_time_iso_8601": "2025-01-06T09:35:48.422635Z",
            "url": "https://files.pythonhosted.org/packages/14/8b/fa93f2976951e5e6f25dd1909a0b91578805fb12407f64f3e52d9c4d1a93/pyjwt_rsa-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5171b02574bafbf75b440bc8b0d15eee762a32b5cbcc31795a77e1e7f9c5054e",
                "md5": "3745ff94dfd80b947cec00a40b5dddaf",
                "sha256": "8d5244be0f7a9c95ab35afedb9e96184f6f00121bfaa293d8590f9f130d95fe2"
            },
            "downloads": -1,
            "filename": "pyjwt_rsa-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "3745ff94dfd80b947cec00a40b5dddaf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 15395,
            "upload_time": "2025-01-06T09:35:49",
            "upload_time_iso_8601": "2025-01-06T09:35:49.672537Z",
            "url": "https://files.pythonhosted.org/packages/51/71/b02574bafbf75b440bc8b0d15eee762a32b5cbcc31795a77e1e7f9c5054e/pyjwt_rsa-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-06 09:35:49",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pyjwt-rsa"
}
        
Elapsed time: 0.37942s