commit 718e15d39335ebed558d04738d1a00e7d48f3a6d Author: Isis Lovecruft isis@torproject.org Date: Thu Nov 28 12:35:18 2013 +0000
Update Sphinx theme and add todo directives. --- doc/sphinx/source/bridgedb.rst | 3 -- doc/sphinx/source/conf.py | 90 +++++++++++++++++----------------- doc/sphinx/source/index.rst | 2 + lib/bridgedb/__init__.py | 3 +- scripts/gen_bridge_descriptors | 106 +++++++++++++++++++--------------------- 5 files changed, 100 insertions(+), 104 deletions(-)
diff --git a/doc/sphinx/source/bridgedb.rst b/doc/sphinx/source/bridgedb.rst index acd68b7..afb7a0c 100644 --- a/doc/sphinx/source/bridgedb.rst +++ b/doc/sphinx/source/bridgedb.rst @@ -23,6 +23,3 @@ bridgedb bridgedb.Tests bridgedb.Util gen_bridge_descriptors - -.. :ref:`bridgedb.parse <parse-pkg>` -.. :ref:`bridgedb.Storage <Storage>` diff --git a/doc/sphinx/source/conf.py b/doc/sphinx/source/conf.py index ab47a43..eab7673 100644 --- a/doc/sphinx/source/conf.py +++ b/doc/sphinx/source/conf.py @@ -83,25 +83,25 @@ autoclass_content = 'both'
# -- General configuration -----------------------------------------------------
-# If your documentation needs a minimal Sphinx version, state it here. needs_sphinx = '1.1' - -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', - 'sphinx.ext.pngmath', 'sphinx.ext.mathjax', - 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode', + 'sphinxjp.themecore', + 'sphinxarg.ext', + 'sphinxcontrib.fulltoc', + 'sphinxcontrib.zopeext.autointerface', 'apilinks_sphinxext']
+todo_include_todos = True + # Add any paths that contain templates here, relative to this directory. -templates_path = ['.templates'] +templates_path = ['source/.templates']
# The suffix of source filenames. source_suffix = '.rst' @@ -120,15 +120,9 @@ copyright = u'2013, The Tor Project, Inc' # |version| and |release|, also used in various other places throughout the # built documents.
-#import bridgedb -#ver = bridgedb.__version__ if bridgedb.__version__ != "unknown" else '0.0.1' -# The short X.Y version. -#version = ver.split('-', 1)[0] -# The full version, including alpha/beta/rc tags. -#release = ver - -version = '0.0.1' -release = '0.0.1' +from bridgedb import __version__ +version = __version__ +release = __version__
# The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -152,44 +146,56 @@ add_function_parentheses = True
# If true, the current module name will be prepended to all description # unit titles (such as .. function::). -add_module_names = False +add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False
# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'manni' +pygments_style = 'tango'
# A list of ignored prefixes for module index sorting. #modindex_common_prefix = []
+# -- HTML theme options for `basicstrap` style -------------------------------------
-# -- Options for HTML output --------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -#html_theme = 'default' -#html_theme = 'scrolls' -#html_theme = 'traditional' -#html_theme = 'nature' -#html_theme = 'pyramid' -#html_theme = 'agogo' -html_theme = 'haiku' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. +html_theme = 'basicstrap' html_theme_options = { -# 'stickysidebar': 'true', -# 'rightsidebar':'true', - 'nosidebar': 'false', - 'full_logo': 'false', - 'sidebarwidth': '300', + 'lang': 'en', + 'nosidebar': False, + 'rightsidebar': False, + 'sidebar_span': 3, + 'nav_fixed': False, + 'nav_width': '900px', + 'content_fixed': False, + 'content_width': '900px', + 'row_fixed': False, + 'noresponsive': False, + 'googlewebfont': False, + 'googlewebfont_url': None, + 'googlewebfont_style': None, + 'header_inverse': False, + 'relbar_inverse': False, + 'inner_theme': True, + 'inner_theme_name': 'bootswatch-flatly', + 'h1_size': '2.2em', + 'h2_size': '2.0em', + 'h3_size': '1.8em', + 'h4_size': '1.4em', + 'h5_size': '1.2em', + 'h6_size': '1.1em', }
+#----------------------------------------------------------------------------- + # Add any paths that contain custom themes here, relative to this directory. -html_theme_path = ['.static'] +html_theme_path = ['_static'] + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static']
# The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". @@ -207,11 +213,6 @@ html_title = 'BridgeDB Documentation' # pixels large. #html_favicon = None
-# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['.static'] - # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. html_last_updated_fmt = '%d %B %Y' @@ -375,6 +376,5 @@ epub_uid = 'BridgeDB Documentation (ePub)' + 'v' + version # Allow duplicate toc entries. #epub_tocdup = True
- # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/doc/sphinx/source/index.rst b/doc/sphinx/source/index.rst index c7922cb..37963b8 100644 --- a/doc/sphinx/source/index.rst +++ b/doc/sphinx/source/index.rst @@ -13,6 +13,8 @@ Contents:
bridgedb
+.. todolist:: + Indices and tables ==================
diff --git a/lib/bridgedb/__init__.py b/lib/bridgedb/__init__.py index 98f8805..db1d258 100644 --- a/lib/bridgedb/__init__.py +++ b/lib/bridgedb/__init__.py @@ -10,8 +10,9 @@ from ._version import get_versions from ._langs import get_langs
+#__version__ = get_versions()['version'] +#__version_full__ = get_versions()['full'] __version__ = get_versions()['version'] -__version_full__ = get_versions()['full'] __langs__ = get_langs()
del get_versions diff --git a/scripts/gen_bridge_descriptors b/scripts/gen_bridge_descriptors index a0b4085..cfa4a1c 100644 --- a/scripts/gen_bridge_descriptors +++ b/scripts/gen_bridge_descriptors @@ -1,39 +1,30 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# -# gen_bridge_descriptors -# ---------------------- -# XXX describeme -# -# :authors: Matthew Finkel -# Isis Lovecruft isis@torproject.org 0xA3ADB67A2CDB8B35 -# :licence: distributed with BridgeDB, see included LICENSE file -# :copyright: (c) 2013 Matthew Finkel -# (c) 2013 Isis Agora Lovecruft -# (c) 2013 The Tor Project, Inc. -#______________________________________________________________________________ - -"""gen_bridge_descriptors -- Generate fake Tor relay signed descriptors. - -** TODO: ** - -Finish enough CFFI_ bindings for the newer PyNaCl_ (or enough of the -SWIG_ bindings for the older pynacl_) to be able to emulate the following -curvecp_ command (the ``curvecp*`` commands require libchloride_): - - $ curvecpmakekey ntor-key - $ curvecpprintkey ntor-key > ntor-key.hex - $ python -c 'import binascii, sys; \ - key_hex=open('./ntor-key.hex','rb').read();\ - key_b64=binascii.b2a_base64(binascii.unhexlify(key_hex));\ - sys.stdout.write(key_b64);' - - .. _CFFI: https://cffi.readthedocs.org - .. _PyNaCl: https://github.com/seanlynch/pynacl - .. _SWIG: https://github.com/swig/swig - .. _pynacl: https://github.com/seanlynch/pynacl - .. _curvecp: http://curvecp.org/ - .. _libchloride: https://github.com/jedisct1/libchloride + +"""Generate valid and signed descriptors for mocked Tor relays or bridges. + +.. todo:: Finish enough CFFI_ bindings for the newer PyNaCl_ (or enough of the + SWIG_ bindings for the older pynacl_) to be able to emulate the following + curvecp_ command (the ``curvecp*`` commands require libchloride_): + + $ curvecpmakekey ntor-key + $ curvecpprintkey ntor-key > ntor-key.hex + $ python -c 'import binascii, sys; \ + key_hex=open('./ntor-key.hex','rb').read();\ + key_b64=binascii.b2a_base64(binascii.unhexlify(key_hex));\ + sys.stdout.write(key_b64);' + + .. _CFFI: https://cffi.readthedocs.org + .. _PyNaCl: https://github.com/seanlynch/pynacl + .. _SWIG: https://github.com/swig/swig + .. _pynacl: https://github.com/seanlynch/pynacl + .. _curvecp: http://curvecp.org/ + .. _libchloride: https://github.com/jedisct1/libchloride + +.. authors:: Isis Lovecruft isis@torproject.org 0xA3ADB67A2CDB8B35 + Matthew Finkel sysrqb@torproject.org +.. licence:: distributed with BridgeDB, see included LICENSE file +.. copyright:: (c) 2013 Matthew Finkel, Isis Lovecruft, The Tor Project, Inc. """
from __future__ import print_function @@ -666,27 +657,32 @@ def signDescriptorDigest(key, descriptorDigest, digest='sha1'): hexdigest. They both encode the the 'sha1' digest type if you check the `-asnparse` output (instead of `-raw -hexdump`).
- ∃!isisⒶwintermute:(feature/9865 *$<>)~/code/torproject/bridgedb/scripts ∴ openssl rsautl -inkey eiprivkey -verify -in eisig1 -raw -hexdump - 0000 - 00 01 ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0010 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0020 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0030 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0040 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0050 - ff ff ff ff ff ff ff ff-ff ff ff ff 00 30 21 30 .............0!0 - 0060 - 09 06 05 2b 0e 03 02 1a-05 00 04 14 42 25 41 fb ...+........B%A. - 0070 - 82 ef 11 f4 5f 2c 95 53-67 2d bb fe 7f c2 34 7f ...._,.Sg-....4. - ∃!isisⒶwintermute:(feature/9865 *$<>)~/code/torproject/bridgedb/scripts ∴ openssl rsautl -inkey eiprivkey -verify -in eisig2 -raw -hexdump - 0000 - 00 01 ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0010 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0020 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0030 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0040 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0050 - ff ff ff ff ff ff ff ff-ff ff ff ff 00 30 21 30 .............0!0 - 0060 - 09 06 05 2b 0e 03 02 1a-05 00 04 14 44 30 ab 90 ...+........D0.. - 0070 - 93 d1 08 21 df 87 c2 39-2a 04 1c a5 bb 34 44 cd ...!...9*....4D. - - see http://www.emc.com/collateral/white-papers/h11300-pkcs-1v2-2-rsa-cryptograph... - for why this function is totally wrong. + .. command:: openssl rsautl -inkey eiprivkey -verify -in eisig1 -raw -hexdump + | + | 0000 - 00 01 ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ + | 0010 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ + | 0020 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ + | 0030 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ + | 0040 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ + | 0050 - ff ff ff ff ff ff ff ff-ff ff ff ff 00 30 21 30 .............0!0 + | 0060 - 09 06 05 2b 0e 03 02 1a-05 00 04 14 42 25 41 fb ...+........B%A. + | 0070 - 82 ef 11 f4 5f 2c 95 53-67 2d bb fe 7f c2 34 7f ...._,.Sg-....4. + + .. command:: openssl rsautl -inkey eiprivkey -verify -in eisig2 -raw -hexdump + | + | 0000 - 00 01 ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ + | 0010 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ + | 0020 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ + | 0030 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ + | 0040 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ + | 0050 - ff ff ff ff ff ff ff ff-ff ff ff ff 00 30 21 30 .............0!0 + | 0060 - 09 06 05 2b 0e 03 02 1a-05 00 04 14 44 30 ab 90 ...+........D0.. + | 0070 - 93 d1 08 21 df 87 c2 39-2a 04 1c a5 bb 34 44 cd ...!...9*....4D. + + .. todo:: See the RSA PKCS_ Standard v2.2 for why this function is totally + wrong. + + .. _PKCS: http://www.emc.com/collateral/white-papers/h11300-pkcs-1v2-2-rsa-cryptograph...
:type key: :class:`OpenSSL.crypto.PKey` :param key: An RSA private key.