From b1791961a74e89078ecb49bed0d3928b124182c2 Mon Sep 17 00:00:00 2001 From: Dan Mahr Date: Mon, 14 Feb 2022 22:02:13 -0500 Subject: [PATCH 1/2] Mention reusing RSAPrivateKey for performance reasons --- docs/usage.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/usage.rst b/docs/usage.rst index e40c679d..17e870d5 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -45,6 +45,9 @@ If your private key needs a passphrase, you need to pass in a ``PrivateKey`` obj ) encoded = jwt.encode({"some": "payload"}, private_key, algorithm="RS256") +If you are repeatedly encoding with the same private key, reusing the same +``RSAPrivateKey`` also has performance benefits because it avoids the +CPU-intensive ``RSA_check_key`` primality test. Specifying Additional Headers ----------------------------- From 189c238b44d4d4d4253cdfa7f4c4f18345d2538d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Feb 2022 03:18:20 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/usage.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/usage.rst b/docs/usage.rst index 17e870d5..9d541d56 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -45,8 +45,8 @@ If your private key needs a passphrase, you need to pass in a ``PrivateKey`` obj ) encoded = jwt.encode({"some": "payload"}, private_key, algorithm="RS256") -If you are repeatedly encoding with the same private key, reusing the same -``RSAPrivateKey`` also has performance benefits because it avoids the +If you are repeatedly encoding with the same private key, reusing the same +``RSAPrivateKey`` also has performance benefits because it avoids the CPU-intensive ``RSA_check_key`` primality test. Specifying Additional Headers