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

[tcat][tcat_ble_client] Add TCAT Commissioner / Device certs for Thread certification testing #10211

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

EskoDijk
Copy link
Contributor

@EskoDijk EskoDijk commented May 7, 2024

Also with the BBTC Commissioner tool, adds scripts for example certificate generation; documentation updated to reflect this.
In [tcat_ble_client] it removse hostname use in BBTC - use of hostnames is not specified for TCAT.
In [src/tcat] it fixes Thread-specific X509v3 extension parsing; unit test extended for this.

The purpose of this change is to allow use of the BBTC client directly in TCAT cert testing. This requires X509 certificate identities that are based on the Thread Group internal test CA. The included private keys can be exposed - all for testing purposes.

The present generated certificates still use SKI/AKI extensions - this may be removed possibly later on in another PR, if analysis shows that these are not needed/required for TCAT use cases.

This PR partly addresses the issue #10196 - it at least prints a warning message when the TCAT Commissioner cert had an error in processing, and it attempts to close the TLS connection. (To be verified later on if the closing actually works in the sense that the Commissioner receives the TLS alert / close-notify.) This avoids at least that during manual testing the connection looks "ok" but was silently rejected by the TCAT Device.

No CLANG/"Pretty" has been applied yet to the new code.

… with Thread cert testing; added scripts for example certificate generation; README files updated.

[tcat_ble_client] remove hostname use in BBTC - use of hostnames is not specified for TCAT.
[src/tcat] fixes in Thread-specific X509v3 extension parsing; unit test extended for this.
@EskoDijk
Copy link
Contributor Author

EskoDijk commented May 7, 2024

FYI @canisLupus1313 with this PR, I can run TCAT in simulation using the Thread certs as defined by the test plan.

Copy link

size-report bot commented May 7, 2024

Size Report of OpenThread

Merging #10211 into main(edad0f9).

name branch text data bss total
ot-cli-ftd main 466672 856 66332 533860
#10211 466672 856 66332 533860
+/- 0 0 0 0
ot-ncp-ftd main 435524 760 61544 497828
#10211 435524 760 61544 497828
+/- 0 0 0 0
libopenthread-ftd.a main 235851 95 40278 276224
#10211 235863 95 40278 276236
+/- +12 0 0 +12
libopenthread-cli-ftd.a main 57589 0 8075 65664
#10211 57589 0 8075 65664
+/- 0 0 0 0
libopenthread-ncp-ftd.a main 31863 0 5916 37779
#10211 31863 0 5916 37779
+/- 0 0 0 0
ot-cli-mtd main 364496 760 51204 416460
#10211 364496 760 51204 416460
+/- 0 0 0 0
ot-ncp-mtd main 346980 760 46432 394172
#10211 346980 760 46432 394172
+/- 0 0 0 0
libopenthread-mtd.a main 157888 0 25166 183054
#10211 157900 0 25166 183066
+/- +12 0 0 +12
libopenthread-cli-mtd.a main 39812 0 8059 47871
#10211 39812 0 8059 47871
+/- 0 0 0 0
libopenthread-ncp-mtd.a main 24743 0 5916 30659
#10211 24743 0 5916 30659
+/- 0 0 0 0
ot-cli-ftd-br main 549792 864 131172 681828
#10211 549792 864 131172 681828
+/- 0 0 0 0
libopenthread-ftd-br.a main 323602 100 105094 428796
#10211 323614 100 105094 428808
+/- +12 0 0 +12
libopenthread-cli-ftd-br.a main 71450 0 8099 79549
#10211 71450 0 8099 79549
+/- 0 0 0 0
ot-rcp main 62280 564 20604 83448
#10211 62280 564 20604 83448
+/- 0 0 0 0
libopenthread-rcp.a main 9542 0 5052 14594
#10211 9542 0 5052 14594
+/- 0 0 0 0
libopenthread-radio.a main 19040 0 214 19254
#10211 19040 0 214 19254
+/- 0 0 0 0

@canisLupus1313
Copy link
Contributor

@EskoDijk Overall looks good.

Copy link
Member

@abtink abtink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.
Some smaller style suggestions below.

src/core/radio/ble_secure.cpp Outdated Show resolved Hide resolved
src/core/radio/ble_secure.cpp Outdated Show resolved Hide resolved
tests/unit/test_tcat.cpp Outdated Show resolved Hide resolved
tests/unit/test_tcat.cpp Outdated Show resolved Hide resolved
@EskoDijk
Copy link
Contributor Author

@abtink @canisLupus1313 Thanks! I've updated with your suggestions and applied make-pretty.

…disconnect TLV upon exit of commissioner per spec.
)
logger.info(f"Certificates and key loaded from '{args.cert_path}'")

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (certificate)
as clear text.
for cert in cc:
logger.info(f' cert info:\n{cert.get_info()}')
peer_cert_der_hex = utils.base64_string(cert.public_bytes(_ssl.ENCODING_DER))
logger.info(f' base64: (paste in https://lapo.it/asn1js/ to decode)\n{peer_cert_der_hex}')

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (certificate)
as clear text.
logger.info(f' cert info:\n{cert.get_info()}')
peer_cert_der_hex = utils.base64_string(cert.public_bytes(_ssl.ENCODING_DER))
logger.info(f' base64: (paste in https://lapo.it/asn1js/ to decode)\n{peer_cert_der_hex}')
logger.info(f'TCAT Commissioner cert, PEM:\n{self.cert}')

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (certificate)
as clear text.
This expression logs
sensitive data (certificate)
as clear text.
This expression logs
sensitive data (certificate)
as clear text.
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.

None yet

3 participants