Use autodoc for NetscapeSPKI
This uncovered an issue in the documentation. Issue filed:
Refs #124.
diff --git a/OpenSSL/crypto.py b/OpenSSL/crypto.py
index 6b92ca5..99b9691 100644
--- a/OpenSSL/crypto.py
+++ b/OpenSSL/crypto.py
@@ -2151,6 +2151,9 @@
class NetscapeSPKI(object):
+ """
+ A Netscape SPKI object.
+ """
def __init__(self):
spki = _lib.NETSCAPE_SPKI_new()
self._spki = _ffi.gc(spki, _lib.NETSCAPE_SPKI_free)
@@ -2158,10 +2161,14 @@
def sign(self, pkey, digest):
"""
- Sign the certificate request using the supplied key and digest
+ Sign the certificate request with this key and digest type.
- :param pkey: The key to sign with
- :param digest: The message digest to use
+ :param pkey: The private key to sign with.
+ :type pkey: :py:class:`PKey`
+
+ :param digest: The message digest to use.
+ :type digest: :py:class:`bytes`
+
:return: :py:const:`None`
"""
if pkey._only_public:
@@ -2182,10 +2189,14 @@
def verify(self, key):
"""
- Verifies a certificate request using the supplied public key
+ Verifies a signature on a certificate request.
- :param key: a public key
- :return: True if the signature is correct.
+ :param key: The public key that signature is supposedly from.
+ :type pkey: :py:class:`PKey`
+
+ :return: :py:const:`True` if the signature is correct.
+ :rtype: :py:class:`bool`
+
:raises Error: If the signature is invalid, or there was a problem
verifying the signature.
"""
@@ -2197,9 +2208,10 @@
def b64_encode(self):
"""
- Generate a base64 encoded string from an SPKI
+ Generate a base64 encoded representation of this SPKI object.
- :return: The base64 encoded string
+ :return: The base64 encoded string.
+ :rtype: :py:class:`bytes`
"""
encoded = _lib.NETSCAPE_SPKI_b64_encode(self._spki)
result = _ffi.string(encoded)
@@ -2209,9 +2221,10 @@
def get_pubkey(self):
"""
- Get the public key of the certificate
+ Get the public key of this certificate.
- :return: The public key
+ :return: The public key.
+ :rtype: :py:class:`PKey`
"""
pkey = PKey.__new__(PKey)
pkey._pkey = _lib.NETSCAPE_SPKI_get_pubkey(self._spki)
@@ -2234,9 +2247,13 @@
if not set_result:
# TODO: This is untested.
_raise_current_error()
+
+
+
NetscapeSPKIType = NetscapeSPKI
+
class _PassphraseHelper(object):
def __init__(self, type, passphrase, more_args=False, truncate=False):
if type != FILETYPE_PEM and passphrase is not None:
diff --git a/doc/api/crypto.rst b/doc/api/crypto.rst
index 949f9b2..b5636a7 100644
--- a/doc/api/crypto.rst
+++ b/doc/api/crypto.rst
@@ -6,15 +6,6 @@
.. py:module:: OpenSSL.crypto
:synopsis: Generic cryptographic module
-.. py:class:: NetscapeSPKI([enc])
-
- A class representing Netscape SPKI objects.
-
- If the *enc* argument is present, it should be a base64-encoded string
- representing a NetscapeSPKI object, as returned by the :py:meth:`b64_encode`
- method.
-
-
.. py:class:: CRL()
A class representing Certifcate Revocation List objects.
@@ -258,30 +249,10 @@
NetscapeSPKI objects
--------------------
-NetscapeSPKI objects have the following methods:
-
-.. py:method:: NetscapeSPKI.b64_encode()
-
- Return a base64-encoded string representation of the object.
-
-.. py:method:: NetscapeSPKI.get_pubkey()
-
- Return the public key of object.
-
-.. py:method:: NetscapeSPKI.set_pubkey(key)
-
- Set the public key of the object to *key*.
-
-.. py:method:: NetscapeSPKI.sign(key, digest_name)
-
- Sign the NetscapeSPKI object using the given *key* and *digest_name*.
- *digest_name* must be a string describing a digest algorithm supported by
- OpenSSL (by EVP_get_digestbyname, specifically). For example,
- :py:const:`"md5"` or :py:const:`"sha1"`.
-
-.. py:method:: NetscapeSPKI.verify(key)
-
- Verify the NetscapeSPKI object using the given *key*.
+.. autoclass:: NetscapeSPKI
+ :members:
+ :special-members:
+ :exclude-members: __weakref__
.. _crl: