Skip to content

Commit 827d442

Browse files
Docs: mention performance reasons for reusing RSAPrivateKey when encoding (#734)
* Mention reusing RSAPrivateKey for performance reasons * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent b4c5797 commit 827d442

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/usage.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ If your private key needs a passphrase, you need to pass in a ``PrivateKey`` obj
4545
)
4646
encoded = jwt.encode({"some": "payload"}, private_key, algorithm="RS256")
4747
48+
If you are repeatedly encoding with the same private key, reusing the same
49+
``RSAPrivateKey`` also has performance benefits because it avoids the
50+
CPU-intensive ``RSA_check_key`` primality test.
4851

4952
Specifying Additional Headers
5053
-----------------------------

0 commit comments

Comments
 (0)