MobileID-Strong-Authentication / mobileid-client-java

MobileID client reference implementation in Java
Apache License 2.0
2 stars 4 forks source link

Signature response validation #1

Closed phaupt closed 2 years ago

phaupt commented 2 years ago

To improve security, the received Mobile ID signature response shall be validated.

  1. Validate if the received certificate (with the public key) inside the signature response data is trustworthy, which means the cert chain must have an anchor certificate that matches one of the root certificates in the local truststore file. This step ensures that the public key was not replaced by a MITM-attack. However, please do NOT implement the revocation, because in the context of Mobile ID we never revoke any end user certificates.
  2. Verfiy the digital signature (which requires the public key of the end user certificate). This step ensures that the signature was done by the correct user/private-key and not by anyone else.
  3. Verify if the signed data (which is the dtbd/dtbs message) inside the digital signature actually matches the dtbd message that was sent in the request.

The truststore.jks example should contain only the root certificates:

bmocanu commented 2 years ago

I implemented support for signature validation for the 4 discussed aspects:

I updated the documentation to provide details on this new feature. I also updated the CLI mode to provide the "-validate" parameter to make the client validate the signature after acquisition.

This new feature is now available in v1.5.0 of the Mobile ID client, here on GitHub release section as well as on Maven Central.

phaupt commented 2 years ago

Awesome work, thank you @bmocanu