updates docs

pull/1/head v3.14.0-1
Moisés Guimarães 2018-03-19 22:07:53 +01:00
parent 9e087d578b
commit 07b547b80c
5 changed files with 27 additions and 21 deletions

View File

@ -49,6 +49,7 @@ clean-test: ## remove test and coverage artifacts
lint: ## check style with flake8
flake8 src tests
pylint src tests/*
test: install ## run tests quickly with the default Python
py.test tests

View File

@ -20,8 +20,7 @@ RSA
:members:
:inherited-members:
Example
~~~~~~~
**Example:**
>>> from wolfcrypt.ciphers import RsaPrivate, RsaPublic
>>> from wolfcrypt.utils import h2b

View File

@ -7,17 +7,25 @@ Symmetric Key Algorithms
cryptographic key** for both encryption and decryption of data.
This operation is also known as **Symmetric Key Encryption**.
``wolfcrypt`` provides access to the following **Symmetric Key Ciphers**:
Symmetric Key Encryption Classes
--------------------------------
Interface
~~~~~~~~~
All **Symmetric Key Ciphers** available in this module implements the following
interface:
.. autoclass:: _Cipher
:members:
AES
---
~~~
.. autoclass:: Aes
:members:
:inherited-members:
Example
~~~~~~~
**Example:**
.. doctest::
@ -31,14 +39,12 @@ Example
b'now is the time '
Triple DES
----------
~~~~~~~~~~
.. autoclass:: Des3
:members:
:inherited-members:
Example
~~~~~~~
**Example:**
.. doctest::

View File

@ -67,7 +67,7 @@ class _Cipher(object):
raise ValueError("key must be %s in length, not %d" %
(self._key_sizes, len(key)))
elif not key: # pragma: no cover
raise ValueError("key must not be 0 in length")
raise ValueError("key must not be 0 in length")
if IV is not None and len(IV) != self.block_size:
raise ValueError("IV must be %d in length, not %d" %
@ -101,10 +101,10 @@ class _Cipher(object):
"""
Encrypts a non-empty string, using the key-dependent data in
the object, and with the appropriate feedback mode.
The string's length must be an exact multiple of the algorithm's
block size or, in CFB mode, of the segment size.
Returns a string containing the ciphertext.
"""
string = t2b(string)
@ -130,10 +130,10 @@ class _Cipher(object):
"""
Decrypts **string**, using the key-dependent data in the
object and with the appropriate feedback mode.
The string's length must be an exact multiple of the algorithm's
block size or, in CFB mode, of the segment size.
Returns a string containing the plaintext.
"""
string = t2b(string)
@ -436,7 +436,7 @@ class EccPublic(_Ecc):
ret = _lib.wc_ecc_export_x963(self.native_object, x963, x963_size)
if ret != 0: # pragma: no cover
raise WolfCryptError("x963 export error (%d)" % ret)
raise WolfCryptError("x963 export error (%d)" % ret)
return _ffi.buffer(x963, x963_size[0])[:]

View File

@ -308,7 +308,7 @@ def test_ecc_make_shared_secret():
b_pub = EccPublic()
b_pub.import_x963(b.export_x963())
assert a.shared_secret(b) == \
b.shared_secret(a) == \
a.shared_secret(b_pub) == \
b.shared_secret(a_pub)
assert a.shared_secret(b) \
== b.shared_secret(a) \
== a.shared_secret(b_pub) \
== b.shared_secret(a_pub)