Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Removing credentialSubject.id causes null credentialSubject #128

Closed
yamdan opened this issue May 21, 2021 · 0 comments · Fixed by #129
Closed

Removing credentialSubject.id causes null credentialSubject #128

yamdan opened this issue May 21, 2021 · 0 comments · Fixed by #129

Comments

@yamdan
Copy link
Contributor

yamdan commented May 21, 2021

Impressed with your demo and sessions in IIW32, I tried to use this to implement a kind of anonymous credentials, where derived proof does not contain explicit correlating factors such as credential id & holder's id.

So first I prepared the following VC without credential id (id) nor holder's id (credentialSubject.id):

{
    "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://w3id.org/citizenship/v1",
        "https://w3id.org/security/v3-unstable"
    ],
    "type": [
        "VerifiableCredential",
        "PermanentResidentCard"
    ],
    "issuer": "did:example:489398593",
    "identifier": "83627465",
    "name": "Permanent Resident Card",
    "description": "Government of Example Permanent Resident Card.",
    "issuanceDate": "2019-12-03T12:19:52Z",
    "expirationDate": "2029-12-03T12:19:52Z",
    "credentialSubject": {
        "type": [
            "PermanentResident",
            "Person"
        ],
        "givenName": "JOHN",
        "familyName": "SMITH",
        "gender": "Male",
        "image": "data:image/png;base64,iVBORw0KGgokJggg==",
        "residentSince": "2015-01-01",
        "lprCategory": "C09",
        "lprNumber": "999-999-999",
        "commuterClassification": "C1",
        "birthCountry": "Bahamas",
        "birthDate": "1958-07-17"
    },
    "proof": {
        "type": "BbsBlsSignature2020",
        "created": "2021-05-20T10:47:06Z",
        "proofPurpose": "assertionMethod",
        "proofValue": "uDZeTO5az28aSmHa6jZHassZ/Vl7MlIUSG72kAOcaiUqLZ0AZEGNBpbZOGm3RG6SA4pBgFhImka1gBmqrq3BiKTfpgayF9paPZdWywFpZ55OuKOnaa5h2yTKzV/uWTE1IXmtxn78lmt5pGIu1QxAqQ==",
        "verificationMethod": "did:example:489398593#test"
    }
}

Then prepared the following JSON-LD frame to hide the other correlating factors, i.e., identifier, issuanceDate, expirationDate, and all the attributes except for commuterClassification from the above VC. (I chose commuterClassification just as an example of less-correlating factors)

{
    "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://w3id.org/citizenship/v1",
        "https://w3id.org/security/v3-unstable"
    ],
    "type": [
        "VerifiableCredential",
        "PermanentResidentCard"
    ],
    "@explicit": true,
    "issuer": {},
    "name": {},
    "description": {},
    "credentialSubject": {
        "type": [
            "PermanentResident",
            "Person"
        ],
        "@explicit": true,
        "commuterClassification": {}
    }
}

That would give rise to the following anonymous proof only showing that the prover (holder) is classified as C1 according to the government (issuer).

{
    "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://w3id.org/citizenship/v1",
        "https://w3id.org/security/v3-unstable"
    ],
    "id": "urn:bnid:_:c14n0",
    "type": [
        "PermanentResidentCard",
        "VerifiableCredential"
    ],
    "description": "Government of Example Permanent Resident Card.",
    "name": "Permanent Resident Card",
    "credentialSubject": {
        "id": "urn:bnid:_:c14n1",
        "type": [
            "Person",
            "PermanentResident"
        ],
        "commuterClassification": "C1"
    },
    "issuer": "did:example:489398593",
    "proof": {
        "type": "BbsBlsSignatureProof2020",
        "created": "2021-05-20T10:47:06Z",
        "nonce": "08RvG0XlkxzTEHOAlVA/n3+X+EwHjMpwrYz3n3uFxO08DUbIOB/wG9JThCFhWNbIhwk=",
        "proofPurpose": "assertionMethod",
        "proofValue": "ABkALBPfoOgWKdyTzL7AKEcgXDuM++AQph0Xsk/EIf3LBYoNFeopQhM/m10okCoMPJwENm3hrKe6Ch+bRRiNSFLGmY9CU5CYLkV0YqZuX4JS3ejnI0iyOdYodcwGZzN6TWJw4z0qiFabXGHXd1l1bSDN9klPheJSsVbbBxMUFPMk5LAF5G7ENdYRmSN/bTVufsilCzudAAAAdIsnE4A2rBf0n8NraMb516NFVVnu7Nj1RQdynvgWJcYQEt8fNuhAkEW0+gCbGXmXWAAAAAJBmlfIJpP0CYvf5FCaxR4lgz/vURlIdPKunpas1FXZnwRCuB3EvLewbQrDGTI/vFCBcq9kIffBadcdPCvpu5Lnl85kTuPtKMr+hC7gBd27rmBd36xrzFka+vyclN1h0IgCINpgh17/JnjuaayOgCVWAAAADm/tGDRgaoyFBdOVIncjyaObn8LMwUgScMETJfpgklsgJdOOzbi/NAxEAT0EsEN4dn3+IsgKPCxo7keJcp72FvI3nCM8fiCKtr4TCV142Grhr7DogNB3ewrkF+fjaEq9jGZw9K4CukFhHJaVxjFXfCfbBY5vA0mpPOH7n5DVNxu3MWLs1h6u+pi/jXf1v24a3tJyRlR+UdKAFmvGKd67tWVDZSNkZwITTdryvvNDH8WhJFmqkDEBXfq7E3MGatZWGylgzBYeQ600/GmjPSAYyIk6DGBXh2D0P16DUhAcIqMtA1lyRe47CaWTxhUGj7qZ/Jg3kPvJ+S9Onr2ADybw2sQ1hY0bRM5EAGCi2Vlnl7a42VXc7LWNds6RjZ3+7HSEXQuA59Sw6DbpYpFy5+4gLbUoAYInFTcyDnGZ89rOqpDFLwsNAdXncacfhRzIHL3qhLVMl/d1GQHg+pPkmEADLPJKyAETS0KhaaEX1cxc6rN9fFEjRsQZpuLn0XiKVyHOTzQ0frxBI/GsiSJ9J/jj2jaB72CG/dVj2KkX4enns+DJA9G1lMVtupZRq6EBpQUiW4uSc67eG+c33Oj2Q0tCceQ=",
        "verificationMethod": "did:example:489398593#test"
    }
}

