Skip to content

Commit

Permalink
Add explicit test for CRLF in private key loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
dzoep committed Aug 21, 2024
1 parent 79aebb2 commit d408274
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_c4gh.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
b"-----END ENCRYPTED PRIVATE KEY-----"


alice_sec_bstr_dos = \
b"-----BEGIN ENCRYPTED PRIVATE KEY-----\r\n" \
b"YzRnaC12MQAGYmNyeXB0ABQAAABk8Kn90WJVzJBevxN4980aWwARY2hhY2hhMjBfcG9seTEzMDUAPBdXfpV1zOcMg5EJRlGNpKZXT4PXM2iraMGCyomRQqWaH5iBGmJXU/JROPsyoX5nqmNo8oxANvgDi1hqZQ==\r\n" \
b"-----END ENCRYPTED PRIVATE KEY-----"


alice_sec_password = "alice"


Expand All @@ -29,6 +35,9 @@ def test_public_loader(self):
def test_secret_loader(self):
akey = C4GHKey.from_bytes(alice_sec_bstr, lambda: alice_sec_password)

def test_secret_loader_dos(self):
akey = C4GHKey.from_bytes(alice_sec_bstr_dos, lambda: alice_sec_password)


if __name__ == '__main__':
unittest.main()

0 comments on commit d408274

Please sign in to comment.