-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Base context v1 missing sec:
mapping in RsaSignature2018 "@context"
#778
Comments
Hrm, no, not in the security vocabulary... the bug is in the VC JSON-LD Context -- good catch @kuzdogan! This means that RsaSignature2018 is completely broken in the 2018 Verifiable Credentials context... which tells me that no one is using that particular cryptosuite for VCs. :) I'll note that the Ed25519Signature2018 definition doesn't have the same problem. Changing this would be a substantive change... we will have to note that RsaSignature2018 MUST NOT be used with the 2018 VC suite. We will then have to fix this in the new VC context. @kuzdogan -- how did you find this bug? Did a library throw an error on you? I'm wondering if a signature would still be generated (with a different set of base URLs for where |
@msporny Nope, I found it by chance while I was working on my prototype VC application. Not sure if this is what you mean, but the application generates a VC with
Whereas with the complete context it is:
|
I confirm this bug. Here is a verifiable credential using RsaSignature2018, generated using Spruce's ssi library [Edit: this library will longer generate a verifiable credential like this, as it will detect and error on the unexpected RDF terms per this issue]: {
"@context": [
"https://www.w3.org/2018/credentials/v1"
],
"type": [
"VerifiableCredential"
],
"credentialSubject": {
"id": "urn:uuid:b622372b-98d0-4245-8a9d-466e3ffb3a24"
},
"issuer": "did:web:demo.spruceid.com:2021:05:10:example-rsa",
"issuanceDate": "2021-05-10T17:16:06.902Z",
"proof": {
"type": "RsaSignature2018",
"proofPurpose": "assertionMethod",
"verificationMethod": "did:web:demo.spruceid.com:2021:05:10:example-rsa#key",
"created": "2021-05-10T17:16:06.902Z",
"jws": "eyJhbGciOiJSUzI1NiIsImtpZCI6InJzYTIwNDgtMjAyMC0wOC0yNSIsImNyaXQiOlsiYjY0Il0sImI2NCI6ZmFsc2V9..CQoDN2RkrJt1K6lieVoxe5WFUd4BdbHT9H78dbVa-sNYKhHqXTXm5kFh6c6EYm5pIXM1ttkpgK6B1gmsSluquPm8Jo2NnbiH6YjubEOWAcDryr2pFfr3321w5NZjG-qcpFAWpUyx5hMQyBcZOG0Lob8P6sxULTIO1kxrX0i95snuzRU9KnqbdLfVkgqmiJQc7lSW1WGduQ29y0COrEVw9BoLzrvcGCwCaG1OYtCrOA58TC8yQM1W5Eq8-Ry16cbeUAqJZ8wPO2TTl1GKYiJQyNbuRJjncbCxF4ZvBx1ijUrBj7geXH09LnaED3SeSumspGxXphIwvzQD2nNqGerK6g"
}
} N-Quads:
N-Quads (VC only):
N-Quads (proof only, without JWS):
Credential with context adjustmentHere is a verifiable credential simpler to the above but with the {
"@context": [
"https://www.w3.org/2018/credentials/v1",
{
"sec": "https://w3id.org/security#"
}
],
"type": [
"VerifiableCredential"
],
"credentialSubject": {
"id": "urn:uuid:d58dcd4a-8602-47c8-90b4-a12d250af1be"
},
"issuer": "did:web:demo.spruceid.com:2021:05:10:example-rsa",
"issuanceDate": "2021-05-10T18:01:16.244Z",
"proof": {
"type": "RsaSignature2018",
"proofPurpose": "assertionMethod",
"verificationMethod": "did:web:demo.spruceid.com:2021:05:10:example-rsa#key",
"created": "2021-05-10T18:01:16.244Z",
"jws": "eyJhbGciOiJSUzI1NiIsImtpZCI6InJzYTIwNDgtMjAyMC0wOC0yNSIsImNyaXQiOlsiYjY0Il0sImI2NCI6ZmFsc2V9..IM4BYrQ-1UIalVY35N9QaxNl4SXmvyniuWCMX1lGAd2O4wwqTd2TP3hZLjw4q_6rfqrCdhsk0fLdu3jfF1-RIaldZ_LdrqDyDSqSYlEGGn2XbUGFeFAwotRIW0Ay0ljah-FjRi62C487tgkbtP-S2Cr1yUNxZi6ZoGFqahEtUlDuFu0qIOTW4qtu_-w1JUEyr1FIN2Nfzt-F5dGst6WlieaizJHsS78pNnjZYRdI5jHig-gEUku7lA7yjivLsrLyQ_SOG0DgATkdR-vVWf8voxBiXL-ifMygCL7xyZduNpMfm5ADw2myhHKbDeT4EGKw1uMkV97ADVxknobsZUdTiQ"
}
} N-Quads:
N-Quads (VC only):
N-Quads (proof only, without JWS):
|
I think one possible reason why this hasn't been detected sooner might be that during creation and verification of the You serialize the "proof options" separately from the "VC without the proof". An implementation might serialize the "VC without the proof" using the In such an implementation, the resulting proof would actually be correct, even though the VC as a whole would be invalid JSON-LD because of the missing terms. |
This is correct. I've updated the examples I wrote to add the N-Quads for VC only and proof only. For serializing the proof options, Spruce/ssi's implementation merges the local context from the linked data document (VC without proof) into the proof object. So it still uses the compact IRIs in this case. If |
I've optted to relabel this to a v2 issue that won't be addressed by this because of the reasons stated in this comment: #778 (comment) |
The issue was discussed in a meeting on 2022-08-03
View the transcript6.9. Base context v1 missing
|
Listing specific Data Integrity cryptosuites have been removed from the v2 context and are going to be replaced with |
No comments since marked pending close, closing |
Hello! I recently ran into a problem related to this. We are using verifiable-credentials-java (backend) and vc.js (frontend/mobile). This type of error can be hard to diagnose, specially to newcomers as me. Also:
I believe that a consensus/workaround should be made explicit in the spec, so we can have interoperability across all implementations. Thanks |
I've been looking into the base context and a minor PossibleErratum caught my attention. In the
"@context"
ofRsaSignature2018
property the shorthandsec:
is used several times, but the definition is not given, as in other properties.RsaSignature2018:
whereas in
EcdsaSecp256r1Signature2019
for exampleThe text was updated successfully, but these errors were encountered: