Skip to content

Commit

Permalink
Fix some documentation typos
Browse files Browse the repository at this point in the history
  • Loading branch information
daBrado authored and simo5 committed Jul 24, 2020
1 parent 544cdf2 commit 3e191d7
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 37 deletions.
14 changes: 7 additions & 7 deletions README.md
Expand Up @@ -4,13 +4,13 @@ JWCrypto
========

An implementation of the JOSE Working Group documents:
RFC 7515 - JSON Web Signature (JWS)
RFC 7516 - JSON Web Encryption (JWE)
RFC 7517 - JSON Web Key (JWK)
RFC 7518 - JSON Web Algorithms (JWA)
RFC 7519 - JSON Web Token (JWT)
RFC 7520 - Examples of Protecting Content Using JSON Object Signing and
Encryption (JOSE)
- RFC 7515 - JSON Web Signature (JWS)
- RFC 7516 - JSON Web Encryption (JWE)
- RFC 7517 - JSON Web Key (JWK)
- RFC 7518 - JSON Web Algorithms (JWA)
- RFC 7519 - JSON Web Token (JWT)
- RFC 7520 - Examples of Protecting Content Using JSON Object Signing and
Encryption (JOSE)

Documentation
=============
Expand Down
4 changes: 2 additions & 2 deletions docs/source/jwk.rst
Expand Up @@ -69,10 +69,10 @@ Export the key with::
>>> key.export()
'{"k":"X6TBlwY2so8EwKZ2TFXM7XHSgWBKQJhcspzYydp5Y-o","kty":"oct"}'

Create a 2048bit RSA keypair::
Create a 2048bit RSA key pair::
>>> jwk.JWK.generate(kty='RSA', size=2048)

Create a P-256 EC keypair and export the public key::
Create a P-256 EC key pair and export the public key::
>>> key = jwk.JWK.generate(kty='EC', crv='P-256')
>>> key.export(private_key=False)
'{"y":"VYlYwBfOTIICojCPfdUjnmkpN-g-lzZKxzjAoFmDRm8",
Expand Down
2 changes: 1 addition & 1 deletion docs/source/jwt.rst
Expand Up @@ -3,7 +3,7 @@ JSON Web Token (JWT)

The jwt Module implements the `JSON Web Token`_ standard.
A JSON Web Token is represented by a JWT object, related utility classes and
functions are availbale in this module too.
functions are available in this module too.

.. _JSON Web Token: http://tools.ietf.org/html/rfc7519

Expand Down
4 changes: 2 additions & 2 deletions jwcrypto/common.py
Expand Up @@ -91,7 +91,7 @@ class InvalidJWEKeyType(JWException):
"""Invalid JWE Key Type.
This exception is raised when the provided JWK Key does not match
the type required by the sepcified algorithm.
the type required by the specified algorithm.
"""

def __init__(self, expected, obtained):
Expand All @@ -103,7 +103,7 @@ class InvalidJWEKeyLength(JWException):
"""Invalid JWE Key Length.
This exception is raised when the provided JWK Key does not match
the length required by the sepcified algorithm.
the length required by the specified algorithm.
"""

