Skip to content

publicJwk Properties Lost During KeyPair Activation #774

@u-veys

Description

@u-veys

Bug Report

Describe the Bug

When creating and activating a keypair, some properties of the publicKeyJwk are lost/not stored

Expected Behavior

The publicKeyJwk of the DidDocument is the same as the publicKeyJwk when creating the KeyPair.

Observed Behavior

The KeyPair is stored properly, but the DidDocument is missing some properties.
Example:
A GET to /keypairs gives the correct KeyPair, A GET to /dids does not

Steps to Reproduce

Steps to reproduce the behavior:

  1. Add KeyPair with properties besides n and e
  2. Activate the keypair
  3. get the diddocument of the IH
  4. publicjwk is missing some properties

Context Information

Add any other context about the problem here.

  • Used version EDC 0.12.0

Detailed Description

When creating a KeyPair with the following example body:

{
  "active": true,
  "keyId": "...",
  "privateKeyAlias": "...",
  "publicKeyJwk": {
    "kty": "RSA",
    "n": "...",
    "e": "...",
    "x5u": "...",
    "alg": "..."
  }
}

The publicKeyJwk in the verificationMethod of the DidDocument no longer has the properties x5u and alg. The DidDocument has the following publicKeyJwk:

"publicKeyJwk": 
{
    "kty": "RSA",
    "e": "...",
    "use": "sig",
    "n": "..."
}

Looking at the code and postgres, the KeyPair is properly stored. But it seems like when activating the KeyPair, some properties are lost and not stored in the 'did_resources' relation.

Is this expected, e.g., to remove "unnecessary" or "not wanted" properties from the KeyPair?

Possible Implementation

Looking at the DidDocumentServiceImpl, the serialized jwk is parsed to a parser, the JwkParser, where the toJavaKeys Method is called from the nimbus library. While the serialized jwk still has all properties, the keys in the list are missing some. As far as I understood the nimbus function, all properties except e and n are ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug_reportSuspected bugs, awaiting triage

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions