[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Encrypted introduction-points test data



commit 70591e63fc7773db42d457b4e97d37236791d323
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Feb 28 15:10:07 2015 -0800

    Encrypted introduction-points test data
    
    Including examples of hidden service descriptors with encrypted
    introduction-points fields from #15004. We don't yet have support for
    decrypting the fields, but at least we can assert that we raise the expected
    exception when it's encrypted.
---
 .../unit/descriptor/data/hidden_service_basic_auth |   67 ++++++++++++++
 .../descriptor/data/hidden_service_stealth_auth    |   60 +++++++++++++
 test/unit/descriptor/hidden_service_descriptor.py  |   94 +++++++++++++++++++-
 3 files changed, 219 insertions(+), 2 deletions(-)

diff --git a/test/unit/descriptor/data/hidden_service_basic_auth b/test/unit/descriptor/data/hidden_service_basic_auth
new file mode 100644
index 0000000..d93c42a
--- /dev/null
+++ b/test/unit/descriptor/data/hidden_service_basic_auth
@@ -0,0 +1,67 @@
+@type hidden-service-descriptor 1.0
+rendezvous-service-descriptor yfmvdrkdbyquyqk5vygyeylgj2qmrvrd
+version 2
+permanent-key
+-----BEGIN RSA PUBLIC KEY-----
+MIGJAoGBANHC3bZRrlFFlSu22u18wBG57JpvIhglJE+u0ctMwTnw6iyJJqqxgU6U
+R1gnXJlorQYDC5eHoM8nbBJu7LvUjYnqINz+En+FlpZhT+eqLk0v83IB4r0Fd6Bg
+ypYLygEXUfh0bwHwYfF4mkvl6YOB6I6G5jHC46I3LH15qrdHW40FAgMBAAE=
+-----END RSA PUBLIC KEY-----
+secret-id-part fluw7z3s5cghuuirq3imh5jjj5ljips6
+publication-time 2015-02-24 20:00:00
+protocol-versions 2,3
+introduction-points
+-----BEGIN MESSAGE-----
+AQEAi3xIJz0Qv97ug9kr4U0UNN2kQhkddPHuj4op3cw+fgMLqzPlFBPAJgaEKc+g
+8xBTRKUlvfkXxocfV75GyQGi2Vqu5iN1SbI5Uliu3n8IiUina5+WaOfUs9iuHJIK
+c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5JZ8H1lTE56ujgTBpArXMPYpKri4a0lG+8QnYK
+D6jOJIli5QtVQxES4X64NDwducoGHnquMZs3ScvJQPSOuTvuqaad4FrTCZGbv6Ic
+emUAHDsxjffMQ9IJYulluCTVWgS/AiBk31yiUB0GsAqZYcWz5kKgTpOXBQhulACM
+waokEqbyH2Vtvc1peiPi+Vh6EhTSiDoEVZ2w9GrOnjgpyK6zxzH0aIhJJxlQu8it
+w+xj/3+79Bf8myVesgzCWvXbkmvc6jJaoHGopV8lTM2JUn4xYCSz71Bt4wQBKZX4
+hFXDlDZaY1k/QRP/zTfQ8pjbcohDgUVW8eftJz3ND5Iy8D3nRF9/BQB3PWox4vyQ
+Fj94Eoe8NmEArIKWjUoSkn+EDgNcdHGBIaQ5is0N8r9n4E2cgMj57i4Fm37k8c6+
+hlilrggVJ8qTBGs57M0ldqRLwt1bM6SkU//oMGel7Ft3EDd98W/6RXRkmAbsLhRx
+7VMb4WCUBrIZLxo1/StwHa13RyTHAt0GKPu549l3oTZezsSad8vlurbnIbxtK9Cl
+hp6mYPd3Djoe5OaLe8Gnu23ko+S2+kfHIjOwkza9R5w6AzLjkjYS3C8oRwuxKOft
+lj/7xMZWDrfyw5H86L0QiaZnkmD+nig1+S+Rn39mmuEgl2iwZO/ihlncUJQTEULb
+7IHpmofr+5ya5xWeo/BFQhulTNr2fJN0bPkVGfp+
+-----END MESSAGE-----
+signature
+-----BEGIN SIGNATURE-----
+mhGQNtyvf5QqeFrn1SNzdp8wN5bhEH5gxZhST5t4pFxxNCv3//ZgaQ83kIzcwex9
+xzgGREFHpTrqVPXXs8nZZgMpmnhWuloAyT1c3HSCvjnbWXX9Y82wPbVV5OYx1CYb
+jLides7vbdQuS0UwEkcGMl62Ripwi0pkesgw9ZvJy+k=
+-----END SIGNATURE-----
diff --git a/test/unit/descriptor/data/hidden_service_stealth_auth b/test/unit/descriptor/data/hidden_service_stealth_auth
new file mode 100644
index 0000000..df25c83
--- /dev/null
+++ b/test/unit/descriptor/data/hidden_service_stealth_auth
@@ -0,0 +1,60 @@
+@type hidden-service-descriptor 1.0
+rendezvous-service-descriptor ubf3xeibzlfil6s4larq6y5peup2z3oj
+version 2
+permanent-key
+-----BEGIN RSA PUBLIC KEY-----
+MIGJAoGBAL1f7GdEObH+xMhf4GsaTCtfVH7ZpanegC65jn0/Kz9wlkpF+SQdIvTu
+Ha2iZB34GDT2PvTy98chSxz+E3Kv2h45pQWbrwLN3Fj4qa+klclIXWcIa7GT4Pct
+YZzAvHIh9t9EAe6ejYu8I+h4yL6QNAA2bYOi1d66+qCNCAFBgAqpAgMBAAE=
+-----END RSA PUBLIC KEY-----
+secret-id-part jczvydhzetbpdiylj3d5nsnjvaigs7xm
+publication-time 2015-02-24 20:00:00
+protocol-versions 2,3
+introduction-points
+-----BEGIN MESSAGE-----
+AgEdbps604RR6lqeyoZBzOb6+HvlL2cDt63w8vBtyRaLirq5ZD5GDnr+R0ePj71C
+nC7qmRWuwBmzSdSd0lOTaSApBvIifbJksHUeT/rq03dpnnRHdHSVqSvig6bukcWJ
+LgJmrRd3ES13LXVHenD3C6AZMHuL9TG+MjLO2PIHu0mFO18aAHVnWY32Dmt144IY
+c2eTVZbsKobjjwCYvDf0PBZI+B6H0PZWkDX/ykYjArpLDwydeZyp+Zwj4+k0+nRr
+RPlzbHYoBY9pFYDUXDXWdL+vTsgFTG0EngLGlgUWSY5U1T1Db5HfOqc7hbqklgs/
+ULG8NUY1k41Wb+dleJI28/+ZOM9zOpHcegNx4Cn8UGbw/Yv3Tj+yki+TMeOtJyhK
+PQP8NWq8zThiVhBrfpmVjMYkNeVNyVNoxRwS6rxCQjoLWSJit2Mpf57zY1AOvT1S
+EqqFbsX+slD2Uk67imALh4pMtjX29VLIujpum3drLhoTHDszBRhIH61A2eAZqdJy
+7JkJd1x/8x7U0l8xNWhnj/bhUHdt3OrCvlN+n8x6BwmMNoLF8JIsskTuGHOaAKSQ
+WK3z0rHjgIrEjkQeuQtfmptiIgRB9LnNr+YahRnRR6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IXleEseI=
+-----END SIGNATURE-----
diff --git a/test/unit/descriptor/hidden_service_descriptor.py b/test/unit/descriptor/hidden_service_descriptor.py
index 3b9c652..ef8ad43 100644
--- a/test/unit/descriptor/hidden_service_descriptor.py
+++ b/test/unit/descriptor/hidden_service_descriptor.py
@@ -7,11 +7,15 @@ import unittest
 
 import stem.descriptor
 
-from stem.descriptor.hidden_service_descriptor import REQUIRED_FIELDS, HiddenServiceDescriptor
-
 from test.mocking import CRYPTO_BLOB, get_hidden_service_descriptor
 from test.unit.descriptor import get_resource
 
+from stem.descriptor.hidden_service_descriptor import (
+  REQUIRED_FIELDS,
+  DecryptionFailure,
+  HiddenServiceDescriptor,
+)
+
 MESSAGE_BLOCK = """
 -----BEGIN MESSAGE-----
 %s
@@ -175,6 +179,57 @@ fepXdvN/Jl5qQKHIBb602kuOTl0pN8Q+YeFUSIIDcmPBLpBDhH3PvrQMcGVaiOWH
 -----END RSA PUBLIC KEY-----\
 """
 
+EXPECTED_BASIC_AUTH_INTRODUCTION_POINTS_ENCODED = """\
+-----BEGIN MESSAGE-----
+AQEAi3xIJz0Qv97ug9kr4U0UNN2kQhkddPHuj4op3cw+fgMLqzPlFBPAJgaEKc+g
+8xBTRKUlvfkXxocfV75GyQGi2Vqu5iN1SbI5Uliu3n8IiUina5+WaOfUs9iuHJIK
+cErgfT0bUfXKDLvW6/ncsgPdb6kb+jjT8NVhR4ZrRUf9ASfcY/f2WFNTmLgOR3Oa
+f2tMLJcAck9VbCDjKfSC6e6HgtxRFe9dX513mDviZp15UAHkjJSKxKvqRRVkL+7W
+KxJGfLY56ypZa4+afBYT/yqLzY4C47/g5TTTx9fvsdp0uQ0AmjF4LeXdZ58yNjrp
+Da63SrgQQM7lZ3k4LGXzDS20FKW2/9rpWgD78QLJGeKdHngD3ERvTX4m43rtEFrD
+oB/4l2nl6fh0507ASYHy7QQQMcdjpN0OWQQKpL9SskZ8aQw1dY4KU28Gooe9ff+B
+RGm6BlVzMi+HGcqfMpGwFfY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QB3PWox4vyQ
+Fj94Eoe8NmEArIKWjUoSkn+EDgNcdHGBIaQ5is0N8r9n4E2cgMj57i4Fm37k8c6+
+hlilrggVJ8qTBGs57M0ldqRLwt1bM6SkU//oMGel7Ft3EDd98W/6RXRkmAbsLhRx
+7VMb4WCUBrIZLxo1/StwHa13RyTHAt0GKPu549l3oTZezsSad8vlurbnIbxtK9Cl
+hp6mYPd3Djoe5OaLe8Gnu23ko+S2+kfHIjOwkza9R5w6AzLjkjYS3C8oRwuxKOft
+lj/7xMZWDrfyw5H86L0QiaZnkmD+nig1+S+Rn39mmuEgl2iwZO/ihlncUJQTEULb
+7IHpmofr+5ya5xWeo/BFQhulTNr2fJN0bPkVGfp+
+-----END MESSAGE-----\
+"""
+
 
 class TestHiddenServiceDescriptor(unittest.TestCase):
   def test_for_duckduckgo_with_validation(self):
@@ -209,6 +264,41 @@ class TestHiddenServiceDescriptor(unittest.TestCase):
     self.assertEqual(datetime.datetime(2014, 10, 31, 23, 0, 0), desc.published)
     self.assertEqual([2, 3], desc.protocol_versions)
 
+  def test_with_basic_auth(self):
+    """
+    Parse a descriptor with introduction-points encrypted with basic auth.
+    """
+
+    descriptor_file = open(get_resource('hidden_service_basic_auth'), 'rb')
+
+    desc = next(stem.descriptor.parse_file(descriptor_file, 'hidden-service-descriptor 1.0', validate = True))
+    self.assertEqual('yfmvdrkdbyquyqk5vygyeylgj2qmrvrd', desc.descriptor_id)
+    self.assertEqual(2, desc.version)
+    self.assertEqual('fluw7z3s5cghuuirq3imh5jjj5ljips6', desc.secret_id_part)
+    self.assertEqual(datetime.datetime(2015, 2, 24, 20, 0, 0), desc.published)
+    self.assertEqual([2, 3], desc.protocol_versions)
+    self.assertEqual(EXPECTED_BASIC_AUTH_INTRODUCTION_POINTS_ENCODED, desc.introduction_points_encoded)
+    self.assertEqual([], desc.introduction_points_auth)
+
+    self.assertRaises(DecryptionFailure, desc.introduction_points)
+
+  def test_with_stealth_auth(self):
+    """
+    Parse a descriptor with introduction-points encrypted with stealth auth.
+    """
+
+    descriptor_file = open(get_resource('hidden_service_stealth_auth'), 'rb')
+
+    desc = next(stem.descriptor.parse_file(descriptor_file, 'hidden-service-descriptor 1.0', validate = True))
+    self.assertEqual('ubf3xeibzlfil6s4larq6y5peup2z3oj', desc.descriptor_id)
+    self.assertEqual(2, desc.version)
+    self.assertEqual('jczvydhzetbpdiylj3d5nsnjvaigs7xm', desc.secret_id_part)
+    self.assertEqual(datetime.datetime(2015, 2, 24, 20, 0, 0), desc.published)
+    self.assertEqual([2, 3], desc.protocol_versions)
+    self.assertEqual([], desc.introduction_points_auth)
+
+    self.assertRaises(DecryptionFailure, desc.introduction_points)
+
   def _assert_matches_duckduckgo(self, desc):
     self.assertEqual('y3olqqblqw2gbh6phimfuiroechjjafa', desc.descriptor_id)
     self.assertEqual(2, desc.version)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits