From 28a837ada74ae6103dd8a8f38346581b88a71319 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Sat, 17 Oct 2015 12:04:39 +0000 Subject: [PATCH] Use PEM for Account.id generation (fixes #1012). This is a breaking change, already existing /etc/letsencrypt/accounts will cause the client raise errors.AccountStorageError ("Account ids mismatch ..."). Simple fix: start over by `rm -rf /etc/letsencrypt`. In a long run it's a better solution that bumping to `cryptography>=0.9`... --- letsencrypt/account.py | 2 +- letsencrypt/tests/account_test.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/letsencrypt/account.py b/letsencrypt/account.py index 81d31b831..c41b10c4a 100644 --- a/letsencrypt/account.py +++ b/letsencrypt/account.py @@ -56,7 +56,7 @@ class Account(object): # pylint: disable=too-few-public-methods self.id = hashlib.md5( self.key.key.public_key().public_bytes( - encoding=serialization.Encoding.DER, + encoding=serialization.Encoding.PEM, format=serialization.PublicFormat.SubjectPublicKeyInfo) ).hexdigest() # Implementation note: Email? Multiple accounts can have the diff --git a/letsencrypt/tests/account_test.py b/letsencrypt/tests/account_test.py index 4e2fdb122..9452a74f3 100644 --- a/letsencrypt/tests/account_test.py +++ b/letsencrypt/tests/account_test.py @@ -45,16 +45,16 @@ class AccountTest(unittest.TestCase): def test_id(self): self.assertEqual( - self.acc.id, "2ba35a3bdf380ed76a5ac9e740568395") + self.acc.id, "bca5889f66457d5b62fbba7b25f9ab6f") def test_slug(self): self.assertEqual( - self.acc.slug, "test.letsencrypt.org@2015-07-04T14:04:10Z (2ba3)") + self.acc.slug, "test.letsencrypt.org@2015-07-04T14:04:10Z (bca5)") def test_repr(self): self.assertEqual( repr(self.acc), - "") + "") class ReportNewAccountTest(unittest.TestCase):