eclipse-hono / hono

Eclipse Hono™ Project
https://eclipse.dev/hono
Eclipse Public License 2.0
453 stars 137 forks source link

Enable OCSP revocation check for trusted CA #3593

Closed kyberpunk closed 8 months ago

kyberpunk commented 11 months ago

Hello, based on issue #3588 I implemented OCSP revocation check support when using trusted CAs for device authentication in tenant.

PR contains following functionality:

To reconsider:

I'm looking forward to your feedback what would you change. Once you confirm that code changes are ok, I will can also extend tests and documentation. Currently the changes were tested just manually.

closes #3588

kyberpunk commented 10 months ago

@sophokles73 I was also thinking about integration tests - we are using OpenSSL OCSP server functionality for testing, so I can imagine using Testcontainers to setup OCSP responder for JUnit tests. Do you think it is good idea to do it this way?

kyberpunk commented 10 months ago

Hi @sophokles73 , I've incorporated your remarks and implemented comprehensive unit and integration tests. Can you please check it?

There is currently just one remaining issue related to the decision of using just subject and public key for trust anchor. OCSP request defines issuerNameHash which is created from DER encoding of CA issuer name. We are storing subject just as string and by TrustAnchor it is interpreted internally as X500 name with UTF8String type, but in original certificate it can be (and usually is) PrintableString type. This leads to inconsistent hashes with original certificate. This can lead to incompatibility with some responders (e.g. OpenSSL implementation does not work properly).

Can I add new field in TrustedCertificateAuthority for storing also the binary form of subject (similarly as pub key)? This would ensure correct compatibility according to specification.

sophokles73 commented 10 months ago

I hope to find the time to look into this more deeply next week. Sorry for the delay ...

kyberpunk commented 10 months ago

I've implemented also storing of DER encoded subject DN as mentioned, so now OCSP should work properly in most scenarios.

kyberpunk commented 10 months ago

Hi @sophokles73 , did you please have a chance to check it?

sophokles73 commented 10 months ago

not yet, sorry for the delay

kyberpunk commented 8 months ago

@sophokles73 I described the OCSP revocation check experimental feature in the documentation as you requested on open call.