-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switched exam result auditing encryption to NaCl
- Loading branch information
1 parent
2444119
commit 7096c12
Showing
7 changed files
with
131 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""Command to generate a NaCl private and public key""" | ||
|
||
from django.core.management.base import BaseCommand | ||
|
||
from nacl.public import PrivateKey | ||
from nacl.encoding import Base64Encoder | ||
|
||
|
||
class Command(BaseCommand): | ||
"""Creates a NaCl private and public key""" | ||
help = 'Creates a NaCl private and public key' | ||
|
||
def handle(self, *args, **options): | ||
"""Handle the command""" | ||
private_key = PrivateKey.generate() | ||
public_key = private_key.public_key | ||
|
||
self.stdout.write('--------------------------------------------------------------') | ||
self.stdout.write('Private Key Base64 Encoded:') | ||
self.stdout.write(Base64Encoder.encode(bytes(private_key)).decode("utf-8")) | ||
self.stdout.write('--------------------------------------------------------------') | ||
self.stdout.write('Public Key Base64 Encoded:') | ||
self.stdout.write(Base64Encoder.encode(bytes(public_key)).decode("utf-8")) | ||
self.stdout.write('--------------------------------------------------------------') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.