Skip to content

Commit

Permalink
Doc fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
tsaarni committed May 31, 2023
1 parent d10e951 commit 5b5cbbe
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ from certy import Credential
ca = Credential().subject("CN=ca")
ca.write_certificates_as_pem("ca.pem")

cred = Credential().subject("CN=server").issuer(ca).subject_alt_names("DNS:app.127.0.0.1.nip.io")
cred = Credential().subject("CN=server").issuer(ca)
cred.write_certificates_as_pem("cert.pem")
cred.write_private_key_as_pem("key.pem")
```

## Documentation

The latest documentation is available [here](https://tsaarni.github.io/python-certy/).
Expand Down
8 changes: 4 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ Following example creates a CA certificate, a server certificate signed by the C
.. literalinclude:: ../examples/write-ca-and-server-cert.py
:linenos:

Given defaults are OK for typical use, which makes simple use very simple:
Given defaults are typically OK, which makes simple use very simple:

* CA certificate will automatically include basic constrains extension with CA field set. It is recognized as CA, because ``ca.issuer()`` was not called.
* Server certificate is recognized as end-entity certificate, since it was signed by the CA - ``server.issuer(ca)`` was called.
* Server certificate is recognized as end-entity certificate, since it is signed by the CA - ``server.issuer(ca)`` was called.
* Key usage is set according to the certificate type: CA certificates are allowed to sign other certificates, end-entity certificates are allowed to be used for TLS server and client authentication.
* The ``validFrom`` and ``validTo`` fields are set to current time and one year in the future, respectively.
* ``EC`` key type of 256 bits is used.
Expand Down Expand Up @@ -58,8 +58,8 @@ API Reference
:undoc-members:


Bugs reports, feature requests and other contributions
======================================================
Contact information
===================

Please use the `github`_ project for reporting bugs, requesting features and submitting pull requests.

Expand Down
2 changes: 1 addition & 1 deletion examples/https-server-and-client.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def serve_https(server_cert_path, server_key_path, client_root_ca_path):
)

# Create a client certificate, issued by the server root CA.
client_cred = Credential().subject("CN=joe").issuer(client_root_ca_cred)
client_cred = Credential().subject("CN=client").issuer(client_root_ca_cred)

# Write the certificates and keys to disk.
server_root_ca_cred.write_certificates_as_pem("server-root-ca.pem")
Expand Down
4 changes: 3 additions & 1 deletion src/certy/credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class KeyType(Enum):
"""Key types are used with :meth:`Credential.key_type` to specify the type of key to generate."""

EC = 1
"""Elliptic curve key (default)."""
RSA = 2
"""RSA key."""


class KeyUsage(Enum):
Expand Down Expand Up @@ -255,7 +257,7 @@ def key_usages(self, *key_usages: KeyUsage) -> Credential:
"""Set the key usages of this credential.
If not called, the key usages :const:`KeyUsage.DIGITAL_SIGNATURE` and :const:`KeyUsage.KEY_ENCIPHERMENT` are set
to end-entity certificates (:meth:`ca` is not :const:`False`), and :const:`KeyUsage.KEY_CERT_SIGN` and
to end-entity certificates (:meth:`ca` is :const:`False`), and :const:`KeyUsage.KEY_CERT_SIGN` and
:const:`KeyUsage.CRL_SIGN` are set to CA certificates (:meth:`ca` is :const:`True`).
:param key_usages: The key usages of this credential. One or more of :const:`KeyUsage`.
Expand Down

0 comments on commit 5b5cbbe

Please sign in to comment.