def __init__(self, expected, obtained):
Expand Down
6 changes: 3 additions & 3 deletions jwcrypto/jwe.py
Expand Up @@ -284,13 +284,13 @@ def serialize(self, compact=False):
"is set" % invalid)
if 'protected' not in self.objects:
raise InvalidJWEOperation(
"Can't use compat encoding without protected headers")
"Can't use compact encoding without protected headers")
else:
ph = json_decode(self.objects['protected'])
for required in 'alg', 'enc':
if required not in ph:
raise InvalidJWEOperation(
"Can't use compat encoding, '%s' must be in the "
"Can't use compact encoding, '%s' must be in the "
"protected header" % required)
if 'recipients' in self.objects:
if len(self.objects['recipients']) != 1:
Expand Down Expand Up @@ -438,7 +438,7 @@ def deserialize(self, raw_jwe, key=None):
If a key is provided a decryption step will be attempted after
the object is successfully deserialized.
:raises InvalidJWEData: if the raw object is an invaid JWE token.
:raises InvalidJWEData: if the raw object is an invalid JWE token.
:raises InvalidJWEOperation: if the decryption fails.
"""

Expand Down
26 changes: 13 additions & 13 deletions jwcrypto/jwk.py
Expand Up @@ -148,7 +148,7 @@ class ParmType(Enum):
'x5t#S256': JWKParameter('X.509 Certificate SHA-256 Thumbprint',
True, None, None)
}
"""Regstry of valid key parameters"""
"""Registry of valid key parameters"""

# RFC 7518 - 7.6 , RFC 8037 - 5
# secp256k1 - https://tools.ietf.org/html/draft-ietf-cose-webauthn-algorithms
Expand Down Expand Up @@ -281,7 +281,7 @@ def __init__(self, **kwargs):
always be provided and its value must be a valid one as defined
by the 'IANA JSON Web Key Types registry' and specified in the
:data:`JWKTypesRegistry` variable. The valid key parameters per
key type are defined in the :data:`JWKValuesregistry` variable.
key type are defined in the :data:`JWKValuesRegistry` variable.
To generate a new random key call the class method generate() with
the appropriate 'kty' parameter, and other parameters as needed (key
Expand All @@ -296,7 +296,7 @@ def __init__(self, **kwargs):
Deprecated:
Alternatively if the 'generate' parameter is provided, with a
valid key type as value then a new key will be generated according
to the defaults or provided key strenght options (type specific).
to the defaults or provided key strength options (type specific).
:raises InvalidJWKType: if the key type is invalid
:raises InvalidJWKValue: if incorrect or inconsistent parameters
Expand Down Expand Up @@ -579,7 +579,7 @@ def from_json(cls, key):
def export(self, private_key=True, as_dict=False):
"""Exports the key in the standard JSON format.
Exports the key regardless of type, if private_key is False
and the key is_symmetric an exceptionis raised.
and the key is_symmetric an exception is raised.
:param private_key(bool): Whether to export the private key.
Defaults to True.
Expand Down Expand Up @@ -786,12 +786,12 @@ def _get_private_key(self, arg=None):
raise NotImplementedError

def get_op_key(self, operation=None, arg=None):
"""Get the key object associated to the requested opration.
"""Get the key object associated to the requested operation.
For example the public RSA key for the 'verify' operation or
the private EC key for the 'decrypt' operation.
:param operation: The requested operation.
The valid set of operations is availble in the
The valid set of operations is available in the
:data:`JWKOperationsRegistry` registry.
:param arg: an optional, context specific, argument
For example a curve name.
Expand Down Expand Up @@ -955,7 +955,7 @@ def add(self, elem):
class JWKSet(dict):
"""A set of JWK objects.
Inherits from the standard 'dict' bultin type.
Inherits from the standard 'dict' builtin type.
Creates a special key 'keys' that is of a type derived from 'set'
The 'keys' attribute accepts only :class:`jwcrypto.jwk.JWK` elements.
"""
Expand Down Expand Up @@ -984,12 +984,12 @@ def add(self, elem):
self['keys'].add(elem)

def export(self, private_keys=True, as_dict=False):
"""Exports a RFC 7517 keyset.
"""Exports a RFC 7517 key set.
Exports as json by default, or as dict if requested.
:param private_key(bool): Whether to export private keys.
Defaults to True.
:param as_dict(bool): Whether to retun a dict instead of
:param as_dict(bool): Whether to return a dict instead of
a JSON object
"""
exp_dict = dict()
Expand All @@ -1005,9 +1005,9 @@ def export(self, private_keys=True, as_dict=False):
return json_encode(exp_dict)

def import_keyset(self, keyset):
"""Imports a RFC 7517 keyset using the standard JSON format.
"""Imports a RFC 7517 key set using the standard JSON format.
:param keyset: The RFC 7517 representation of a JOSE Keyset.
:param keyset: The RFC 7517 representation of a JOSE key set.
"""
try:
jwkset = json_decode(keyset)
Expand All @@ -1026,9 +1026,9 @@ def import_keyset(self, keyset):

@classmethod
def from_json(cls, keyset):
"""Creates a RFC 7517 keyset from the standard JSON format.
"""Creates a RFC 7517 key set from the standard JSON format.
:param keyset: The RFC 7517 representation of a JOSE Keyset.
:param keyset: The RFC 7517 representation of a JOSE key set.
"""
obj = cls()
obj.import_keyset(keyset)
Expand Down
6 changes: 3 additions & 3 deletions jwcrypto/jws.py
Expand Up @@ -326,7 +326,7 @@ def verify(self, key, alg=None):
except Exception as e: # pylint: disable=broad-except
self.verifylog.append('Failed: [%s]' % repr(e))
else:
raise InvalidJWSSignature('No signatures availble')
raise InvalidJWSSignature('No signatures available')

if not self.is_valid:
raise InvalidJWSSignature('Verification failed for all '
Expand Down Expand Up @@ -373,7 +373,7 @@ def deserialize(self, raw_jws, key=None, alg=None):
:param alg: The signing algorithm (optional). usually the algorithm
is known as it is provided with the JOSE Headers of the token.
:raises InvalidJWSObject: if the raw object is an invaid JWS token.
:raises InvalidJWSObject: if the raw object is an invalid JWS token.
:raises InvalidJWSSignature: if the verification fails.
"""
self.objects = dict()
Expand Down Expand Up @@ -518,7 +518,7 @@ def serialize(self, compact=False):
representation, otherwise generates a standard JSON format.
:raises InvalidJWSOperation: if the object cannot serialized
with the compact representation and `compat` is True.
with the compact representation and `compact` is True.
:raises InvalidJWSSignature: if no signature has been added
to the object, or no valid signature can be found.
"""
Expand Down
10 changes: 5 additions & 5 deletions jwcrypto/jwt.py
Expand Up @@ -162,7 +162,7 @@ def __init__(self, header=None, claims=None, jwt=None, key=None,
the token. A (:class:`jwcrypto.jwk.JWKSet`) can also be used.
:param algs: An optional list of allowed algorithms
:param default_claims: An optional dict with default values for
registred claims. A None value for NumericDate type claims
registered claims. A None value for NumericDate type claims
will cause generation according to system time. Only the values
from RFC 7519 - 4.1 are evaluated.
:param check_claims: An optional dict of claims that must be
Expand All @@ -171,7 +171,7 @@ def __init__(self, header=None, claims=None, jwt=None, key=None,
Note: either the header,claims or jwt,key parameters should be
provided as a deserialization operation (which occurs if the jwt
is provided will wipe any header os claim provided by setting
is provided) will wipe any header or claim provided by setting
those obtained from the deserialization of the jwt token.
Note: if check_claims is not provided the 'exp' and 'nbf' claims
Expand Down Expand Up @@ -418,7 +418,7 @@ def make_signed_token(self, key):
Creates a JWS token with the header as the JWS protected header and
the claims as the payload. See (:class:`jwcrypto.jws.JWS`) for
details on the exceptions that may be reaised.
details on the exceptions that may be raised.
:param key: A (:class:`jwcrypto.jwk.JWK`) key.
"""
Expand All @@ -434,7 +434,7 @@ def make_encrypted_token(self, key):
Creates a JWE token with the header as the JWE protected header and
the claims as the plaintext. See (:class:`jwcrypto.jwe.JWE`) for
details on the exceptions that may be reaised.
details on the exceptions that may be raised.
:param key: A (:class:`jwcrypto.jwk.JWK`) key.
"""
Expand Down Expand Up @@ -513,7 +513,7 @@ def serialize(self, compact=True):
Note: the compact parameter is provided for general compatibility
with the serialize() functions of :class:`jwcrypto.jws.JWS` and
:class:`jwcrypto.jwe.JWE` so that these objects can all be used
interchangeably. However the only valid JWT representtion is the
interchangeably. However the only valid JWT representation is the
compact representation.
"""
return self.token.serialize(compact)
2 changes: 1 addition & 1 deletion jwcrypto/tests.py
Expand Up @@ -400,7 +400,7 @@ def test_jwkset(self):
ks3 = jwk.JWKSet.from_json(ks.export())
self.assertEqual(len(ks), len(ks3))

# Test Keyset with mutiple keys
# Test key set with mutiple keys
ksm = jwk.JWKSet.from_json(json_encode(PrivateKeys))
num = 0
for item in ksm:
Expand Down

0 comments on commit 3e191d7

Please sign in to comment.