openid / OpenID4VCI

68 stars 20 forks source link

Support for Hierarchical Deterministic Keys (HDK) #359

Open sander opened 4 months ago

sander commented 4 months ago

Hi OpenID4VCI authors! With a cross-pilot working group we’re specifying Hierarchical Deterministic Keys (HDKs) for the European Digital Identity Wallet. Let’s discuss how we could make HDK work with OpenID4VCI.

An HDK is a key deterministically derived from parent key material, and bound to a wallet secure cryptographic device (WSCD) using key blinding. A wallet instance could derive an HDK either locally, just using a static seed and path, or remotely, additionally using a key handle provided by another component. Remote key derivation is implemented using Asynchronous Remote Key Generation (ARKG). By construction, the wallet instance and optional remote party know that child keys are bound to the same WSCD (if any) as their parent key.

This design should offer several advantages to the ecosystem:

Locally derived keys are opaque to issuers, so can be considered just an optimisation for wallet solution design. Remotely derived keys have some consequences for OpenID4VCI applications:

  1. To request remote key derivation, the client provides an ARKG public seed (pk_kem, pk_bl), where pk_kem is a KEM public key and pk_bl is an asymmetric key blinding public key (the key to derive from).
  2. To respond with remotely derived keys, the issuer associates with each credential an AKRG key handle, which is an opaque byte string. This key handle should not be part of the credential itself, to avoid sharing metadata with relying parties.
  3. A single ARKG public seed may be used to issue many credentials, potentially in several batches. These credentials have the same configuration and dataset, but distinct cryptographic material derived using ARKG. The credentials do not need to be delivered in a particular order.
  4. When ARKG is applied, the credential to be issued does not contain the same public key as the proof of possession, but a key derived from it.
  5. When ARKG is applied, the proof of possession may be implicit. For example, the issuer may have authenticated the user with PID, and remotely derive public keys from the presented PID-bound public key.

As of d5ed198, it looks like OpenID4VCI does not yet fully support these features. As @paulbastian suggested in a recent HDK call, we could define a new proof type.

My first suggestion would be:

What do you think?

jogu commented 4 months ago

Hi @sander

Thanks for working on this! I'm one of the co-chairs of the DCP WG group (the other chairs being Kristina & Torsten).

We don't seem to obviously have a contribution agreement from you or your company - unless you already completed one in the last few days, can you please complete one via the docusign process on https://openid.net/intellectual-property/openid-foundation-contribution-agreements/ ? This is a necessary step for anyone that wants to contribute to an OpenID Foundation specification, so it may be something you want to mention to other members of your working group that might get involved in adding this to the VCI spec.

In principle your proposal seems to make sense (although I am not qualified to comment on any of the cryptographic details).

I suspect a sensible next step might be to try and arrange for some members of your working group to join a DCP WG call and give the working group members a briefing on your specification. The WG call schedule is on https://openid.net/wg/digital-credentials-protocols/ - we have two different time slots (one is "EU friendly", one APAC-ish friendly), we may need to do this in both time slots (or perhaps do it in one and record it). Probably the earliest we could think about doing this is 11th July, and we should avoid week of 22nd July as IETF is that week.)

sander commented 4 months ago

Thanks @jogu! I’ve just signed the contribution agreement. The 11th July EU Call should work for me, I’ll also check with other working group members.

jogu commented 4 months ago

Great, thanks. Just for clarity we'll also need to confirm we have the right people on our side available that day too.

paulbastian commented 4 months ago

Hi @sander , I already opened an Issue for this discussion a week ago here: https://github.com/openid/OpenID4VCI/issues/355 which is kind of adjacent

sander commented 4 months ago

Thanks @paulbastian, this is indeed closely related and should be aligned. Note that with HDK:

sander commented 4 months ago

Great, thanks. Just for clarity we'll also need to confirm we have the right people on our side available that day too.

@jogu should we still meet tomorrow? I could also do next week if it works better.

Sakurann commented 4 months ago

Could we do this discussion after IETF, the week of July 29th? @paulbastian is on vacation next two weeks and I think it would be better to have him on the call.

Also, is there any implementation experience on the approach being proposed in this issue?

c2bo commented 4 months ago

This sounds like John should be there as well imho - If I recall correctly we had some initial discussions in this/a similar direction at an IIW with him?

sander commented 3 months ago

I’ll join the Thu Aug 1 meeting at 17:00 CEST as discussed, hopefully together with some more HDK working group members such as @ve7jtb. For the briefing, I could present an extract of the HDK slide deck, highlighting the points in this issue’s opening post.

The main objectives would be to:

sander commented 3 months ago

To further detail some Q&A from today’s call:

paulbastian commented 3 months ago

Here are some sketches of how these mechanism could be applied to OpenID4VCI:

Given that we only use local derivation, the flow would be:

Benefits:

This could work well with a new proof type and is easy to integrate today:

{
  "credential_identifier": "CivilEngineeringDegree-2023",
  "proofs": {
    "hdkeys": {
       "ite" : "..." //ite attestation with only 1 key + optional proof
       "keys" : [
         {
           "key": "eyJ0eXAiOiJvcGVuaWQ0dmNpL...Lb9zioZoipdP-jvh1WlA",
           "poa": "..."
         },
         {
           "key": "eyJraWQiOiJkaWQ6ZXhhbXBsZ...KPxgihac0aW9EkL1nOzM",
           "poa": "..."
         }
      }
    ]
  }
}
paulbastian commented 3 months ago

Given that we only use remote derivation, the flow would be:

Benefits:

This has some challenges for integration in OpenID4VCI, as we also have to change the Credential Response. Credential Request:

{
  "credential_identifier": "CivilEngineeringDegree-2023",
  "proofs": {
    "hdkeys": {
       "ite" : "..." //ite attestationwith only 1 key + optional proof
       "pk_seed" : "..."
      }
    ]
  }
}

Credential Response proposal 1:

{
  "credentials": [
    "LUpixVCWJk0eOt4CXQe1NXK....WZwmhmn9OQp6YxX0a2L",
    "YXNkZnNhZGZkamZqZGFza23....29tZTIzMjMyMzIzMjMy"
  ],
  "credentials_metadata" :  [
    "...", //keyhandle for credential 1
    "..." //keyhandle for credential 2
  ],
  "c_nonce": "fGFF7UkhLa",
  "c_nonce_expires_in": 86400
}

Credential Response proposal 2:

{
  "credentials": [
    { 
      "credential" : "LUpixVCWJk0eOt4CXQe1NXK....WZwmhmn9OQp6YxX0a2L",
      "metadata" : "..." //keyhandle
    },
    { 
      "credential" : "LUpixVCWJk0eOt4CXQe1NXK....WZwmhmn9OQp6YxX0a2L",
      "metadata" : "..." //keyhandle
    }
  ],
  "c_nonce": "fGFF7UkhLa",
  "c_nonce_expires_in": 86400
}

A third option to be analysed is also to derive new credentials from the public key of an existing, verified credential.

sander commented 1 month ago

Next steps:

  1. Publish stable OID4VCI with sufficient extensibility, prepared in: #391
  2. Request IETF CFRG cryptographic feedback on: draft-dijkhuis-cfrg-hdkeys
  3. Have 2 implementations using a common non-standard OID4VCI extension
  4. Propose to standardise this extension at OID4VCI, based on steps 2 and 3

Do you see this the same way or am I missing steps?

Sakurann commented 3 weeks ago

how much is this addressed by #389 ?

paulbastian commented 3 weeks ago

As @sander said, #391 laid the foundation for this and #389 may also be used to leverage. The next task is to create a new proof_type and incorporate ideas from NL team.