However, what I actually got is null credentialSubject as follows. The case might be the same as the ones mentioned in issue #121 and w3c/vc-di-bbs#45.

{
    "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://w3id.org/citizenship/v1",
        "https://w3id.org/security/v3-unstable"
    ],
    "id": "urn:bnid:_:c14n0",
    "type": [
        "PermanentResidentCard",
        "VerifiableCredential"
    ],
    "description": "Government of Example Permanent Resident Card.",
    "name": "Permanent Resident Card",
    "credentialSubject": null, // <-- unexpected
    "issuer": "did:example:489398593",
    "proof": {
        "type": "BbsBlsSignatureProof2020",
        "created": "2021-05-20T10:47:06Z",
        "nonce": "08RvG0XlkxzTEHOAlVA/n3+X+EwHjMpwrYz3n3uFxO08DUbIOB/wG9JThCFhWNbIhwk=",
        "proofPurpose": "assertionMethod",
        "proofValue": "ABkALBPfoOgWKdyTzL7AKEcgXDuM++AQph0Xsk/EIf3LBYoNFeopQhM/m10okCoMPJwENm3hrKe6Ch+bRRiNSFLGmY9CU5CYLkV0YqZuX4JS3ejnI0iyOdYodcwGZzN6TWJw4z0qiFabXGHXd1l1bSDN9klPheJSsVbbBxMUFPMk5LAF5G7ENdYRmSN/bTVufsilCzudAAAAdIsnE4A2rBf0n8NraMb516NFVVnu7Nj1RQdynvgWJcYQEt8fNuhAkEW0+gCbGXmXWAAAAAJBmlfIJpP0CYvf5FCaxR4lgz/vURlIdPKunpas1FXZnwRCuB3EvLewbQrDGTI/vFCBcq9kIffBadcdPCvpu5Lnl85kTuPtKMr+hC7gBd27rmBd36xrzFka+vyclN1h0IgCINpgh17/JnjuaayOgCVWAAAADm/tGDRgaoyFBdOVIncjyaObn8LMwUgScMETJfpgklsgJdOOzbi/NAxEAT0EsEN4dn3+IsgKPCxo7keJcp72FvI3nCM8fiCKtr4TCV142Grhr7DogNB3ewrkF+fjaEq9jGZw9K4CukFhHJaVxjFXfCfbBY5vA0mpPOH7n5DVNxu3MWLs1h6u+pi/jXf1v24a3tJyRlR+UdKAFmvGKd67tWVDZSNkZwITTdryvvNDH8WhJFmqkDEBXfq7E3MGatZWGylgzBYeQ600/GmjPSAYyIk6DGBXh2D0P16DUhAcIqMtA1lyRe47CaWTxhUGj7qZ/Jg3kPvJ+S9Onr2ADybw2sQ1hY0bRM5EAGCi2Vlnl7a42VXc7LWNds6RjZ3+7HSEXQuA59Sw6DbpYpFy5+4gLbUoAYInFTcyDnGZ89rOqpDFLwsNAdXncacfhRzIHL3qhLVMl/d1GQHg+pPkmEADLPJKyAETS0KhaaEX1cxc6rN9fFEjRsQZpuLn0XiKVyHOTzQ0frxBI/GsiSJ9J/jj2jaB72CG/dVj2KkX4enns+DJA9G1lMVtupZRq6EBpQUiW4uSc67eG+c33Oj2Q0tCceQ=",
        "verificationMethod": "did:example:489398593#test"
    }
}

I wrote a small patch in order to get my expected result (derived proof with credentialSubject) by modifying the way of converting blank node ids inside and now preparing it as PR. Hope this would help.

(I know the above example is an extreme case and not necessarily a practical one. I just wanted to evaluate the privacy-preserving ability of JSON-LD ZKP with BBS+ as an enabler of anonymous credential)

yamdan added a commit to zkp-ld/jsonld-signatures-bbs that referenced this issue May 21, 2021
This fix improves the way of converting blank node ids before signing and verification, just using regexp-based string replacement. It enables us to make `credentialSubject.id` to be blank node identifier, which would be useful in privacy-preserving applications of BBS+.

fixes mattrglobal#128
tplooker pushed a commit that referenced this issue May 22, 2021
This fix improves the way of converting blank node ids before signing and verification, just using regexp-based string replacement. It enables us to make `credentialSubject.id` to be blank node identifier, which would be useful in privacy-preserving applications of BBS+.

fixes #128
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant