Skip to content

Commit

Permalink
Fixes code formatting for flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
kushaldas committed Aug 7, 2019
1 parent 74c2d71 commit 0e920a0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions admin/securedrop_admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ def sdconfig(args):
SiteConfig(args).load_and_update_config()
return 0


def generate_new_v3_keys():
"""This function generate new keys and returns them as tuple.
Expand All @@ -559,14 +560,15 @@ def generate_new_v3_keys():
format=serialization.PrivateFormat.Raw,
encryption_algorithm=serialization.NoEncryption())
public_key = private_key.public_key()
public_bytes = public_key.public_bytes(
encoding=serialization.Encoding.Raw ,
public_bytes = public_key.public_bytes(
encoding=serialization.Encoding.Raw,
format=serialization.PublicFormat.Raw)

public = base64.b32encode(public_bytes)[:-4].decode("utf-8")
private = base64.b32encode(private_bytes)[:-4].decode("utf-8")
return public, private


def get_v3_keys(filepath):
"""
Returns the stored v3 public and private keys as Tuple.
Expand All @@ -578,6 +580,7 @@ def get_v3_keys(filepath):

return data


def find_or_generate_new_torv3_keys(args):
"""
This method will either read the old keys or generate a new
Expand All @@ -594,8 +597,10 @@ def find_or_generate_new_torv3_keys(args):
# For mon ssh service
mon_ssh_key, mon_ssh_private_key = generate_new_v3_keys()
data = {"public_key": public_key, "private_key": private_key,
"app_ssh_key": app_ssh_key, "app_ssh_private_key": app_ssh_private_key,
"mon_ssh_key": mon_ssh_key, "mon_ssh_private_key": mon_ssh_private_key,}
"app_ssh_key": app_ssh_key,
"app_ssh_private_key": app_ssh_private_key,
"mon_ssh_key": mon_ssh_key,
"mon_ssh_private_key": mon_ssh_private_key}
with open(secret_key_path, 'w') as fobj:
json.dump(data, fobj)

Expand Down

0 comments on commit 0e920a0

Please sign in to comment.