Skip to content

Commit

Permalink
Ran black and isort
Browse files Browse the repository at this point in the history
  • Loading branch information
rohe committed Apr 9, 2022
1 parent 8f65177 commit 224984f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
15 changes: 8 additions & 7 deletions src/cryptojwt/jwe/fernet.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@
from cryptojwt.jwe import Encrypter
from cryptojwt.utils import as_bytes


DEFAULT_ITERATIONS = 390000


class FernetEncrypter(Encrypter):
def __init__(self,
password: str,
salt: Optional[bytes] = "",
hash_alg: Optional[str] = "SHA256",
digest_size: Optional[int] = 0,
iterations: Optional[int] = DEFAULT_ITERATIONS):
def __init__(
self,
password: str,
salt: Optional[bytes] = "",
hash_alg: Optional[str] = "SHA256",
digest_size: Optional[int] = 0,
iterations: Optional[int] = DEFAULT_ITERATIONS,
):
Encrypter.__init__(self)
if not salt:
salt = os.urandom(16)
Expand Down
7 changes: 4 additions & 3 deletions tests/test_07_jwe.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import string
import sys

import pytest
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import ec
import pytest

from cryptojwt.exception import BadSyntax
from cryptojwt.exception import HeaderError
Expand Down Expand Up @@ -673,8 +673,9 @@ def test_fernet_sha512():
def test_fernet_blake2s():
encryption_key = SYMKey(use="enc", key="DukeofHazardpass", kid="some-key-id")

encrypter = FernetEncrypter(encryption_key.key, hash_alg="BLAKE2s", digest_size=32,
iterations=1000)
encrypter = FernetEncrypter(
encryption_key.key, hash_alg="BLAKE2s", digest_size=32, iterations=1000
)
_token = encrypter.encrypt(plain)

decrypter = encrypter
Expand Down

0 comments on commit 224984f

Please sign in to comment.