[tor-commits] [stem/master] Shorten certificate type enumerations

atagar at torproject.org atagar at torproject.org
Sun Oct 6 02:07:34 UTC 2019


commit c90f397d6da23b15fc5896f83f5237e4517d7e2a
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Sep 22 12:44:16 2019 -0700

    Shorten certificate type enumerations
    
    Possible step back on my part, but we're attempting to keep enumeration names
    as short as possible (since stem users need to type these). Just minor tweaks.
---
 stem/descriptor/certificate.py | 37 +++++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/stem/descriptor/certificate.py b/stem/descriptor/certificate.py
index cdde0c24..5895790f 100644
--- a/stem/descriptor/certificate.py
+++ b/stem/descriptor/certificate.py
@@ -26,16 +26,21 @@ used to validate the key used to sign server descriptors.
   Purpose of Ed25519 certificate. As new certificate versions are added this
   enumeration will expand.
 
-  ==============                     ===========
-  CertType                           Description
-  ==============                     ===========
-  **SIGNING**                        signing a signing key with an identity key
-  **LINK_CERT**                      TLS link certificate signed with ed25519 signing key
-  **AUTH**                           authentication key signed with ed25519 signing key
-  **HS_V3_DESC_SIGNING_KEY**         onion service v3 descriptor signing key cert (see rend-spec-v3.txt)
-  **HS_V3_INTRO_POINT_AUTH_KEY**     onion service v3 intro point authentication key cert (see rend-spec-v3.txt)
-  **HS_V3_INTRO_POINT_ENC_KEY**      onion service v3 intro point encryption key cert (see rend-spec-v3.txt)
-  ==============                     ===========
+  For more information see...
+
+    * `cert-spec.txt <https://gitweb.torproject.org/torspec.git/tree/cert-spec.txt>`_ section A.1
+    * `rend-spec-v3.txt <https://gitweb.torproject.org/torspec.git/tree/rend-spec-v3.txt>`_ appendix E
+
+  ========================  ===========
+  CertType                  Description
+  ========================  ===========
+  **SIGNING**               signing key with an identity key
+  **LINK_CERT**             TLS link certificate signed with ed25519 signing key
+  **AUTH**                  authentication key signed with ed25519 signing key
+  **HS_V3_DESC_SIGNING**    hidden service v3 short-term descriptor signing key
+  **HS_V3_INTRO_AUTH**      hidden service v3 introductory point authentication key
+  **HS_V3_INTRO_ENCRYPT**   hidden service v3 introductory point encryption key
+  ========================  ===========
 
 .. data:: ExtensionType (enum)
 
@@ -77,9 +82,9 @@ CertType = stem.util.enum.UppercaseEnum(
   'SIGNING',
   'LINK_CERT',
   'AUTH',
-  'HS_V3_DESC_SIGNING_KEY',
-  'HS_V3_INTRO_POINT_AUTH_KEY',
-  'HS_V3_INTRO_POINT_ENC_KEY',
+  'HS_V3_DESC_SIGNING',
+  'HS_V3_INTRO_AUTH',
+  'HS_V3_INTRO_ENCRYPT',
 )
 
 ExtensionType = stem.util.enum.Enum(('HAS_SIGNING_KEY', 4),)
@@ -171,11 +176,11 @@ class Ed25519CertificateV1(Ed25519Certificate):
       raise ValueError('Ed25519 certificate cannot have a type of 7. This is reserved for RSA identity cross-certification.')
     elif cert_type == 8:
       # see rend-spec-v3.txt appendix E for these defintions
-      self.type = CertType.HS_V3_DESC_SIGNING_KEY
+      self.type = CertType.HS_V3_DESC_SIGNING
     elif cert_type == 9:
-      self.type = CertType.HS_V3_INTRO_POINT_AUTH_KEY
+      self.type = CertType.HS_V3_INTRO_AUTH
     elif cert_type == 0x0B:
-      self.type = CertType.HS_V3_INTRO_POINT_ENC_KEY
+      self.type = CertType.HS_V3_INTRO_ENCRYPT
     else:
       raise ValueError('Ed25519 certificate type %i is unrecognized' % cert_type)
 





More information about the tor-commits mailing list