Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add several helpers for creating certificates #1368

Merged
merged 4 commits into from
Jul 28, 2023

Conversation

bitkeeper
Copy link
Contributor

To encourage the use of certifactes, it should be easy to create certificates from within your opc-asyncio applications.

The PR adds several helpers for creating certificates, that follow the guidelines from OPC 10000-4 6.1 / OPC 10000-6 6.2.2 for ApplicationInstanceCertificate, for the following tasks:

  • create private keys
  • create self signed certficates
  • create certifcate signing requests
  • create ca for signing csr

The helpers are:

  • generate_private_key
  • generate_app_certificate_signing_request
  • generate_self_signed_app_certificate
  • sign_certificate_request

Test and example are included.

* create private keys
* create self signed certficates
* create certifcate signing requests
* create ca for signing csr

The helpers are:
* generate_private_key
* generate_app_certificate_signing_request
* generate_self_signed_app_certificate
* sign_certificate_request

Test and example are available.
@schroeder-
Copy link
Contributor

Good job! Had prepared the same functions, but didn't find the time to finishe the task. Also a good idea would be to https://github.com/FreeOpcUa/opcua-asyncio/blob/master/examples/generate_certificate.sh change to a python script using these functions? Maybe add the code to same exmaples, where you check if the certificates exists and if not create a new certificate?

@bitkeeper
Copy link
Contributor Author

@schroeder- yes replacing the script would be nice.

This PR is part of a set of security related PRs:

Those where all required for creating a proto of a GDS push/pull client.

@bitkeeper bitkeeper force-pushed the features/generate_certificates branch from 2ffc244 to 119d6d7 Compare July 19, 2023 13:11
@oroulet
Copy link
Member

oroulet commented Jul 24, 2023

should some of these methods be exposed/installed as command line?

@bitkeeper
Copy link
Contributor Author

bitkeeper commented Jul 25, 2023 via email

@oroulet oroulet merged commit 8c360d5 into FreeOpcUa:master Jul 28, 2023
bitkeeper added a commit to bitkeeper/opcua-asyncio that referenced this pull request Aug 8, 2023
With PR FreeOpcUa#1368 some functions are added to create and request certificates.
Based on those functions a new helper method `setup_self_signed_certificate` is created.
This should make it easy to add basic support to clients and servers for generating automatically certificates.

If can generated a private key and self-signed certificate when not already present.
When the data range of the certificate is no longer valid it generates a new certificate.

Both the examples for client and server use with encryption are updated to demonstrate the use.
bitkeeper added a commit to bitkeeper/opcua-asyncio that referenced this pull request Aug 8, 2023
With PR FreeOpcUa#1368 some functions are added to create and request certificates.
Based on those functions a new helper method `setup_self_signed_certificate` is created.
This should make it easy to add basic support to clients and servers for generating automatically certificates.

If can generated a private key and self-signed certificate when not already present.
When the data range of the certificate is no longer valid it generates a new certificate.

Both the examples for client and server use with encryption are updated to demonstrate the use.
oroulet pushed a commit that referenced this pull request Aug 9, 2023
With PR #1368 some functions are added to create and request certificates.
Based on those functions a new helper method `setup_self_signed_certificate` is created.
This should make it easy to add basic support to clients and servers for generating automatically certificates.

If can generated a private key and self-signed certificate when not already present.
When the data range of the certificate is no longer valid it generates a new certificate.

Both the examples for client and server use with encryption are updated to demonstrate the use.
Dimfred pushed a commit to Dimfred/opcua-asyncio that referenced this pull request Sep 19, 2023
With PR FreeOpcUa#1368 some functions are added to create and request certificates.
Based on those functions a new helper method `setup_self_signed_certificate` is created.
This should make it easy to add basic support to clients and servers for generating automatically certificates.

If can generated a private key and self-signed certificate when not already present.
When the data range of the certificate is no longer valid it generates a new certificate.

Both the examples for client and server use with encryption are updated to demonstrate the use.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants