-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from rmlibre/develop
v0.5.7 update - instance-isolated identities This update adds automatic enforcement of instance identities, preventing one instance from using the gpg-agent cache to access secret keys which aren't associated to that instance's key. This check is enforced by the ``passphrase`` attribute. If a user creates instance identities with the same passphrase, then this check can be side-stepped.
- Loading branch information
Showing
7 changed files
with
165 additions
and
13 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
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
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
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 |
---|---|---|
|
@@ -252,6 +252,57 @@ def test_export_import(gpg): | |
"""Successfully blocked non-boolean""" | ||
|
||
|
||
def test_isolated_identities(gpg): | ||
anon = GnuPG("anon_user", "[email protected]", "rubbish_pw") | ||
anon.gen_key() | ||
anon_uid = anon.fingerprint | ||
### decrypting | ||
enc_msg = gpg.encrypt("hi!", anon_uid) | ||
msg = anon.decrypt(enc_msg) | ||
try: | ||
failed = False | ||
gpg.decrypt(enc_msg) | ||
except LookupError: | ||
failed = True | ||
""" | ||
Same user succefully prevented from decrypting message sent to a | ||
different identity. | ||
""" | ||
finally: | ||
assert failed | ||
### signatures | ||
sig_0 = anon.sign("message", local_user=anon_uid) | ||
sig_1 = anon.sign("message") | ||
try: | ||
failed = False | ||
gpg.sign("message", local_user=anon_uid) | ||
except PermissionError: | ||
failed = True | ||
""" | ||
Same user successfully prevented from signing message with the | ||
secret key associated with another identity. | ||
""" | ||
finally: | ||
assert failed | ||
### encrypting | ||
try: | ||
failed = False | ||
gpg.encrypt("greetings", anon_uid, local_user=anon_uid) | ||
except PermissionError: | ||
failed = True | ||
""" | ||
Same user successfully prevented from signing an encrypted message | ||
with the secret key associated with another identity. | ||
""" | ||
finally: | ||
assert failed | ||
while True: | ||
try: | ||
anon.delete(anon.email) | ||
except: | ||
break | ||
|
||
|
||
def test_cipher(gpg): | ||
test_email = "[email protected]" | ||
run(gpg.network_import(test_email)) | ||
|
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
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 |
---|---|---|
|
@@ -8,6 +8,6 @@ | |
# All rights reserved. | ||
# | ||
|
||
__version__ = "0.5.6" | ||
__version__ = "0.5.7" | ||
|
||
from .tiny_gnupg import GnuPG, run, __all__ |
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