[=verifiable credential=](可验证凭证)是表达由[=issuer=](颁发者)做出的一组[=claims=](声明)的特定方式,例如驾驶执照或教育证书。本规范描述了[=verifiable credentials=]的可扩展数据模型、如何防止篡改,以及由[=issuers=]、[=holders=](持有者)和[=verifiers=](验证者)组成的三方生态系统中这些凭证的交换机制。本文档还涵盖了使用本规范所述技术的生态系统中的各种安全、隐私、国际化和无障碍考虑事项。
欢迎随时对本规范提出意见。请直接在 GitHub 上提交问题,如果无法使用 GitHub,请发送邮件至 public-vc-comments@w3.org (订阅, 归档)。
[=Credentials=](凭证)是我们日常生活中不可或缺的一部分:驾驶执照证明我们有能力驾驶机动车辆;大学学位证明我们的教育水平;政府颁发的护照在我们出国旅行时证明我们的公民身份。本规范提供了一种在 Web 上以加密安全、隐私保护和机器可验证的方式表达这些类型[=credentials=]的机制。这些[=credentials=]在物理世界中使用时为我们带来了诸多好处,但它们在 Web 上的使用仍然难以实现。
目前,在 Web 上以机器可读的方式表达教育资历、医疗数据、金融账户详情以及其他经第三方[=verified=](验证)的个人信息仍然十分困难。在 Web 上表达数字[=credentials=]的挑战阻碍了我们从中获得与物理[=credentials=]在现实世界中相同的好处。
对于不熟悉[=verifiable credentials=]相关概念的读者,以下各节概述了:
本规范所参考的用例和需求可以在 [[[VC-USE-CASES]]] [[?VC-USE-CASES]] 中找到。
在物理世界中,一份[=credential=]可能包含:
[=verifiable credential=]能够表示物理[=credential=]所表示的所有相同信息。通过添加数字签名等技术,[=verifiable credentials=]可以比其物理对应物更加防篡改且更值得信赖。
[=verifiable credentials=]的[=Holders=]可以生成[=verifiable presentations=],然后与[=verifiers=]分享这些[=verifiable presentations=],以证明他们拥有具有特定特征的[=verifiable credentials=]。
[=verifiable credentials=]和[=verifiable presentations=]都可以快速传输,使它们在远程建立信任时比物理对应物更加便捷。
虽然本规范试图提高表达数字[=credentials=]的便利性,但它也力求在这一目标与若干隐私保护目标之间取得平衡。数字信息的持久性以及收集和关联不同来源数字数据的便利性构成了隐私问题,而使用[=verifiable=]且易于机器读取的[=credentials=]可能会使这些问题更加严重。本文档在 [[[#privacy-considerations]]] 章节中概述并试图解决其中若干问题。本文档中还提供了如何使用隐私增强技术(如零知识证明)来使用此数据模型的示例。
术语[=verifiable credential=]和[=verifiable presentation=]中的"可验证"一词是指[=credential=]或[=presentation=]能够被[=verifier=]所[=verified=]的特性,如本文档中所定义。凭证的可验证性并不意味着其中编码的[=claims=]为真。相反,在确认[=verifiable credential=]或[=verifiable presentation=]的真实性和时效性后,[=verifier=]使用其自身的业务规则来验证所包含的[=claims=],然后才依赖它们。这种依赖仅在根据一项或多项验证者策略评估了颁发者、证明、主体和声明之后才发生。
本节描述了在预期[=verifiable credentials=]发挥作用的生态系统中核心参与者的角色以及它们之间的关系。角色是一种可以通过多种不同方式实现的抽象。角色的分离暗示了可能的标准化接口和协议。本规范引入了以下角色:
上方的[[[#roles]]]提供了一个示例生态系统,为本规范中的其余概念奠定基础。还存在其他生态系统,如受保护环境或专有系统,[=verifiable credentials=]在其中也能提供好处。
该生态系统与典型的双方或联合身份提供者模型形成对比。身份提供者(有时缩写为 IdP)是一种为[=holders=]创建、维护和管理身份信息的系统,同时向联合或分布式网络中的[=relying party=](依赖方)应用程序提供身份验证服务。在联合身份模型中,[=holder=]与身份提供者紧密绑定。本规范避免使用"身份提供者"、"联合身份"或"依赖方"术语,除非在将这些概念与其他规范进行比较或映射时。本规范将身份提供者的概念解耦为两个不同的概念:[=issuer=]和[=holder=]。
在许多情况下,[=verifiable credential=]的[=holder=]就是其主体,但在某些情况下并非如此。例如,父母([=holder=])可能持有孩子([=subject=])的[=verifiable credentials=],或者宠物主人([=holder=])可能持有其宠物([=subject=])的[=verifiable credentials=]。有关这些例外情况的更多信息,请参阅 [[[VC-IMP-GUIDE]]] 中的 主体-持有者关系章节。
如需更深入地探索[=verifiable credentials=]生态系统和具体的生命周期示例,请参阅 [[[VC-OVERVIEW]]] [[?VC-OVERVIEW]]。
conforming document(合规文档)是一份 压缩的 JSON-LD 文档,符合本规范中所有相关的"必须(MUST)"声明。具体而言,本文档中 [[[#basic-concepts]]]、[[[#advanced-concepts]]] 和 [[[#syntaxes]]] 章节中的相关规范性"必须(MUST)"声明必须(MUST)被执行。 合规文档必须(MUST)是媒体类型为 `application/vc` 的[=verifiable credential=] 或媒体类型为 `application/vp` 的[=verifiable presentation=]。合规文档必须(MUST) 按照 [[[#securing-mechanisms]]] 章节中描述的方式由至少一种安全机制进行保护。
conforming issuer implementation(合规颁发者实现) 生成[=conforming documents=],必须(MUST)在其生成的[=conforming documents=]中包含所有必需属性,并且必须(MUST)使用 [[[#securing-mechanisms]]] 章节中描述的安全机制来保护其生成的[=conforming documents=]。
conforming verifier implementation(合规验证者实现) 消费[=conforming documents=],必须(MUST)按照 [[[#securing-mechanisms]]] 章节中的描述对[=conforming document=]执行[=verification=],必须(MUST)检查每个必需属性是否满足该属性的规范性要求,并且必须(MUST)在检测到非[=conforming documents=]时产生错误。
本规范包含必需属性和可选属性。可选属性可以(MAY)被[=conforming issuer implementations=]和[=conforming verifier implementations=]忽略。
本文档还包含含有无效 JSON 字符的示例,如内联注释(`//`)和用于表示对示例价值不大的信息的省略号(`...`)。如果实现者希望将这些信息用作有效文档,请注意移除此类内容。
本文档中提供的示例包含描述性属性,如 `name` 和 `description`,其值使用英文以简化规范中每个示例的概念。这些示例不一定反映国际化使用所需的数据结构,更多详情在 [[[#internationalization-considerations]]] 章节中描述。
以下术语用于描述本规范中的概念。
以下各节概述了核心数据模型概念,如[=claims=]、[=credentials=]、[=presentations=]、[=verifiable credentials=]和[=verifiable presentations=],它们构成了本规范的基础。
读者可能注意到本节中描述的一些概念(如[=credentials=]和[=presentations=])没有本规范定义的媒体类型。然而,[=verifiable credential=]或[=verifiable presentation=]的概念被定义为[=conforming documents=]并具有关联的媒体类型。这些概念之间的具体区别——即[=credential=]和[=presentation=]与[=verifiable credential=]和[=verifiable presentation=]之间的区别——仅仅在于"可验证"对象是以密码学方式保护的,而其他对象则不是。更多详情请参阅 [[[#securing-mechanisms]]] 章节。
[=claim=]是关于[=subject=]的一个陈述。[=subject=]是可以对其做出[=claims=]的事物。[=Claims=]使用 主体(subject)- property(属性)-value(值)的关系来表达。
[=claims=]的数据模型(如上方[[[#basic-structure]]]所示)功能强大,可用于表达大量各类陈述。例如,某人是否毕业于某所大学可以如下方[[[#basic-example]]]所示来表达。
各个[=claims=]可以合并在一起,以表达关于[=subject=]的信息[=graph=]。下方[[[#multiple-claims]]]所示的示例扩展了前面的[=claim=],添加了 Pat 认识 Sam 以及 Sam 担任教授职务的[=claims=]。
至此,引入了[=claim=]和信息[=graph=]的概念。预计将向图中添加更多信息以辅助决定是否信任[=claims=]。
[=credential=]是由同一[=entity=]做出的一组一个或多个[=claims=]。[=Credentials=]还可能包含标识符和描述[=credential=]属性的元数据,如[=issuer=]、有效日期和时间段、代表性图像、[=verification material=]、状态信息等。[=verifiable credential=]是一组防篡改的[=claims=]和元数据,通过密码学方式证明其颁发者。[=verifiable credentials=]的示例包括但不限于数字员工身份证、数字驾驶执照和数字教育证书。
上方的[[[#basic-vc]]]展示了[=verifiable credential=]的基本组成部分,但抽象了关于[=claims=]如何组织成信息[=graphs=]以及信息图如何组织成[=verifiable credentials=]的细节。
下方的[[[#info-graph-vc]]]展示了使用基于 [[[?VC-DATA-INTEGRITY]]] 的[=embedded proof=](嵌入式证明)的[=verifiable credential=]的更完整描述。它至少由两个信息[=graphs=]组成。第一个信息[=graph=]即[=verifiable credential graph=]([=default graph=]),通过[=credential=]元数据和其他[=claims=]来表达[=verifiable credential=]本身。第二个信息[=graph=]由 `proof` 属性引用,是[=verifiable credential=]的 proof graph(证明图),是一个独立的[=named graph=]。[=proof graph=]表达数字证明,在此情况下是数字签名。对多个信息图必要性感兴趣的读者可以参阅 [[[#verifiable-credential-graphs]]] 章节。
下方的[[[#info-graph-vc-jwt]]]展示了与[[[#info-graph-vc]]]相同的[=verifiable credential=],但使用 JOSE [[?VC-JOSE-COSE]] 进行保护。有效载荷包含单个信息图,即包含[=credential=]元数据和其他[=claims=]的[=verifiable credential graph=]。
增强隐私保护是本规范的一个关键设计特性。因此,使用此技术的[=entities=]仅表达其在特定情境下适用的身份侧面至关重要。一个人身份子集的表达称为[=verifiable presentation=]。不同身份侧面的示例包括一个人的职业身份、在线游戏身份、家庭身份或匿名身份。
[=verifiable presentation=]由[=holder=]创建,可以表达来自多个[=verifiable credentials=]的数据,并可以包含任意附加数据。它们用于向[=verifier=]展示[=claims=]。也可以直接展示[=verifiable credentials=]。
[=presentation=]中的数据通常涉及相同的[=subject=],但可能由多个[=issuers=]颁发。这些信息的聚合表达了一个人、组织或[=entity=]的某个方面。
上方的[[[#basic-vp]]]展示了[=verifiable presentation=]的组成部分,但抽象了关于[=verifiable credentials=]如何组织成信息[=graphs=]以及信息图如何组织成[=verifiable presentations=]的细节。
下方的[[[#info-graph-vp]]]展示了使用基于 [[[?VC-DATA-INTEGRITY]]] 的[=embedded proof=]的[=verifiable presentation=]的更完整描述。它至少由四个信息[=graphs=]组成。第一个信息[=graph=]即[=verifiable presentation graph=]([=default graph=]),通过[=presentation=]元数据来表达[=verifiable presentation=]本身。[=verifiable presentation=]通过 `verifiableCredential` 属性引用[=verifiable credential=]。该[=credential=]是一个自包含的[=verifiable credential graph=],包含[=credential=]元数据和其他[=claims=]。该[=credential=]通过 `proof` 属性引用[=verifiable credential=]的[=proof graph=],表达[=credential=]的证明(通常是数字签名)。该[=verifiable credential graph=]及其链接的[=proof graph=]分别构成第二和第三个信息[=graphs=],每个都是独立的[=named graph=]。[=presentation=]还通过 `proof` 属性引用[=presentation=]的[=proof graph=],即第四个信息[=graph=](另一个[=named graph=])。该[=presentation=]的[=proof graph=]表示[=verifiable presentation graph=]、[=verifiable credential graph=]以及从[=verifiable credential graph=]链接的[=proof graph=]的数字签名。
下方的[[[#info-graph-vp-jwt]]]展示了与[[[#info-graph-vp]]]相同的[=verifiable presentation=],但使用基于 [[?VC-JOSE-COSE]] 的[=enveloping proof=]。有效载荷仅包含两个信息图:通过展示元数据表达[=verifiable presentation=]的[=verifiable presentation graph=],以及由 `verifiableCredential` 属性引用的对应[=verifiable credential graph=]。[=verifiable credential graph=]包含单个 `EnvelopedVerifiableCredential` 实例,通过 `data:` URL [[RFC2397]] 引用通过[[[#info-graph-vc-jwt]]]中所示的[=enveloping proof=]保护的可验证凭证。
[=presentation=](如大学凭证的集合)可以引用来自不同[=subjects=]的多个[=credentials=],这些主体通常(但不要求)相互关联。这通过使用 `verifiableCredential` 属性引用多个[=verifiable credentials=]来实现。更多详情请参阅附录 [[[#additional-diagrams-for-verifiable-presentations]]]。
如 [[[#ecosystem-overview]]] 章节所述,[=entity=]在参与特定凭证交换时可以担任一个或多个角色。虽然通常期望[=holder=]生成[=presentations=],但[=issuer=]或[=verifier=]也可能生成展示以向[=holder=]表明自身身份。当[=holder=]在作为[=verifiable presentation=]的一部分交出敏感信息之前需要[=issuer=]或[=verifier=]提供更高保证时,就可能出现这种情况。
本节介绍本规范的一些基本概念,为文档后面的[[[#advanced-concepts]]]做准备。
本规范旨在简化新型[=verifiable credentials=]的原型设计。开发者可以复制下面的模板并粘贴到常用的[=verifiable credential=]工具中,开始颁发、持有和验证原型凭证。
开发者将把下面的`MyPrototypeCredential`更改为他们想要创建的凭证类型。由于[=verifiable credentials=]是关于主体的,`credentialSubject`对象中的每个属性-值对表达凭证主体的特定属性。一旦开发者添加了若干这样的属性-值组合,修改后的对象就可以发送给[=conforming issuer implementation=],将为开发者创建一个[=verifiable credential=]。从原型设计的角度来看,这就是开发者需要做的全部工作。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"type": ["VerifiableCredential", "MyPrototypeCredential"],
"credentialSubject": {
"mySubjectProperty": "mySubjectValue"
}
}
在稳定所有凭证属性后,建议开发者生成并在稳定的URL上发布词汇表和上下文文件,以促进与其他开发者的互操作性。上面的 `https://www.w3.org/ns/credentials/examples/v2` URL将被替换为特定用例上下文的URL。此过程在[[[#extensibility]]]节中介绍。或者,开发者可以重用恰好符合其用例的现有词汇表和上下文文件。他们可以探索[[[VC-EXTENSIONS]]]以获取可重用资源。
[=Verifiable credentials=]用于表达一个或多个[=subjects=]的属性以及[=credential=]本身的属性。以下属性在本规范中为[=verifiable credential=]定义:
[=verifiable credential=]可以通过[[[#extensibility]]]节中定义的扩展机制添加额外属性。
当两个软件系统需要交换数据时,它们需要使用双方都理解的术语。想想两个人如何通过使用相同的语言有效沟通,其中他们使用的词语(如"姓名"和"网站")对每个人来说意思相同。这有时被称为对话的上下文。本规范使用类似的概念,通过建立通信上下文来为软件系统实现类似的结果。
处理[=verifiable credentials=]和[=verifiable presentations=]的软件系统通过为每个术语使用[=URLs=]来识别术语。然而,这些[=URLs=]可能很长且对人不太友好,而简短的、对人友好的别名可能更有帮助。本规范使用`@context` [=property=]将简短别名映射到[=URLs=]。
[=Verifiable credentials=]和[=verifiable presentations=]必须(MUST)包含`@context` [=property=]。应用开发者必须(MUST)理解其应用使用的每个JSON-LD上下文,至少要理解到影响其应用所用术语含义的程度。实现此目的的一种机制在[[[VC-DATA-INTEGRITY]]]规范的验证上下文节中描述。基于本规范构建的其他规范可以(MAY)要求通过使用[[[#integrity-of-related-resources]]]节中描述的`relatedResource`特性或任何等效机制来对JSON-LD上下文进行完整性保护。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://university.example/credentials/58473",
"type": ["VerifiableCredential", "ExampleAlumniCredential"],
"issuer": "did:example:2g55q912ec3476eba2l9812ecbfe",
"validFrom": "2010-01-01T00:00:00Z",
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"alumniOf": {
"id": "did:example:c276e12ec21ebfeb1f712ebc6f1",
"name": "Example University"
}
}
}
上面的示例使用基础上下文[=URL=](`https://www.w3.org/ns/credentials/v2`)来建立数据交换是关于[=verifiable credential=]的。这一概念在[[[#extensibility]]]节中进一步详述。`https://www.w3.org/ns/credentials/v2`处可获取的数据是一个可永久缓存的静态文档,其处理说明在附录[[[#base-context]]]中提供。可验证凭证数据模型的相关人类可读词汇文档可在https://www.w3.org/2018/credentials/获取。
第二个[=URL=](`https://www.w3.org/ns/credentials/examples/v2`)用于演示示例。实现不应将此[=URL=]用于任何其他目的,例如试点或生产系统。
`@context` [=property=]在[[[JSON-LD11]]]规范的3.1节:上下文中有进一步阐述。
在表达关于特定事物(如人、产品或组织)的陈述时,使用该事物的全局唯一标识符可能很有用。全局唯一标识符使其他人能够表达关于同一事物的陈述。本规范为此类标识符定义了可选的`id` [=property=]。`id` [=property=]允许在[=verifiable credential=]中表达关于特定事物的陈述,由[=issuer=]在[=verifiable credential=]中表达对象时设置,或由[=holder=]在[=verifiable presentation=]中表达对象时设置。`id` [=property=]表达一个标识符,期望他人在表达关于由该标识符标识的特定事物的陈述时使用。`id`值的示例包括UUID(`urn:uuid:0c07c1ce-57cb-41af-bef2-1b932b986873`)、HTTP URL(`https://id.example/things#123`)和DID(`did:example:1234abcd`)。
提醒开发者注意,当需要匿名性时,标识符可能是有害的。在考虑此类场景时,鼓励开发者仔细阅读[[[#identifier-based-correlation]]]节。在[[[#privacy-considerations]]]节中还记录了其他类型的访问和关联机制,它们会产生隐私问题。在隐私是重要考虑因素的情况下,允许省略`id` [=property=]。某些用例不需要或明确需要省略`id` [=property=]。同样,对于公共可解析URL和其他形式标识符之间的选择也需要特别注意。公共可解析URL可以促进验证和互操作性的便利性,但如果使用不当,也可能无意中授予对潜在敏感信息的访问权限。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://university.example/credentials/3732",
"type": ["VerifiableCredential", "ExampleDegreeCredential"],
"issuer": "https://university.example/issuers/565049",
"validFrom": "2010-01-01T00:00:00Z",
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"degree": {
"type": "ExampleBachelorDegree",
"name": "Bachelor of Science and Arts"
}
}
}
上面的示例使用了两种类型的标识符。第一个标识符用于[=verifiable credential=],使用基于HTTP的URL。第二个标识符用于[=verifiable credential=]的[=subject=]([=claims=]所关于的事物),使用[=decentralized identifier=],也称为[=DID=]。
[=DIDs=]是一种标识符类型,对于[=verifiable credentials=]发挥作用并非必需。具体来说,[=verifiable credentials=]不依赖于[=DIDs=],[=DIDs=]也不依赖于[=verifiable credentials=]。然而,许多[=verifiable credentials=]将使用[=DIDs=],实现本规范的软件库将需要解析[=DIDs=]。基于[=DID=]的URL用于表达与[=subjects=]、[=issuers=]、[=holders=]、凭证状态列表、密码学密钥以及与[=verifiable credential=]相关的其他机器可读信息关联的标识符。
处理本文档中指定类型对象的软件系统使用类型信息来确定所提供的[=verifiable credential=]或[=verifiable presentation=]是否适合预期的用例。本规范定义了`type` [=property=]来表达对象类型信息。此类型信息可用于[=validation=]过程中,如附录[[[#validation]]]所述。
[=Verifiable credentials=]和[=verifiable presentations=]必须(MUST)包含具有关联值的`type` [=property=]。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://university.example/credentials/3732",
"type": ["VerifiableCredential", "ExampleDegreeCredential"],
"issuer": "https://university.example/issuers/565049",
"validFrom": "2010-01-01T00:00:00Z",
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"degree": {
"type": "ExampleBachelorDegree",
"name": "Bachelor of Science and Arts"
}
}
}
关于本规范,下表列出了必须(MUST)指定[=type=]的对象。
| 对象 | 类型 |
|---|---|
| [=Verifiable credential=] 对象 |
`VerifiableCredential`,以及可选的更具体的[=verifiable credential=] [=type=]。例如, `"type": ["VerifiableCredential", "OpenBadgeCredential"]` |
| [=Verifiable presentation=] 对象 |
`VerifiablePresentation`,以及可选的更具体的[=verifiable presentation=] [=type=]。例如, `"type": "VerifiablePresentation"` |
| credentialStatus 对象 |
有效的[=credential=]状态[=type=]。例如, `"type": "BitstringStatusListEntry"` |
| termsOfUse 对象 |
有效的使用条款[=type=]。例如, `"type": "TrustFrameworkPolicy"` |
| evidence 对象 |
有效的证据[=type=]。例如, `"type": "Evidence"` |
| refreshService 对象 |
有效的refreshService [=type=]。例如, `"type": "VerifiableCredentialRefreshService2021"` |
| credentialSchema 对象 |
有效的credentialSchema [=type=]。例如, `"type": "JsonSchema"` |
可验证凭证数据模型的[=type=]系统与[[[JSON-LD11]]]相同,详见3.5节:指定类型和9节:JSON-LD语法。使用JSON-LD上下文(见[[[#extensibility]]]节)时,本规范将`@type`关键字别名为`type`,使JSON-LD文档更易于理解。虽然应用开发者和文档作者不需要理解JSON-LD类型系统的细节,但想要支持可互操作扩展性的本规范实现者需要了解。
所有[=credentials=]、[=presentations=]和封装对象应当(SHOULD)指定或关联额外的、更具体的[=types=](例如`ExampleDegreeCredential`),以便软件系统能够更容易地检测和处理这些额外信息。
处理本规范中定义的封装对象(如与`credentialSubject`对象关联或深层嵌套的对象)时,软件系统应当(SHOULD)使用层级结构中更高层封装对象中指定的[=type=]信息。具体来说,封装对象(如[=credential=])应当(SHOULD)传达关联对象的[=types=],以便[=verifiers=]能够根据封装对象的[=type=]快速确定关联对象的内容。
例如,具有`ExampleDegreeCredential` `type`的[=credential=]对象向[=verifier=]发出信号,表明与`credentialSubject`属性关联的对象包含以下标识符:
这使实现者能够依赖与`type`属性关联的值进行[=verification=]。对象类型及其关联值预计至少在一个人类可读的规范中记录,该规范可在类型的[=URL=]处找到。例如,`BitstringStatusList`类型的人类可读定义可在https://www.w3.org/ns/credentials/status/#BitstringStatusList找到。还建议通过同一URL的HTTP内容协商提供机器可读版本。
如何创建新型[=verifiable credential=]超出了本规范的范围。有兴趣这样做的读者建议阅读[[[?VC-IMP-GUIDE]]]中的创建新凭证类型节。
在显示[=credential=]时,由[=issuer=]提供为[=credential=]附带名称和简短描述其目的的文本会很有帮助。`name`和`description` [=properties=]即服务于这些目的。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://university.example/credentials/3732",
"type": ["VerifiableCredential", "ExampleDegreeCredential"],
"issuer": {
"id": "https://university.example/issuers/565049",
"name": "Example University",
"description": "A public university focusing on teaching examples."
},
"validFrom": "2015-05-10T12:30:00Z",
"name": "Example University Degree",
"description": "2015 Bachelor of Science and Arts Degree",
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"degree": {
"type": "ExampleBachelorDegree",
"name": "Bachelor of Science and Arts"
}
}
}
Names and descriptions also support expressing content in different languages. To express a string with language and [=base direction=] information, one can use an object that contains the `@value`, `@language`, and `@direction` properties to express the text value, language tag, and base direction, respectively. See [[[#language-and-base-direction]]] for further information.
The `@direction` property in the examples below is not required for the associated single-language strings, as their default directions are the same as those set by the `@direction` value. We include the `@direction` property here for clarity of demonstration and to make copy+paste+edit deliver functional results. Implementers are encouraged to read the section on String Internationalization in the [[[JSON-LD11]]] specification.
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://university.example/credentials/3732",
"type": ["VerifiableCredential", "ExampleDegreeCredential"],
"issuer": {
"id": "https://university.example/issuers/565049",
"name": [{
"@value": "Example University",
"@language": "en"
}, {
"@value": "Université Exemple",
"@language": "fr"
}, {
"@value": "جامعة المثال",
"@language": "ar",
"@direction": "rtl"
}],
"description": [{
"@value": "A public university focusing on teaching examples.",
"@language": "en"
}, {
"@value": "Une université publique axée sur l'enseignement d'exemples.",
"@language": "fr"
}, {
"@value": ".جامعة عامة تركز على أمثلة التدريس",
"@language": "ar",
"@direction": "rtl"
}]
},
"validFrom": "2015-05-10T12:30:00Z",
"name": [{
"@value": "Example University Degree",
"@language": "en"
}, {
"@value": "Exemple de Diplôme Universitaire",
"@language": "fr"
}, {
"@value": "مثال الشهادة الجامعية",
"@language": "ar",
"@direction": "rtl"
}],
"description": [{
"@value": "2015 Bachelor of Science and Arts Degree",
"@language": "en"
}, {
"@value": "2015 Licence de Sciences et d'Arts",
"@language": "fr"
}, {
"@value": "2015 بكالوريوس العلوم والآداب",
"@language": "ar",
"@direction": "rtl"
}],
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"degree": {
"type": "ExampleBachelorDegree",
"name": [{
"@value": "Bachelor of Science and Arts Degree",
"@language": "en"
}, {
"@value": "Licence de Sciences et d'Arts",
"@language": "fr"
}, {
"@value": "بكالوريوس العلوم والآداب",
"@language": "ar",
"@direction": "rtl"
}]
}
}
}
本规范定义了一个属性来表达[=verifiable credential=]的[=issuer=]。
[=verifiable credential=]必须(MUST)具有`issuer` [=property=]。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://university.example/credentials/3732",
"type": ["VerifiableCredential", "ExampleDegreeCredential"],
"issuer": "https://university.example/issuers/14",
"validFrom": "2010-01-01T19:23:24Z",
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"degree": {
"type": "ExampleBachelorDegree",
"name": "Bachelor of Science and Arts"
}
}
}
也可以通过将对象与issuer属性关联来表达关于颁发者的额外信息:
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://university.example/credentials/3732",
"type": ["VerifiableCredential", "ExampleDegreeCredential"],
"issuer": {
"id": "did:example:76e12ec712ebc6f1c221ebfeb1f",
"name": "Example University"
},
"validFrom": "2010-01-01T19:23:24Z",
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"degree": {
"type": "ExampleBachelorDegree",
"name": "Bachelor of Science and Arts"
}
}
}
`issuer` [=property=]的值也可以是JWK(例如`"https://jwk.example/keys/foo.jwk"`)或[=DID=](例如`"did:example:abfe13f712120431c276e12ecab"`)。
[=verifiable credential=]包含关于一个或多个[=subjects=]的[=claims=]。本规范定义了`credentialSubject` [=property=]用于表达关于一个或多个[=subjects=]的[=claims=]。
[=verifiable credential=]必须(MUST)包含`credentialSubject` [=property=]。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://university.example/credentials/3732",
"type": ["VerifiableCredential", "ExampleDegreeCredential"],
"issuer": "https://university.example/issuers/565049",
"validFrom": "2010-01-01T00:00:00Z",
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"degree": {
"type": "ExampleBachelorDegree",
"name": "Bachelor of Science and Arts"
}
}
}
Expressing information related to multiple [=subjects=] in a [=verifiable credential=] is possible. The example below specifies two [=subjects=] who are spouses. Note the use of array notation to associate multiple [=subjects=] with the `credentialSubject` property.
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://university.example/credentials/3732",
"type": ["VerifiableCredential", "RelationshipCredential"],
"issuer": "https://issuer.example/issuer/123",
"validFrom": "2010-01-01T00:00:00Z",
"credentialSubject": [{
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"name": "Jayden Doe",
"spouse": "did:example:c276e12ec21ebfeb1f712ebc6f1"
}, {
"id": "https://subject.example/subject/8675",
"name": "Morgan Doe",
"spouse": "https://subject.example/subject/7421"
}]
}
本规范定义了`validFrom` [=property=]以帮助颁发者表达[=credential=]生效的日期和时间,以及`validUntil` [=property=]以表达[=credential=]失效的日期和时间。
比较日期和时间时,计算以"时序"方式进行,即将字符串值转换为存在于时间线上某一点的"时序值"。然后通过检查被比较的日期和时间相对于时间线上某一特定点的位置来执行时序比较。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://university.example/credentials/3732",
"type": ["VerifiableCredential", "ExampleDegreeCredential"],
"issuer": "https://university.example/issuers/14",
"validFrom": "2010-01-01T19:23:24Z",
"validUntil": "2020-01-01T19:23:24Z",
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"degree": {
"type": "ExampleBachelorDegree",
"name": "Bachelor of Science and Arts"
}
}
}
如果`validFrom`和`validUntil`均不存在,则[=verifiable credential=]的有效期被视为无限期有效。在这种情况下,假定[=verifiable credential=]从`verifiable credential`创建时起即为有效。
本规范定义了credentialStatus [=property=],用于发现与[=verifiable credential=]状态相关的信息,例如是否已被暂停或撤销。
如果存在,与`credentialStatus` [=property=]关联的值是单个对象或一组一个或多个对象。为每个对象定义了以下[=properties=]:
[=credential=]状态信息的精确内容由具体的`credentialStatus` [=type=]定义决定,并根据多种因素变化,例如它是否易于实现或是否具有隐私增强功能。该值将提供足够的信息来确定[=credential=]的当前状态以及是否可以从URL检索机器可读信息。例如,该对象可以包含指向外部文档的链接,该文档说明[=credential=]是否已被暂停或撤销。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://university.example/credentials/3732",
"type": ["VerifiableCredential", "ExampleDegreeCredential"],
"issuer": "https://university.example/issuers/14",
"validFrom": "2010-01-01T19:23:24Z",
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"degree": {
"type": "ExampleBachelorDegree",
"name": "Bachelor of Science and Arts"
}
},
"credentialStatus": {
"id": "https://university.example/credentials/status/3#94567",
"type": "BitstringStatusListEntry",
"statusPurpose": "revocation",
"statusListIndex": "94567",
"statusListCredential": "https://university.example/credentials/status/3"
}
}
一个[=credential=]可以有多个关联状态,例如是否已被撤销或暂停。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://license.example/credentials/9837",
"type": ["VerifiableCredential", "ExampleDrivingLicenseCredential"],
"issuer": "https://license.example/issuers/48",
"validFrom": "2020-03-14T12:10:42Z",
"credentialSubject": {
"id": "did:example:f1c276e12ec21ebfeb1f712ebc6",
"license": {
"type": "ExampleDrivingLicense",
"name": "License to Drive a Car"
}
},
"credentialStatus": [{
"id": "https://license.example/credentials/status/84#14278",
"type": "BitstringStatusListEntry",
"statusPurpose": "revocation",
"statusListIndex": "14278",
"statusListCredential": "https://license.example/credentials/status/84"
}, {
"id": "https://license.example/credentials/status/84#82938",
"type": "BitstringStatusListEntry",
"statusPurpose": "suspension",
"statusListIndex": "82938",
"statusListCredential": "https://license.example/credentials/status/84"
}]
}
提醒实现者注意,具有多个状态条目的[=credentials=]可能包含冲突信息。协调此类冲突是[=validation=]过程的一部分,因此属于验证者的业务逻辑,不在本规范范围内。
定义状态方案的数据模型、格式和协议不在本规范范围内。[[[?VC-EXTENSIONS]]]文档包含可供希望实现[=verifiable credential=]状态检查的实现者使用的状态方案。
凭证状态规范禁止(MUST NOT)允许对个人的追踪,例如在[=verifier=]对特定[=holder=]或[=subject=]感兴趣时(直接或间接地)通知[=issuer=]。不可接受的方法包括"回拨"(即每次使用凭证都联系[=issuer=]检查特定个人的状态)或"匿名性降低"(即每次使用凭证都从[=issuer=]请求信息,[=issuer=]可以利用这些信息推断[=verifier=]对特定个人的兴趣)。
数据模式在对给定数据集合强制执行特定结构时很有用。本规范至少考虑两种类型的数据模式:
重要的是要理解,数据模式与`@context`属性的目的不同,后者既不强制数据结构或数据语法,也不支持定义到替代表示格式的任意编码。
This specification defines the following [=property=] for expressing a data schema, which an [=issuer=] can include in the [=verifiable credentials=] that it issues:
`credentialSchema` [=property=]的值必须(MUST)是一个或多个数据模式,为[=verifiers=]提供足够信息来确定所提供的数据是否符合所提供的模式。每个`credentialSchema`必须(MUST)指定其`type`(例如`JsonSchema`)和`id` [=property=],后者必须(MUST)是标识模式文件的[=URL=]。具体的类型定义决定每个数据模式的精确内容。
如果存在多个模式,则根据每个关联`type`属性所概述的处理规则确定有效性。
`credentialSchema` [=property=]允许对类型定义进行注释或将其锁定到词汇表的特定版本。[=verifiable credentials=]的作者可以使用由某种内容完整性保护机制保护的`credentialSchema`包含其词汇表的静态版本。`credentialSchema` [=property=]还使得能够对[=credential=]执行语法检查,并使用JSON Schema [[?VC-JSON-SCHEMA]]验证等[=verification=]机制。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://university.example/credentials/3732",
"type": ["VerifiableCredential", "ExampleDegreeCredential", "ExamplePersonCredential"],
"issuer": "https://university.example/issuers/14",
"validFrom": "2010-01-01T19:23:24Z",
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"degree": {
"type": "ExampleBachelorDegree",
"name": "Bachelor of Science and Arts"
},
"alumniOf": {
"name": "Example University"
}
},
"credentialSchema": [{
"id": "https://example.org/examples/degree.json",
"type": "JsonSchema"
},
{
"id": "https://example.org/examples/alumni.json",
"type": "JsonSchema"
}]
}
在上面的示例中,[=issuer=]指定了两个`credentialSchema`对象,每个对象指向一个JSON Schema [[?VC-JSON-SCHEMA]]文件,[=verifier=]可以使用它来确定[=verifiable credential=]是否格式良好。
本规范认可两类securing mechanisms:使用包裹式证明的机制和使用嵌入式证明的机制。
enveloping proof包装本数据模型的序列化。一种建议(RECOMMENDED)的包裹式证明机制在[[[VC-JOSE-COSE]]] [[VC-JOSE-COSE]]中定义。
embedded proof是一种将证明包含在数据模型序列化中的机制。一种建议(RECOMMENDED)的嵌入式证明机制在[[[VC-DATA-INTEGRITY]]] [[VC-DATA-INTEGRITY]]中定义。
These two classes of securing mechanisms are not mutually exclusive. Additional securing mechanism specifications might also be defined according to the rules in Section [[[#securing-mechanism-specifications]]].
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://example.gov/credentials/3732",
"type": ["VerifiableCredential", "ExampleDegreeCredential"],
"issuer": "did:example:6fb1f712ebe12c27cc26eebfe11",
"validFrom": "2010-01-01T19:23:24Z",
"credentialSubject": {
"id": "https://subject.example/subject/3921",
"degree": {
"type": "ExampleBachelorDegree",
"name": "Bachelor of Science and Arts"
}
},
"proof": {
"type": "DataIntegrityProof",
"cryptosuite": "eddsa-rdfc-2022",
"created": "2021-11-13T18:19:39Z",
"verificationMethod": "https://university.example/issuers/14#key-1",
"proofPurpose": "assertionMethod",
"proofValue": "z58DAdFfa9SkqZMVPxAQp...jQCrfFPP2oumHKtz"
}
}
上面的[=embedded proof=]通过`proof`属性向原始数据添加数字签名来保护原始[=credential=]。这生成了一个在现代编程环境和数据库系统中易于管理的[=verifiable credential=]。
eyJhbGciOiJFUzM4NCIsImtpZCI6IkdOV2FBTDJQVlVVMkpJVDg5bTZxMGM3U3ZjNDBTLWJ2UjFTT0
Q3REZCb1UiLCJ0eXAiOiJ2YytsZCtqc29uK3NkLWp3dCIsImN0eSI6InZjK2xkK2pzb24ifQ
.
eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvbnMvY3JlZGVudGlhbHMvdjIiLCJodHRwcz
ovL3d3dy53My5vcmcvbnMvY3JlZGVudGlhbHMvZXhhbXBsZXMvdjIiXSwiaXNzdWVyIjoiaHR0cHM6
Ly91bml2ZXJzaXR5LmV4YW1wbGUvaXNzdWVycy81NjUwNDkiLCJ2YWxpZEZyb20iOiIyMDEwLTAxLT
AxVDE5OjIzOjI0WiIsImNyZWRlbnRpYWxTY2hlbWEiOnsiX3NkIjpbIlNFOHp4bmduZTNNbWEwLUNm
S2dlYW1rNUVqU1NfOXRaNlN5NDdBdTdxRWMiLCJjT3lySEVrSlZwdEtSdURtNkNZVTREajJvRkExd0
JQRjFHcTJnWEo1NXpzIl19LCJjcmVkZW50aWFsU3ViamVjdCI6eyJkZWdyZWUiOnsibmFtZSI6IkJh
Y2hlbG9yIG9mIFNjaWVuY2UgYW5kIEFydHMiLCJfc2QiOlsibVNfSVBMa0JHcTIxbVA3Z0VRaHhOck
E0ZXNMc1ZKQ1E5QUpZNDFLLVRQSSJdfSwiX3NkIjpbIlhTSG9iU05Md01PVl9QNkhQMHNvMnZ1clNy
VXZ3UURYREJHQWtyTXk3TjgiXX0sIl9zZCI6WyJQNE5qWHFXa2JOc1NfRzdvdmlLdm1NOG0yckhDTm
5XVVV2SXZBbW9jb2RZIiwieFNvSHBKUXlCNGV1dmg4SkFJdDFCd1pjNFVEOHY5S3ZOTmVLMk9OSjFC
QSJdLCJfc2RfYWxnIjoic2hhLTI1NiIsImlzcyI6Imh0dHBzOi8vdW5pdmVyc2l0eS5leGFtcGxlL2
lzc3VlcnMvNTY1MDQ5IiwiaWF0IjoxNzAzNjI1OTAxLCJleHAiOjE3MzUyNDgzMDEsImNuZiI6eyJq
d2siOnsia3R5IjoiRUMiLCJjcnYiOiJQLTM4NCIsImFsZyI6IkVTMzg0IiwieCI6Inl1Zlo1SFUzcU
NfOTRMbkI3Zklzd0hmT0swQlJra0Z5bzVhd1QyX21ld0tJWUpLMVNfR0QySVB3UjRYUTZpdFEiLCJ5
IjoiRmEtV2pOd2NLQ1RWWHVDU2tCY3RkdHJOYzh6bXdBTTZWOWxudmxxd1QyQnRlQ0ZHNmR6ZDJoMF
VjeXluTDg0dCJ9fX0
.
M7BFJB9LEV_xEylSJpP00fd_4WjrOlXshh0dUv3QgOzw2MEGIfSfi9PoCkHJH7TI0InsqkD6XZVz38
MpeDKekgBW-RoDdJmxnifYOEJhKpJ5EN9PvA007UPi9QCaiEzX
~
WyJFX3F2V09NWVQ1Z3JNTkprOHNXN3BBIiwgImlkIiwgImh0dHA6Ly91bml2ZXJzaXR5LmV4YW1wbG
UvY3JlZGVudGlhbHMvMTg3MiJd
~
WyJTSEc4WnpfRDVRbFMwU0ZrZFUzNXlRIiwgInR5cGUiLCBbIlZlcmlmaWFibGVDcmVkZW50aWFsIi
wgIkV4YW1wbGVBbHVtbmlDcmVkZW50aWFsIl1d
~
WyJqZzJLRno5bTFVaGFiUGtIaHV4cXRRIiwgImlkIiwgImh0dHBzOi8vZXhhbXBsZS5vcmcvZXhhbX
BsZXMvZGVncmVlLmpzb24iXQ
~
WyItQmhzaE10UnlNNUVFbGt4WGVXVm5nIiwgInR5cGUiLCAiSnNvblNjaGVtYSJd~WyJ0SEFxMEUwN
nY2ckRuUlNtSjlSUWRBIiwgImlkIiwgImRpZDpleGFtcGxlOjEyMyJd
~
WyJ1Ynd6bi1kS19tMzRSMGI0SG84QTBBIiwgInR5cGUiLCAiQmFjaGVsb3JEZWdyZWUiXQ
上面的[=enveloping proof=]通过将原始数据封装在数字签名信封中来保护原始[=credential=],生成可以使用理解SD-JWT格式的工具处理的[=verifiable credential=]。
[=Verifiable presentations=]可以(MAY)用于聚合来自多个[=verifiable credentials=]的信息。
[=Verifiable presentations=]应当(SHOULD)具有极短的有效期,并绑定到[=verifier=]提供的质询。实现这一点的细节取决于安全机制、传输协议和[=verifier=]策略。除非特定安全机制或嵌入协议定义了额外要求,[=verifier=]通常不能假设[=verifiable presentation=]与所展示的[=verifiable credentials=]相关联。
[=verifiable presentation=]的[=default graph=]也称为verifiable presentation graph。
为[=verifiable presentation=]定义了以下属性:
下面的示例展示了一个[=verifiable presentation=]:
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "urn:uuid:3978344f-8596-4c3a-a978-8fcaba3903c5",
"type": ["VerifiablePresentation", "ExamplePresentation"],
"verifiableCredential": [{ ... }]
}
上面显示的`verifiableCredential` [=property=]的内容是本规范所描述的可验证凭证图。
[=verifiable presentation=]可以包含一个或多个使用"包封"有效载荷的安全机制(如[[[?VC-JOSE-COSE]]] [[?VC-JOSE-COSE]])保护的[=verifiable credentials=]。这可以通过将`verifiableCredential`属性与具有`EnvelopedVerifiableCredential` `type`的对象关联来实现。
下面的示例展示了一个包含包封的[=verifiable credential=]的[=verifiable presentation=]:
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"type": ["VerifiablePresentation", "ExamplePresentation"],
"verifiableCredential": [{
"@context": "https://www.w3.org/ns/credentials/v2",
"id": "data:application/vc+sd-jwt,QzVjV...RMjU",
"type": "EnvelopedVerifiableCredential"
}]
}
实现者可能希望在RDF环境中处理本节描述的对象以及`id`值表达的包封展示,并在与RDF相关的对象之间创建链接。这样做的需求和机制取决于用例,因此取决于具体实现。
可以表达使用"包封"有效载荷的机制(如[[[?VC-JOSE-COSE]]] [[?VC-JOSE-COSE]])保护的[=verifiable presentation=]。这可以通过使用具有`EnvelopedVerifiablePresentation` `type`的对象来实现。
下面的示例展示了一个包封的[=verifiable presentation=]:
{
"@context": "https://www.w3.org/ns/credentials/v2",
"id": "data:application/vp+jwt,eyJraWQiO...zhwGfQ",
"type": "EnvelopedVerifiablePresentation"
}
某些零知识密码学方案可能使[=holders=]能够间接证明他们持有来自[=verifiable credential=]的[=claims=],而不透露该[=verifiable credential=]中的所有声明。在这些方案中,[=verifiable credential=]可能用于派生可展示的数据,这些数据经过密码学断言,使得[=verifier=]如果信任[=issuer=]就可以信任该值。
Some selective disclosure schemes can share a subset of [=claims=] derived from a [=verifiable credential=].
For an example of a ZKP-style [=verifiable presentation=] containing derived data instead of directly embedded [=verifiable credentials=], see Section [[[#zero-knowledge-proofs]]].
[=holder=]可以(MAY)使用[=verifiable presentation=]中的`verifiableCredential` [=property=]来包含来自任何[=issuer=](包括自身)的[=verifiable credentials=]。当[=verifiable credential=]的[=issuer=]就是[=holder=]时,该[=verifiable credential=]中的[=claims=]被视为自我声明。此类自我声明的声明可以通过保护包含它们的[=verifiable presentation=]的相同机制或任何可用于其他[=verifiable credentials=]的机制来保护。
这些自我声明[=claims=]的主体不受限制,因此这些[=claims=]可以包含关于[=holder=]、其他包含的[=verifiable credentials=]之一或甚至包含自我声明[=verifiable credential=]的[=verifiable presentation=]的陈述。在每种情况下,`id` [=property=]用于在对其做出[=claims=]的对象中标识特定[=subject=],就像在非自我声明的[=verifiable credentials=]中一样。
包含仅使用与[=verifiable presentation=]相同机制保护的自我声明[=verifiable credential=]的[=verifiable presentation=]必须(MUST)包含`holder` [=property=]。
为[=verifiable credentials=]定义的所有规范性要求均适用于自我声明的[=verifiable credentials=]。
当[=verifiable credential=]的`issuer` [=property=]的值与[=verifiable presentation=]的`holder` [=property=]的值相同时,[=verifiable presentation=]中的[=verifiable credential=]被视为自我声明。
下面的示例展示了一个嵌入自我声明[=verifiable credential=]的[=verifiable presentation=],该凭证使用与[=verifiable presentation=]相同的机制保护。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"type": ["VerifiablePresentation", "ExamplePresentation"],
"holder": "did:example:12345678",
"verifiableCredential": [{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"type": ["VerifiableCredential", "ExampleFoodPreferenceCredential"],
"issuer": "did:example:12345678",
"credentialSubject": {
"favoriteCheese": "Gouda"
},
{ ... }
}],
"proof": [{ ... }]
}
The example below shows a [=verifiable presentation=] that embeds a self-asserted [=verifiable credential=] holding [=claims=] about the [=verifiable presentation=]. It is secured using the same mechanism as the [=verifiable presentation=].
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"type": ["VerifiablePresentation", "ExamplePresentation"],
"id": "urn:uuid:313801ba-24b7-11ee-be02-ff560265cf9b",
"holder": "did:example:12345678",
"verifiableCredential": [{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"type": ["VerifiableCredential", "ExampleAssertCredential"],
"issuer": "did:example:12345678",
"credentialSubject": {
"id": "urn:uuid:313801ba-24b7-11ee-be02-ff560265cf9b",
"assertion": "This VP is submitted by the subject as evidence of a legal right to drive"
},
"proof": { ... }
}],
"proof": { ... }
}
基于[[[#basic-concepts]]]节引入的概念,本节探讨关于[=verifiable credentials=]的更复杂主题。
[=verifiable credentials=]信任模型基于以下期望:
在不存在既有信任关系的情况下,[=holder=]可能有某些带外手段来确定[=issuer=]是否有资格颁发所提供的[=verifiable credential=]。
注意:[=holder=]并不总是需要信任[=issuer=],因为颁发的[=verifiable credential=]可能是关于非[=holder=]的[=subject=]的断言,或关于无人的断言,且[=holder=]可能愿意将此信息中继给[=verifier=]而不对其真实性负责。
This trust model differentiates itself from other trust models by ensuring the following:
[=verifiers=]决定信任哪些[=issuers=]以及用于什么数据或目的,不在本建议书范围内。某些[=issuers=](如知名组织)可能仅凭其声誉就被许多[=verifiers=]信任。某些[=issuers=]和[=verifiers=]可能是某个社区的成员,在该社区中所有成员因成员资格规则而相互信任。某些[=verifiers=]可能信任特定的信任服务提供商,其职责是审查[=issuers=]并将它们列入信任列表(如[[[ETSI-TRUST-LISTS]]] [[?ETSI-TRUST-LISTS]]或Adobe批准的信任列表中规定的那些)。
通过解耦[=issuer=]和[=verifier=]之间的期望,创建了一个更灵活和动态的信任模型,从而增加了市场竞争和客户选择。
有关此信任模型如何与工作组研究的各种威胁模型交互的更多信息,请参见[[[VC-USE-CASES]]] [[VC-USE-CASES]]。
本规范中详述的数据模型不暗示传递信任模型,如更传统的证书颁发机构信任模型所提供的那样。在可验证凭证数据模型中,[=verifier=]要么直接信任[=issuer=],要么不信任。虽然可以使用可验证凭证数据模型构建传递信任模型,但敦促实现者了解证书颁发机构系统所采用的广泛委托信任方式引入的安全弱点。
可验证凭证数据模型的目标之一是实现无许可创新。为此,数据模型需要以多种不同方式进行扩展。数据模型需要:
这种数据建模方法通常被称为开放世界假设,意味着任何实体都可以对任何其他实体做出任何陈述。虽然这种方法似乎与构建简单和可预测的软件系统相冲突,但在开放世界假设下,平衡可扩展性与程序正确性总是比封闭软件系统更具挑战性。
本节余下部分通过一系列示例描述如何同时实现可扩展性和程序正确性。
假设我们从下面显示的[=credential=]开始。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://vc.example/credentials/4643",
"type": ["VerifiableCredential"],
"issuer": "https://issuer.example/issuers/14",
"validFrom": "2018-02-24T05:28:04Z",
"credentialSubject": {
"id": "did:example:abcdef1234567",
"name": "Jane Doe"
}
}
此[=verifiable credential=]声明与`did:example:abcdef1234567`关联的[=entity=]具有值为`Jane Doe`的`name`。
现在假设开发者想要扩展[=verifiable credential=]以存储两个额外信息:内部公司参考号和Jane最喜欢的食物。
首先要做的是创建一个包含两个新术语的JSON-LD上下文,如下所示。
{
"@context": {
"referenceNumber": "https://extension.example/vocab#referenceNumber",
"favoriteFood": "https://extension.example/vocab#favoriteFood"
}
}
创建此JSON-LD上下文后,开发者将其发布到[=verifiers=]在处理[=verifiable credential=]时可以访问的某个位置。假设上述JSON-LD上下文发布在`https://extension.example/my-contexts/v1`,我们可以通过包含上下文并向[=verifiable credential=]添加新的[=properties=]和[=credential=] [=type=]来扩展此示例。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2",
"https://extension.example/my-contexts/v1"
],
"id": "http://vc.example/credentials/4643",
"type": ["VerifiableCredential", "CustomExt12"],
"issuer": "https://issuer.example/issuers/14",
"validFrom": "2018-02-24T05:28:04Z",
"referenceNumber": 83294847,
"credentialSubject": {
"id": "did:example:abcdef1234567",
"name": "Jane Doe",
"favoriteFood": "Papaya"
}
}
此示例演示了以无许可和去中心化的方式扩展可验证凭证数据模型。所示机制还确保以此方式创建的[=verifiable credentials=]提供了防止命名空间冲突和语义歧义的方法。
像这样的动态扩展性模型确实增加了实现负担。为此类系统编写的软件必须根据应用程序的风险配置来确定是否接受带有扩展的[=verifiable credentials=]。某些应用程序可能只接受特定扩展,而高安全性环境可能不接受任何扩展。这些决定由这些应用程序的开发者做出,明确不属于本规范的范畴。
敦促扩展规范作者确保其文档(如JSON-LD上下文)高度可用。使用这些文档的开发者可能使用在无法检索这些文档时产生错误的软件。确保扩展JSON-LD上下文始终可用的策略包括将这些文档与实现捆绑、使用长缓存时间的内容分发网络,或使用基于内容寻址的URL作为上下文。这些方法在附录[[[#contexts-vocabularies-types-and-credential-schemas]]]中有进一步详述。
建议实现者密切关注本规范中的扩展点,如[[[#status]]]、[[[#data-schemas]]]、[[[#securing-mechanisms]]]、[[[#refreshing]]]、[[[#terms-of-use]]]和[[[#evidence]]]各节。虽然本规范不为这些扩展点定义具体实现,但[[[?VC-EXTENSIONS]]]文档提供了开发者可以从这些扩展点使用的非正式、精选扩展列表。
在应用特定词汇表中定义新术语时,词汇表作者应当(SHOULD)遵循[[[?LD-BP]]]中的详细检查列表。具体来说,以下指导尤为重要:
此外,机器可读描述(即JSON-LD上下文文档)必须(MUST)在词汇表的`@context` [=property=]中指定的URL处发布。此上下文必须(MUST)将每个术语映射到其对应URL,可能附带进一步的约束(如属性值的类型)。任何寻求互操作性的实现者也预期发布描述`@context` [=property=]值预期顺序的人类可读文档。
在处理本规范定义的基础JSON-LD上下文文档定义的活动上下文时,合规的基于JSON-LD的处理器会在JSON-LD上下文重新定义任何术语时产生错误。更改现有术语定义的唯一方法是引入一个在该新术语范围内清除活动上下文的新术语。对此功能感兴趣的作者应阅读JSON-LD 1.1规范中关于@protected关键字的内容。
[=conforming document=]不应(SHOULD NOT)在生产中使用`@vocab`特性,因为它可能导致JSON术语冲突,从而与其他应用程序产生语义歧义。相反,为实现适当的互操作性,[=conforming document=]应当(SHOULD)使用定义了其应用使用的所有术语的JSON-LD上下文,如[[[#extensibility]]]节前文所述。如果[=conforming document=]未使用定义所有所用术语的JSON-LD上下文,它必须(MUST)在`@context`属性中将`https://www.w3.org/ns/credentials/undefined-terms/v2`作为最后一个值包含。
对于系统来说,能够手动或自动刷新已过期的[=verifiable credential=]是有用的。有关[=verifiable credentials=]有效期的更多信息,请参见[[[#validity-periods]]]节。本规范定义了`refreshService` [=property=],使[=issuer=]能够包含指向刷新服务的链接。
如果刷新服务面向[=verifier=]或[=holder=](或两者),[=issuer=]可以将其作为[=verifiable credential=]内的元素包含;如果仅面向[=holder=],则包含在[=verifiable presentation=]内。在后一种情况下,这使[=holder=]能够在创建与[=verifier=]共享的[=verifiable presentation=]之前刷新[=verifiable credential=]。在前一种情况下,将刷新服务包含在[=verifiable credential=]内使[=holder=]或[=verifier=]能够执行[=credential=]的未来更新。
刷新服务仅在[=credential=]已过期或[=issuer=]不发布[=credential=]状态信息时预期被使用。建议[=Issuers=]不要在不包含公开信息或其刷新服务未以某种方式受到保护的[=verifiable credential=]中放置`refreshService` [=property=]。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://w3id.org/age/v1"
],
"type": ["VerifiableCredential", "AgeVerificationCredential"],
"issuer": "did:key:z6MksFxi8wnHkNq4zgEskSZF45SuWQ4HndWSAVYRRGe9qDks",
"validFrom": "2024-04-03T00:00:00.000Z",
"validUntil": "2024-12-15T00:00:00.000Z",
"name": "Age Verification Credential",
"credentialSubject": {
"overAge": 21
},
"refreshService": {
"type": "VerifiableCredentialRefreshService2021",
"url": "https://registration.provider.example/flows/reissue-age-token",
"refreshToken": "z2BJYfNtmWRiouWhDrbDQmC2zicUPBxsPg"
}
}
In the example above, the [=issuer=] specifies an automatic `refreshService` that can be used by POSTing the [=verifiable credential=] to the refresh service `url`. Note that this particular verifiable credential is not intended to be shared with anyone except for the original issuer.
Placing a `refreshService` [=property=] in a [=verifiable credential=] so that it is available to [=verifiers=] can remove control and consent from the [=holder=] and allow the [=verifiable credential=] to be issued directly to the [=verifier=], thereby bypassing the [=holder=].
使用条款可由[=issuer=]或[=holder=]用来传达[=verifiable credential=]或[=verifiable presentation=]的颁发条款。[=issuer=]将其使用条款放在[=verifiable credential=]内。[=holder=]将其使用条款放在[=verifiable presentation=]内。本规范定义了`termsOfUse` [=property=]来表达使用条款信息。
`termsOfUse` [=property=]的值可用于告知[=verifier=]以下任何或所有内容:
{
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/undefined-terms/v2"
],
"id": "urn:uuid:08e26d22-8dca-4558-9c14-6e7aa7275b9b",
"type": [
"VerifiableCredential",
"VerifiableAttestation",
"VerifiableTrustModel",
"VerifiableAuthorisationForTrustChain"
],
"issuer": "did:ebsi:zZeKyEJfUTGwajhNyNX928z",
"validFrom": "2021-11-01T00:00:00Z",
"validUntil": "2024-06-22T14:11:44Z",
"credentialSubject": {
"id": "did:ebsi:zvHWX359A3CvfJnCYaAiAde",
"reservedAttributeId": "60ae46e4fe9adffe0bc83c5e5be825aafe6b5246676398cd1ac36b8999e088a8",
"permissionFor": [{
"schemaId": "https://api-test.ebsi.eu/trusted-schemas-registry/v3/schemas/zHgbyz9ajVuSProgyMhsiwpcp8g8aVLFRNARm51yyYZp6",
"types": [
"VerifiableCredential",
"VerifiableAttestation",
"WorkCertificate"
],
"jurisdiction": "https://publications.europa.eu/resource/authority/atu/EUR"
}]
},
"termsOfUse": {
"type": "TrustFrameworkPolicy",
"trustFramework": "Employment&Life",
"policyId": "https://policy.example/policies/125",
"legalBasis": "professional qualifications directive"
},
"credentialStatus": {
"id": "https://api-test.ebsi.eu/trusted-issuers-registry/v5/issuers/did:ebsi:zvHWX359A3CvfJnCYaAiAde/attributes/60ae46e4fe9adffe0bc83c5e5be825aafe6b5246676398cd1ac36b8999e088a8",
"type": "EbsiAccreditationEntry"
},
"credentialSchema": {
"id": "https://api-test.ebsi.eu/trusted-schemas-registry/v3/schemas/zCSHSDwrkkd32eNjQsMCc1h8cnFaxyTXP5ByozyVQXZoH",
"type": "JsonSchema"
}
}
}
In the example above, the [=issuer=] is asserting that the legal basis under which the [=verifiable credential=] has been issued is the "professional qualifications directive" using the "Employment&Life" trust framework, with a specific link to the policy.
This feature is expected to be used by government-issued [=verifiable credentials=] to instruct digital wallets to limit their use to similar government organizations in an attempt to protect citizens from unexpected use of sensitive data. Similarly, some [=verifiable credentials=] issued by private industry are expected to limit use to within departments inside the organization, or during business hours. Implementers are urged to read more about this evolving feature in the appropriate section of the Verifiable Credentials Implementation Guidelines [[?VC-IMP-GUIDE]] document.
[=issuer=]可以包含证据以向[=verifier=]提供[=verifiable credential=]中的额外支持信息。这可供[=verifier=]用于确定其依赖[=verifiable credential=]中声明的信心程度。例如,[=issuer=]可以在颁发[=credential=]之前检查[=subject=]提供的实物文件或执行一系列背景调查。在某些场景中,此信息对[=verifier=]在确定依赖给定[=credential=]的风险时很有用。
本规范定义了`evidence` [=property=]来表达证据信息。
有关本规范如何支持附件和[=credentials=]引用及非凭证数据的信息,请参见[[[#integrity-of-related-resources]]]节。
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json"
],
"id": "http://1edtech.edu/credentials/3732",
"type": [
"VerifiableCredential",
"OpenBadgeCredential"
],
"issuer": {
"id": "https://1edtech.edu/issuers/565049",
"type": "Profile"
},
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"type": "AchievementSubject",
"name": "Alice Smith",
"activityEndDate": "2023-12-02T00:00:00Z",
"activityStartDate": "2023-12-01T00:00:00Z",
"awardedDate": "2024-01-01T00:00:00Z",
"achievement": [{
"id": "urn:uuid:d46e8ef1-c647-419b-be18-5e045d1c4e64",
"type": ["Achievement"],
"name": "Basic Barista Training",
"criteria": {
"narrative": "Team members are nominated for this badge by their supervisors, after passing the Basic Barista Training course."
},
"description": "This achievement certifies that the bearer is proficient in basic barista skills."
}]
},
"evidence": [{
// url to an externally hosted evidence file/artifact
"id": "https://videos.example/training/alice-espresso.mp4",
"type": ["Evidence"],
"name": "Talk-aloud video of double espresso preparation",
"description": "This is a talk-aloud video of Alice demonstrating preparation of a double espresso drink.",
// digest hash of the mp4 video file
"digestMultibase": "uELq9FnJ5YLa5iAszyJ518bXcnlc5P7xp1u-5uJRDYKvc"
}
]
}
In the `evidence` example above, the [=issuer=] is asserting that they have video of the [=subject=] of the [=credential=] demonstrating the achievement.
The `evidence` [=property=] provides information that is different from and information to the securing mechanism used. The `evidence` [=property=] is used to express supporting information, such as documentary evidence, related to the [=verifiable credential=]. In contrast, the securing mechanism is used to express machine-verifiable mathematical proofs related to the authenticity of the [=issuer=] and integrity of the [=verifiable credential=]. For more information about securing mechanisms, see Section [[[#securing-mechanisms]]].
零知识证明是一种安全机制,使[=holder=]能够证明他们持有包含某个值的[=verifiable credential=]而不泄露实际值,例如能够证明个人超过25岁而不透露其生日。本数据模型支持使用零知识证明进行保护。
零知识证明机制使与[=verifiable credentials=]兼容的一些功能成为可能,包括:
创建安全机制的规范作者禁止(MUST NOT)以泄露信息的方式设计它们,使[=verifier=]能够在向不同[=verifiers=]的多个[=verifiable presentations=]之间关联[=holder=]。
并非所有功能都在所有零知识证明机制中得到支持。特定零知识证明机制提供的功能和技术的具体细节,以及将其与[=verifiable credentials=]一起使用的任何规范性要求,将在使用该零知识证明机制保护[=verifiable credentials=]的规范中找到。有关此类规范的示例,请参阅[[[?VC-DI-BBS]]]。
我们注意到,在大多数情况下,为使[=holder=]能够对[=verifiable credentials=]使用零知识机制,[=issuer=]需要以支持这些功能的方式保护[=verifiable credential=]。
下图突出显示了数据模型如何用于以零知识方式颁发和展示[=verifiable credentials=]。
An example of a [=verifiable credential=] and a [=verifiable presentation=] using the [[[?VC-DI-BBS]]] unlinkable selective disclosure securing mechanism is shown below.
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://w3id.org/citizenship/v3"
],
"type": ["VerifiableCredential", "PermanentResidentCard"],
"issuer": {
"id": "did:web:credentials.utopia.example",
"image": "data:image/png;base64,iVBORw0KGgo...YII="
},
"identifier": "83627465",
"name": "Permanent Resident Card",
"description": "Government of Utopia Permanent Resident Card.",
"validFrom": "2024-08-01T00:00:00Z",
"validUntil": "2029-12-01T00:00:00Z",
"credentialSubject": {
"type": ["PermanentResident", "Person"],
"givenName": "JANE",
"familyName": "SMITH",
"gender": "Female",
"image": "data:image/png;base64,iVBORw0KGgoAA...Jggg==",
"residentSince": "2015-01-01",
"lprCategory": "C09",
"lprNumber": "999-999-999",
"commuterClassification": "C1",
"birthCountry": "Arcadia",
"birthDate": "1978-07-17"
},
"proof": {
"type": "DataIntegrityProof",
"verificationMethod": "did:web:playground.alpha.chapi.io#zUC75LjjCLGKRxSissX1nAebRDmY4Bv4T6MAbzgaap9Q8rAGf6SEjc2Hf4nH6bUPDwky3GWoYcUjMCcEqRRQfXEiNwfeDwNYLoeqk1J1W2Ye8vCdwv4fSd8AZ1yS6UoNzcsQoPS",
"cryptosuite": "bbs-2023",
"proofPurpose": "assertionMethod",
"proofValue": "u2V0ChVhQjYs9O7wUb3KRSMaIRX7jmafVHYDPYBLD4ta85_qmuXTBU_t2Ir7pNujwRE6fERsBUEZRSjJjtI-hqOqDs3VvBvH6gd3o2KeUS2V_zpuphPpYQEkapOeQgRTak9lHKSTqEQqa4j2lyHqekEeGvzPlqcHQGFccGifvLUXtP59jCuGJ86HDA9HL5kDzUT6n4Gi50HlYYIzNqhbjIxlqOuxO2IgIppSTWjQGeer34-PmKnOzKX8m_9DHPhif7TUf5uTV4OQWdhb0SxHnJ-CPu_z9FJ5ACekBQhz6YWS0_CY6j_ibucXzeVfZwLv1W47pjbt-l1Vl5VggSn2xVt69Q0GD9mPKpOhkKV_hyOL7i6haf7bq-gOKAwWDZy9pc3N1ZXJtL2lzc3VhbmNlRGF0ZW8vZXhwaXJhdGlvbkRhdGU"
}
}
The example above is a [=verifiable credential=] where the [=issuer=] has enabled a BBS-based unlinkable disclosure scheme to create a base proof that can then be used by the [=holder=] to create a derived proof that reveals only particular pieces of information from the original [=verifiable credential=].
{
@context: "https://www.w3.org/ns/credentials/v2"
type: "VerifiablePresentation",
verifiableCredential: {
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://w3id.org/citizenship/v3"
],
"type": ["VerifiableCredential", "PermanentResidentCard"],
"issuer": {
"id": "did:web:issuer.utopia.example",
"image": "data:image/png;base64,iVBORw0KGgo...YII="
},
"name": "Permanent Resident Card",
"description": "Government of Utopia Permanent Resident Card.",
"validFrom": "2024-08-01T00:00:00Z",
"validUntil": "2029-12-01T00:00:00Z",
"credentialSubject": {
"type": ["PermanentResident", "Person"],
"birthCountry": "Arcadia"
},
"proof": {
type: "DataIntegrityProof",
verificationMethod: "did:web:issuer.utopia.example#zUC75LjjCLGKRxSissX1nAebRDmY4Bv4T6MAbzgaap9Q8rAGf6SEjc2Hf4nH6bUPDwky3GWoYcUjMCcEqRRQfXEiNwfeDwNYLoeqk1J1W2Ye8vCdwv4fSd8AZ1yS6UoNzcsQoPS",
cryptosuite: "bbs-2023",
proofPurpose: "assertionMethod",
proofValue: "u2V0DhVkCkLdnshxHtgeHJBBUGPBqcEooPp9ahgqs08RsoqW5EJFmsi70jqf2X368VcmfdJdYcYJwObPIg5dlyaoBm34N9BqcZ4RlTZvgwX79ivGnqLALC0EqKn2wOj5hRO76xUakfLGIcT4mE-G7CxA1FTs8sRCWy5p6FozelBYiZU2YlhUpJ7pBwelZ9wnlcbj4q-KyxAj5GU2iWp7-FxU-E624DmdT-yvCkAGRRrYej6lMwg7jB9uCHypOXXH2dVZ-jpf74YBaE4rMTxPFh60GN4o3S65F1fMsJbEMLdrXa8Vs6ZSlmveUcY1X7oPr1UIxo17ehVTCjOxWunYqrtLi9cVkYOD2s9XMk1oFVWBB3UY29axXQQXlZVfvTIUsfVc667mnlYbF7a-ko_SUfeY2n3s1DOAap5keeNU0v2KVPCbxA2WGz7UJy4xJv2a8olMOWPKjAEUruCx_dsbyicd-9KGwhYoUEO3HoAzmtI6qXVhMbJKxPrhtcp8hOdD9izVS5ed4CxHNaDGPSopF_MBwjxwPcpUufNNNdQwesrbtFJo0-P-1CrX_jSxKFMle2b3t24UbHRbZw7QnX4OG-SSVucem5jpMXTDFZ8PLFCqXX0zncJ_MQ-_u-liE-MwJu3ZemsXBp1JoB2twS0TqDVzSWR7bpFZKI9_07fKUAmQNSV_no9iAgYRLuPrnnsW1gQgCV-nNqzbcCOpzkHdCqro6nPSATq5Od3Einfc683gm5VGWxIldM0aBPytOymNz7PIZ6wkgcMABMe5Vw46B54ftW-TN5YZPDmCJ_kt7Mturn0OeQr9KJCu7S0I-SN14mL9KtGE1XDnIeR-C_YZhSA3vX4923v1l3vNFsKasqy9iEPHKM0hcogABAQCGAAECBAUGhAMJCgtYUnsiY2hhbGxlbmdlIjoiNGd2OFJyaERPdi1OSHByYlZNQlM1IiwiZG9tYWluIjoiaHR0cHM6Ly9wbGF5Z3JvdW5kLmFscGhhLmNoYXBpLmlvIn0"
}
}
}
上面的[=verifiable presentation=]包含一个[=verifiable credential=],该凭证包含前一个示例中信息的不可关联子集,以及[=verifier=]可用来验证信息来自预期[=issuer=]并绑定到此特定信息交换的派生证明。
敦促实现者理解,表示和处理时间值并不像看起来那么简单,存在各种不明显且在世界不同地区未统一遵守的特殊性。例如:
这些只是说明实际时间(如墙上时钟所示)可能存在于一个地区但不存在于另一个地区的几个例子。因此,敦促实现者使用更具普遍性的时间值,例如锚定到`Z`时区的值,而非受夏令时影响的值。
本规范尝试通过使用[XMLSCHEMA11-2]规范最初建立的`dateTimeStamp`构造来增加普遍认可的日期和时间组合数量,并减少时间值被误解的可能性。为减少不同时区之间的误解,[=conforming documents=]中表达的所有时间值应当(SHOULD)以`dateTimeStamp`格式指定,使用协调世界时(UTC,以值末尾的`Z`表示)或相对于UTC的时区偏移。未正确序列化而没有偏移的时间值必须(MUST)被解释为UTC。有效的相对于UTC的时区偏移示例包括`Z`、`+01:00`、`-08:00`和`+14:00`。有关所有可接受值的正式定义,请参见本节末尾的正则表达式。
时区定义偶尔会被其管辖机构更改。在替换或颁发新的[=verifiable credentials=]时,建议实现者确保本地时区规则的更改不会导致有效性出现意外间隔。例如,考虑`America/Los_Angeles`时区,其原始偏移为UTC-8,并已投票在2024年停止实行夏令时。一个`validUntil`值为`2024-07-12T12:00:00-07:00`的给定[=verifiable credential=]可能会重新颁发为`validFrom`值为`2024-07-12T12:00:00-08:00`,这将产生一小时的间隔,在此期间[=verifiable credential=]将无效。
希望检查`dateTimeStamp`值有效性的实现者可以使用下面提供的正则表达式,该表达式为方便起见从[XMLSCHEMA11-2]规范中复制。为避免疑义,[[XMLSCHEMA11-2]]中的正则表达式是规范性定义。建议实现者注意,并非所有通过下面正则表达式的`dateTimeStamp`值都是有效的时间点。例如,下面的正则表达式允许每月31天,这允许闰年和闰秒以及在不存在这些天的地方出现天数。也就是说,生成`dateTimeStamp`值的现代系统库通常在生成有效`dateTimeStamp`值方面没有错误。正则 expression shown below (minus the whitespace included here for readability), is often adequate when processing library-generated dates and times on modern systems.
-?([1-9][0-9]{3,}|0[0-9]{3})
-(0[1-9]|1[0-2])
-(0[1-9]|[12][0-9]|3[01])
T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))
(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))
[=Verifiable credentials=]旨在作为可靠识别[=subjects=]的手段。虽然认识到基于角色的访问控制(RBAC)和基于属性的访问控制(ABAC)依赖于此识别作为授权[=subjects=]访问资源的手段,但本规范不提供RBAC或ABAC的完整解决方案。在没有配套授权框架的情况下,授权不是本规范的适当用途。
工作组在创建本规范期间确实考虑了授权用例,并正在将该工作作为构建在本规范之上的架构层来推进。
本规范保留了若干[=properties=]作为可能的扩展点。虽然一些实现者表示对这些属性有兴趣,但将其纳入本规范被认为为时过早。需要注意的是,这些属性均非由本规范定义。因此,提醒实现者使用这些属性被视为实验性的。
实现者可以(MAY)使用这些属性,但应当(SHOULD)预期它们和/或其含义在规范化定义过程中会发生变化。实现者不应(SHOULD NOT)在没有公开披露描述其实现的规范的情况下使用这些属性。
In order to avoid collisions regarding how the following properties are used, implementations MUST specify a `type` property in the value associated with the reserved property. For more information related to adding `type` information, see Section [[[#types]]].
| Reserved Property | Description |
|---|---|
| `confidenceMethod` | A property used for specifying one or more methods that a verifier might use to increase their confidence that the value of a property in or of a verifiable credential or verifiable presentation is accurate. The associated vocabulary URL MUST be `https://www.w3.org/2018/credentials#confidenceMethod`. Implementers that are interested in learning more about confidence method, including examples of usage, can refer to the [[[?VC-CONFIDENCE-METHOD]]] specification. |
| `renderMethod` | A property used for specifying one or more methods to render a credential into a visual, auditory, haptic, or other format. The associated vocabulary URL MUST be `https://www.w3.org/2018/credentials#renderMethod`. Implementers that are interested in learning more about render method, including examples of usage, can refer to the [[[?VC-RENDER-METHOD]]] specification. |
An unofficial list of specifications that are associated with the extension points defined in this specification, as well as the reserved extension points defined in this section, can be found in the [[[?VC-EXTENSIONS]]]. Items in the directory that refer to reserved extension points SHOULD be treated as experimental.
存在许多数字凭证格式不原生使用本文档提供的数据模型,但与本规范中的许多概念一致。在发布时,这些数字凭证格式的示例包括JSON Web Tokens(JWT)、CBOR Web Tokens(CWT)、JSON高级电子签名(JAdES)、ISO-18013-5:2021(mDL)、AnonCreds、Gordian Envelopes和可验证链式数据容器(ACDC)。
如果概念上一致的数字凭证格式可以根据本节提供的规则转换为[=conforming document=],则它们被视为"与W3C可验证凭证生态系统兼容"。建议规范作者在记录实现与可验证凭证生态系统兼容性的转换时遵循以下规则。转换规范——
rules when documenting transformations that enable compatibility with the Verifiable Credentials ecosystem. The transformation specification —建议读者注意,只有当数字凭证是[=conforming document=]并使用至少一种安全机制(如本规范中各自的要求所述)时,才被视为与W3C可验证凭证生态系统兼容。虽然一些社区可能将一些不是[=conforming documents=]的数字凭证格式称为"可验证凭证",但这样做并不能使该数字凭证符合本规范。例如,尽管SD-JWT-VC [[?SD-JWT-VC]]规范中使用了字母"VC",该规范明确声明它与W3C可验证凭证不兼容。
在表达[=verifiable credentials=]时(例如在[=presentation=]中),确保一个[=verifiable credential=]中的数据不会被误认为另一个[=verifiable credential=]中的相同数据是很重要的。例如,如果有两个[=verifiable credentials=],每个都包含以下形式的对象:`{"type": "Person", "name": "Jane Doe"}`,则无法判断一个对象是否在描述与另一个对象相同的人。换言之,在未确认它们讨论的是相同实体和/或属性的情况下合并两个[=verifiable credentials=]之间的数据,可能导致数据集损坏。
为确保来自不同[=verifiable credentials=]的数据不会意外混合,使用verifiable credential graph的概念来封装每个[=verifiable credential=]。对于简单的[=verifiable credentials=](即JSON-LD文档包含单个凭证及可能关联的证明时),此图是[=default graph=]。对于[=presentations=],与[=presentation=]的`verifiableCredential`属性关联的每个值是一个单独的[=named graph=],类型为VerifiableCredentialGraph,包含单个[=verifiable credential=]或包封的可验证凭证。
Using these [=graphs=] has a concrete effect when performing JSON-LD processing, which properly separates graph node identifiers in one graph from those in another graph. Implementers that limit their inputs to application-specific JSON-LD documents will also need to keep this in mind if they merge data from one [=verifiable credential=] with data from another, such as when the `credentialSubject.id` is the same in both [=verifiable credentials=], but the object might contain objects of the "Jane Doe" form described in the previous paragraph. It is important to not merge objects that seem to have similar properties but do not contain an `id` property that uses a global identifier, such as a URL.
如[[[#securing-mechanisms]]]节所述,实现者在保护[=conforming document=]时可以使用多种策略。为最大化实用性和互操作性,本节为希望编写保护[=conforming documents=]新方式的规范作者提供指导。
安全机制规范必须(MUST)记录为[=conforming documents=]提供内容完整性保护的规范性算法。算法可以(MAY)是通用的,并且可以(MAY)用于保护[=conforming documents=]以外的数据。
Securing mechanism specifications MUST provide a verification algorithm that returns the information in the [=conforming document=] that has been secured, in isolation, without including any securing mechanism information, such as `proof` or JOSE/COSE header parameters and signatures. Verification algorithms MAY return additional information that might be helpful (for example, during validation or for debugging purposes), such as details of the securing mechanism. A verification algorithm MUST provide an interface that receives a media type ([=string=] |inputMediaType|) and input data ([=byte sequence=] or [=map=] |inputData|). Securing mechanism specifications MAY provide algorithms and interfaces in addition to the ones specified in this document. The verification algorithm returns a verification result with at least the following [=struct/items=]:
Securing mechanism specifications SHOULD provide integrity protection for any information referenced by a URL that is critical to validation. Mechanisms that can achieve this protection are discussed in Section [[[#integrity-of-related-resources]]] and Section [[[#base-context]]].
A securing mechanism specification that creates a new type of [=embedded proof=] MUST specify a [=property=] that relates the [=verifiable credential=] or [=verifiable presentation=] to a [=proof graph=]. The requirements on the securing mechanism are as follow:
The last requirement means that the securing mechanism secures the [=default graph=] and, for [=verifiable presentations=], each [=verifiable credential=] of the presentation, together with their respective [=proof graphs=]. See also [[[#info-graph-vp]]] or [[[#info-graph-vp-mult-creds]]].
The `proof` property as defined in [[VC-DATA-INTEGRITY]] MAY be used by the embedded securing mechanism.
Securing mechanism specifications SHOULD register the securing mechanism in the Securing Mechanisms section of the [[[?VC-EXTENSIONS]]] document.
There are multiple acceptable securing mechanisms, and this specification does not mandate any particular securing mechanism for use with [=verifiable credentials=] or [=verifiable presentations=]. The Working Group that produced this specification did standardize two securing mechanism options, which are: [[[VC-DATA-INTEGRITY]]] [[VC-DATA-INTEGRITY]] and [[[VC-JOSE-COSE]]] [[VC-JOSE-COSE]]. Other securing mechanisms that are known to the community can be found in the Securing Mechanisms section of the [[[?VC-EXTENSIONS]]] document.
[[[#core-data-model]]]、[[[#basic-concepts]]]和[[[#advanced-concepts]]]中描述的数据模型是[=verifiable credential=]或[=verifiable presentation=]的规范结构表示。所有语法都是该数据模型在特定格式中的表示。本节指定数据模型如何在JSON-LD中序列化为`application/vc`和`application/vp`,分别是[=verifiable credentials=]和[=verifiable presentations=]的基础媒体类型。虽然语法映射仅提供了JSON-LD,但应用和服务可以使用任何能够映射回`application/vc`或`application/vp`的其他数据表示语法(如XML、YAML或CBOR)。由于[=verification=]和[=validation=]要求是根据数据模型定义的,所有序列化语法都必须确定性地转换为数据模型以进行处理、[=validation=]或比较。
本规范中属性值的预期元数及其结果持有这些值的数据类型可能因属性而异。如果存在,以下属性表示为单个值:`id`([[[#identifiers]]]节)、`issuer`([[[#issuer]]]节)和`validFrom`/`validUntil`([[[#validity-period]]]节)。所有其他属性(如果存在)表示为单个值或值数组。
本规范使用[[[JSON-LD11]]]来序列化本规范中描述的数据模型。JSON-LD很有用,因为它能够表达[=verifiable credentials=]所基于的基于图的数据模型、机器可读语义,并且在扩展数据模型时也很有用(参见[[[#core-data-model]]]和[[[#extensibility]]])。
JSON-LD是一种基于JSON的格式,用于序列化链接数据。链接数据使用资源描述框架(RDF)[[?RDF11-CONCEPTS]]建模。RDF是一种对陈述图进行建模的技术。每个陈述是一个单独的主体→属性→值(也称为实体→属性→值)关系,在本规范中称为claim。JSON-LD是一种使用惯用JSON表达RDF的技术,使熟悉JSON的开发者能够编写将RDF作为JSON消费的应用。更多细节请参见JSON-LD与RDF的关系。
通常,本文档中描述的数据模型和语法使开发者能够在很大程度上将[=verifiable credentials=]视为JSON文档,允许他们将示例(经少量修改)复制粘贴到其软件系统中。这种方法的设计目标是提供低入门门槛,同时仍确保异构软件系统集合之间的全球互操作性。本节描述了一些用于实现这一目标的JSON-LD特性,大多数开发者可能不会注意到这些特性,但实现者可能对其细节感兴趣。本规范使用的[[[JSON-LD11]]]中最值得注意的特性包括:
为增加互操作性,本规范限制了数据模型的JSON-LD表示的使用。使用`application/vc`或`application/vp`媒体类型的数据模型的所有表示必须(MUST)使用JSON-LD 紧凑文档形式。
如[[[#type-specific-credential-processing]]]节所详述,某些软件应用可能不执行通用JSON-LD处理。建议[=conforming documents=]的作者注意,如果`@context`值中的JSON-LD关键字用于全局影响[=verifiable credential=]或[=verifiable presentation=]中的值(例如设置`@base`或`@vocab`关键字中的一个或两个),互操作性可能会降低。例如,设置这些值可能会在执行[=type-specific credential processing=]且不期望`@context`值中表达`@base`和/或`@vocab`值的实现中触发对`@context`值的JSON Schema测试失败。
为增加互操作性,敦促[=conforming document=]作者不使用在执行[=type-specific credential processing=]时不易检测的JSON-LD特性。这些特性包括:
While this specification cautions against the use of `@vocab`, there are legitimate uses of the feature, such as to ease experimentation, development, and localized deployment. If an application developer wants to use `@vocab` in production, which is advised against to reduce term collisions and leverage the benefits of semantic interoperability, they are urged to understand that any use of `@vocab` will disable reporting of "undefined term" errors, and later use(s) will override any previous `@vocab` declaration(s). Different values of `@vocab` can change the semantics of the information contained in the document, so it is important to understand whether and how these changes will affect the application being developed.
使用[[[JSON-LD11]]]时,列表、数组甚至列表的列表都是可能的。我们鼓励那些在需要列表和数组的用例中需要RDF语义的人遵循JSON-LD 1.1中的列表指南。
In general, a JSON array is ordered, while a JSON-LD array is not ordered unless that array uses the `@list` keyword.
While it is possible to use this data model by performing [=type-specific credential processing=], those who do so and make use of arrays need to be aware that unless the above guidance is followed, the order of items in an array are not guaranteed in JSON-LD. This might lead to unexpected behavior.
If JSON structure or ordering is important to your application, we recommend you mark such elements as `@json` via an `@context` that is specific to your use case. An example of such a declaration is shown below.
{
"@context":
{
"matrix": {
"@id": "https://website.example/vocabulary#matrix",
"@type": "@json"
}
}
}
When the context shown above is used in the example below, by including the `https://website.example/matrix/v1` context in the `@context` property, the value in `credentialSubject.matrix` retains its JSON semantics; the exact order of all elements in the two dimensional matrix is preserved.
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2",
"https://website.example/matrix/v1"
],
"id": "http://university.example/credentials/1872",
"type": [
"VerifiableCredential",
"ExampleMatrixCredential"
],
"issuer": "https://university.example/issuers/565049",
"validFrom": "2010-01-01T19:23:24Z",
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"matrix": [
[1,2,3,4,5,6,7,8,9,10,11,12],
[1,1,1,1,1,1,1,1,0,0,0,0],
[0,0,1,1,1,1,1,1,1,0,0,0]
]
}
}
如[[RFC6838]]中定义的媒体类型标识用于表达[=verifiable credential=]的语法以及其他有用的处理指南。
用于表达本规范中数据模型的语法应当(SHOULD)由媒体类型标识,并且在定义或使用[=verifiable credentials=]的媒体类型时应当(SHOULD)遵循本节概述的约定。
有两种与核心数据模型关联的媒体类型,列于[[[#iana-considerations]]]节中:`application/vc`和`application/vp`。
`application/vc`和`application/vp`媒体类型不暗示任何特定安全机制,但旨在与安全机制结合使用。需要应用安全机制来保护这些媒体类型的完整性。不要假设内容的安全性,无论用于通信的媒体类型是什么。
有时,开发者或系统可能使用较低精度的媒体类型来传递[=verifiable credentials=]或[=verifiable presentations=]。使用较低精度媒体类型的一些原因包括:
Implementers are urged to not raise errors when it is possible to determine the intended media type from a payload, provided that the media type used is acceptable in the given protocol. For example, if an application only accepts payloads that conform to the rules associated with the `application/vc` media type, but the payload is tagged with `application/json` or `application/ld+json` instead, the application might perform the following steps to determine whether the payload also conforms to the higher precision media type:
Whenever possible, implementers are advised to use the most precise (the highest precision) media type for all payloads defined by this specification. Implementers are also advised to recognize that a payload tagged with a lower precision media type does not mean that the payload does not meet the rules necessary to tag it with a higher precision type. Similarly, a payload tagged with a higher precision media type does not mean that the payload will meet the requirements associated with the media type. Receivers of payloads, regardless of their associated media type, are expected to perform appropriate checks to ensure that payloads conform with the requirements for their use in a given system.
HTTP clients and servers use media types associated with [=verifiable credentials=] and [=verifiable presentations=] in accept headers and when indicating content types. Implementers are warned that HTTP servers might ignore the accept header and return another content type, or return an error code such as `415 Unsupported Media Type`.
由于JSON可用于表达不同种类的信息,特定JSON文档的消费者只有在拥有将其与其他可能表达进行上下文化和消歧义的信息时,才能正确解释作者的意图。辅助此解释的信息可以完全在JSON文档之外,也可以从文档内链接。紧凑的JSON-LD文档包含`@context`属性,内部表达或链接到上下文信息以表达claims。这些特性使通用处理器能够将JSON-LD文档从一个上下文转换为另一个上下文,但当消费者收到已使用他们期望的上下文和形状的JSON-LD文档时,这不是必需的。JSON-LD文档的作者(如verifiable credentials的issuers)需要提供正确的JSON-LD上下文并遵循这些规则以促进互操作性。
以下文本帮助消费者理解如何确保JSON-LD文档以其应用已经理解的上下文和形状表达,从而无需转换即可消费其内容。值得注意的是,这并不意味着消费者完全不需要理解任何上下文;相反,消费应用只需要理解选定的一组上下文和文档形状,而不是其他的。颁发者可以发布上下文和关于其verifiable credentials的信息,以帮助不使用通用处理器的消费者,就像对任何其他JSON格式数据一样。
General JSON-LD processing is defined as a mechanism that uses a JSON-LD software library to process a [=conforming document=] by performing various transformations. Type-specific credential processing is defined as a lighter-weight mechanism for processing [=conforming documents=], that doesn't require a JSON-LD software library. Some consumers of [=verifiable credentials=] only need to consume credentials with specific types. These consumers can use type-specific credential processing instead of generalized processing. Scenarios where type-specific credential processing can be desirable include, but are not limited to, the following:
That is, [=type-specific credential processing=] is allowed as long as the document being consumed or produced is a [=conforming document=].
If [=type-specific credential processing=] is desired, an implementer is advised
to follow this rule:
Ensure that all values associated with a `@context` property are in the expected
order, the contents of the context files match known good cryptographic hashes
for each file, and domain experts have deemed that the contents are appropriate
for the intended use case.
Using static context files with a JSON Schema is one acceptable approach to implementing the rule above. This can ensure proper term identification, typing, and order, when performing [=type-specific credential processing=].
The rule above guarantees semantic interoperability between the two processing mechanisms for mapping literal JSON keys to URIs via the `@context` mechanism. While [=general JSON-LD processing=] can use previously unseen `@context` values provided in its algorithms to verify that all terms are correctly specified, implementations that perform [=type-specific credential processing=] only accept specific `@context` values which the implementation is engineered ahead of time to understand, resulting in the same semantics without invoking any JSON-LD APIs. In other words, the context in which the data exchange happens is explicitly stated for both processing mechanisms by using `@context` in a way that leads to the same [=conforming document=] semantics.
本节包含实现可用于执行常见操作(如[=verification=])的算法。以算法形式表述的合规性要求使用[[[INFRA]]] [[INFRA]]中的规范性概念。有关实现要求的更多指导,请参见[[[INFRA]]]中关于算法合规性的章节。
建议实现者注意,本节中的算法包含实现用于测试与本规范合规性的最低限度检查集。预期实现提供额外检查以报告有助于开发者调试潜在问题的有用警告。同样,实现可能提供额外检查以报告新类型的错误来阻止有害内容。这些额外检查中的任何一项都可能被整合到本规范的未来版本中。
本节包含[=conforming verifier implementations=]在验证[=verifiable credential=]或[=verifiable presentation=]时必须(MUST)运行的算法。此算法接受媒体类型([=string=] |inputMediaType|)和安全数据([=byte sequence=] |inputData|)并返回包含以下内容的[=map=]:
验证算法如下:
验证安全机制状态和验证输入文档是[=conforming document=]的步骤可以(MAY)以不同于上面提供的顺序执行,只要实现对相同的无效输入返回错误即可。实现可以(MAY)产生与上述不同的错误。
当实现在处理文档时检测到异常,可以使用ProblemDetails对象向其他软件系统报告该问题。这些对象的接口遵循[[RFC9457]]来编码数据。[=ProblemDetails=]对象由以下属性组成:
本规范定义了以下问题描述类型:
实现可以(MAY)通过指定额外类型或属性来扩展[=ProblemDetails=]对象。有关使用此机制的进一步指导,请参见[[RFC9457]]中的扩展成员节。
本节详细说明了将可验证凭证数据模型部署到生产环境中的一般隐私注意事项和具体隐私影响。
重要的是要认识到隐私存在一个从假名到强身份识别的范围。根据不同的用例,人们对于愿意提供的信息以及可从中推导出的信息有不同的接受程度。
隐私解决方案是针对特定用例的。例如,许多人在购买酒精时更愿意保持匿名,因为法规只需要验证购买者是否超过特定年龄。相比之下,在填写由医疗专业人员为患者开具的处方时,药房在法律上被要求更强地识别处方者和患者的身份。没有单一的隐私方法适用于所有用例。
即使那些在购买酒精时希望保持匿名的人也可能需要提供带照片的身份证件以适当地向商家保证。商家可能不需要知道你的姓名或任何其他细节,只需知道你超过了特定年龄,但在许多情况下,简单的年龄证明可能不足以满足法规要求。
可验证凭证数据模型力求支持完整的隐私范围,并且不对任何特定交易的正确匿名级别采取哲学立场。以下各节将指导希望避免对隐私具有敌意的特定场景的实施者。
在本规范描述的生态系统中存在各种信任关系。使用网络浏览器的个人信任网络浏览器(也称为用户代理)会通过不将其个人信息上传到数据经纪商来维护该信任;类似地,在本规范描述的生态系统中担任角色的实体信任代表这些角色运行的软件。示例包括以下内容:
上述示例并非详尽无遗,担任这些角色的用户还可以期望其所使用的软件提供各种其他功能。简而言之,用户期望软件以用户的最大利益为出发点运行;任何违反此期望的行为都会破坏信任,并可能导致软件被更值得信赖的替代品所取代。强烈鼓励实施者创建保护用户信任的软件。此外,还鼓励他们包含审计功能,使用户或受信任的第三方能够验证软件是否按照其最佳利益运行。
建议读者注意,某些软件(如为单个[=verifier=]和多个[=holders=]提供服务的网站)可能同时作为两种角色的用户代理,但可能并不总是能够同时以所有各方的最佳利益运行。例如,假设一个网站检测到多个[=holders=]中存在欺诈性[=verifiable credential=]使用的企图。在这种情况下,它可能会向[=verifier=]报告此类异常,这可能被认为不符合所有[=holders'=]的最佳利益,但符合[=verifier=]和任何未进行此类违规行为的[=holders=]的最佳利益。当软件以这种方式运行时,必须(MUST)通过网站使用政策等机制明确说明该软件是在为谁的最佳利益运行。
与存储在 `credential.credentialSubject` 属性中的[=verifiable credentials=]相关联的数据,在与[=verifiers=]共享时容易受到隐私侵犯。个人身份数据,如政府颁发的标识符、邮寄地址或全名,可以很容易地用于确定、跟踪和关联[=entity=]。即使看起来不是个人可识别的信息,例如出生日期和邮政编码的组合,也具有强大的关联和去匿名化能力。
强烈建议[=holders=]使用的软件的实施者在[=holders=]共享具有此类特征的数据时向其发出警告。强烈建议[=Issuers=]在可能的情况下提供保护隐私的[=verifiable credentials=]——例如,颁发 `ageOver` [=verifiable credentials=]而不是 `dateOfBirth` [=verifiable credentials=],用于[=verifier=]希望确定[=entity=]是否至少18岁时的场景。
由于[=verifiable credential=]通常包含个人可识别信息(PII),强烈建议实施者在存储和传输[=verifiable credentials=]时使用保护数据免受不应访问者访问的机制。可考虑的机制包括传输层安全性(TLS)或其他在传输中加密数据的方式,以及在[=verifiable credential=]静止时保护数据的加密或访问控制机制。
一般而言,建议个人假设[=verifiable credential=](与大多数实体凭证一样)在共享时会泄露个人可识别信息。为了对抗此类泄露,[=verifiable credentials=]及其保护机制需要经过仔细设计以防止关联。专门设计用于防止个人可识别信息泄露的[=Verifiable credentials=]是可用的。鼓励个人和实施者选择这些凭证类型,而不是那些未设计为保护个人可识别信息的类型。
[=Verifiable credentials=]可能包含长期标识符,这些标识符可用于关联个人。这些标识符包括[=subject=]标识符、电子邮件地址、政府颁发的标识符、组织颁发的标识符、地址、医疗健康数据以及许多其他长期标识符。鼓励[=holders=]使用的软件的实施者检测[=verifiable credentials=]中可用于关联个人的标识符,并在[=holders=]共享此信息之前向其发出警告。本节其余部分详细阐述了与使用长期标识符相关的指南。
[=Verifiable credentials=]的[=Subjects=]使用 `id` 属性进行标识,如 [[[#identifiers]]] 节中所定义并在 `credentialSubject.id` 属性等位置中使用。用于标识[=subject=]的标识符在长期使用或跨多个网络域使用时会产生更大的关联风险。属于此类别的其他类型的标识符包括电子邮件地址、政府颁发的标识符和组织颁发的标识符。
类似地,披露[=credential=]标识符(如[[[#example-use-of-the-id-property]]]中所示)可能导致多个[=verifiers=],或[=issuer=]和[=verifier=]串通关联[=holder=]的情况。
旨在减少关联的[=Holders=]被鼓励使用来自支持在[=verifiable presentation=]中选择性披露关联标识符的[=issuers=]的[=verifiable credentials=]。此类方法期望[=holder=]生成标识符,甚至可能允许通过盲签名等技术对[=issuer=]隐藏标识符,同时仍将标识符嵌入并签署在[=verifiable credential=]中。
建议[=Securing mechanism=]规范的作者通过设计其技术来避免使用无法选择性披露的关联标识符,从而避免启用基于标识符的关联。
如果[=verifiable credentials=]系统中需要强抗关联属性,则标识符必须(MUST)满足以下一个或多个标准:
[=verifiable credential=]的内容使用[=securing mechanism=]进行保护。当表示保护机制的值在多个会话或域中保持不变时,会产生更大的关联风险。以下是这些值的示例:
当需要强抗关联属性时,鼓励[=issuers=]生成签名值和元数据可以为每个[=verifiable presentation=]重新生成的[=verifiable credentials=]。这可以通过使用支持不可链接披露的技术来实现,例如 [[[?VC-DI-BBS]]] 规范。在可能的情况下,鼓励[=verifiers=]优先使用该技术的[=verifiable presentations=],以增强[=holders=]和[=subjects=]的隐私。
即使使用不可链接的签名,[=verifiable credential=]也可能包含其他破坏加密技术抗关联属性的信息。请参见 [[[#personally-identifiable-information]]]、[[[#identifier-based-correlation]]]、[[[#metadata-based-correlation]]]、[[[#correlation-during-validation]]] 以及 [[[#privacy-considerations]]] 的大多数其他小节。
不同的扩展点(如 [[[#basic-concepts]]] 节和 [[[#advanced-concepts]]] 节中描述的那些),如果相对较少的[=issuers=]使用特定的扩展类型或类型组合,可能会无意地或不希望地作为关联机制。例如,使用特定民族国家独有的某些加密方法、特定司法管辖区特有的撤销格式,或特定地区使用的凭证类型,可以作为降低[=holder=]在向[=verifier=]选择性披露信息时可能期望的假名性的机制。
鼓励[=Issuers=]在颁发用于假名使用的[=verifiable credentials=]时,通过限制可能降低[=holder's=]假名性的扩展类型来最小化基于元数据的关联风险。具有全球采用率的凭证类型、扩展和技术配置文件最为可取,其次是具有全国使用的类型;仅具有本地使用的类型最不可取。
存在[=verifiable credentials=]之外的机制在互联网和万维网上跟踪和关联个人。这些机制包括互联网协议(IP)地址跟踪、网络浏览器指纹识别、永久 Cookie、广告网络跟踪器、移动网络位置信息和应用内全球定位系统(GPS)API。使用[=verifiable credentials=]无法阻止使用这些其他跟踪技术;相反,将这些技术与[=verifiable credentials=]一起使用可以揭示新的可关联信息。例如,出生日期与 GPS 位置的组合可以强烈地跨多个网站关联个人。
尊重隐私的系统应当(SHOULD)旨在防止其他跟踪技术与[=verifiable credentials=]的结合。在某些情况下,可能需要在代表[=holder=]传输[=verifiable credentials=]的设备上禁用跟踪技术。
遗忘 HTTP 协议 [[?RFC9458]] 是实施者在获取与[=verifiable credential=]或[=verifiable presentation=]相关联的外部资源时可以考虑使用的一种机制。遗忘 HTTP 允许客户端向源服务器发出多个请求,而该服务器无法将这些请求与该客户端关联,甚至无法确定这些请求来自同一个客户端,同时只对用于转发消息的节点给予有限的信任。遗忘 HTTP 是一种可以减少设备跟踪和指纹识别可能性的隐私保护机制。以下是遗忘 HTTP 如何使生态系统参与者受益的一些具体示例。
鼓励[=Issuers=]将[=verifiable credential=]中包含的信息限制在预期目的所需的最小集合内,以便接收者可以在各种情况下使用它们而不会披露超出必要的个人可识别信息(PII)。避免在[=verifiable credential=]中放置 PII 的一种方法是使用满足[=verifiers=]需求而不提供关于[=subject=]过于具体信息的抽象[=property=]。
例如,本文档使用 `ageOver` [=property=]而不是具体的出生日期,后者代表更敏感的 PII。如果特定市场中的零售商通常要求购买者超过某一年龄,则在该市场中受信任的[=issuer=]可能会选择提供声明[=subjects=]已满足该要求的[=verifiable credentials=],而不是提供包含关于客户生日的[=claims=]的[=verifiable credentials=]。这种做法使个人客户能够在不披露超出必要的 PII 的情况下进行购买。
当在一个上下文中披露的信息泄露到另一个上下文中时,就会发生隐私侵犯。防止此类侵犯的一个公认的最佳实践是,[=verifiers=]将请求和接收的信息限制在特定交易所绝对必要的最低限度。包括美国的《健康保险可携性和责任法案》(HIPAA)和欧盟的《通用数据保护条例》(GDPR)在内的多个司法管辖区的法规都要求这种数据最小化方法。
对于[=verifiable credentials=],对[=issuers=]而言,数据最小化意味着将[=verifiable credential=]的内容限制在潜在[=verifiers=]预期使用所需的最低限度。对于[=verifiers=]而言,数据最小化意味着限制访问服务所请求或要求的信息范围。
例如,包含驾驶员身份证号、身高、体重、生日和家庭住址的驾驶执照以[=verifiable credential=]表达时,包含的信息超过了确定该人是否超过特定年龄所必需的范围。
[=issuers=]的最佳实践是原子化信息或使用允许[=selective disclosure=]的保护机制。例如,驾驶执照的[=issuer=]可以颁发包含驾驶执照上出现的每个属性的[=verifiable credential=],并允许[=holder=]有选择性地披露每个属性。它也可以颁发更抽象的[=verifiable credentials=](例如,仅包含 `ageOver` 属性的[=verifiable credential=])。一种可能的适应方案是[=issuers=]提供安全的 HTTP 端点用于检索一次性[=bearer credentials=],以促进[=verifiable credentials=]的假名使用。发现这不切实际或不安全的实施者可以考虑使用[=selective disclosure=]方案,以消除对证明时对[=issuers=]的依赖并降低[=issuers=]进行时间关联的风险。
敦促[=Verifiers=]仅请求特定交易发生所严格必需的信息。这至少有两个重要原因:
鼓励[=holders=]使用的软件的实施者披露[=verifier=]请求的信息,允许[=holder=]拒绝共享对交易不必要的特定信息。还建议[=holders=]使用的软件的实施者让[=holders=]访问与[=verifiers=]共享的信息日志,使[=holders=]能够在其认为受到信息过度索取或被胁迫共享超出特定交易所需的更多信息时向有关部门提供此信息。
虽然可以实践最小披露原则,但对于特定用例,在单次会话或多次会话中可能无法避免对个人的强身份识别。本文档的作者无法充分强调在现实世界场景中满足此原则的困难程度。
不记名凭证是一种增强隐私的信息(如音乐会门票),它使其[=holder=]有权获得特定资源而无需[=holder=]透露敏感信息。在低风险场景中,实体通常在多个[=holders=]出示相同的[=verifiable credential=]不令人担忧或不会导致重大经济或声誉损失的情况下使用不记名凭证。
作为[=bearer credentials=]的[=Verifiable credentials=]是通过不指定[=subject=]标识符来实现的,该标识符使用嵌套在 `credentialSubject` [=property=]中的 `id` [=property=]表达。例如,以下[=verifiable credential=]是一个[=bearer credential=]:
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://www.w3.org/ns/credentials/examples/v2"
],
"id": "http://university.example/credentials/temporary/28934792387492384",
"type": ["VerifiableCredential", "ExampleDegreeCredential"],
"issuer": "https://university.example/issuers/14",
"validFrom": "2017-10-22T12:23:48Z",
"credentialSubject": {
// note that the 'id' property is not specified for bearer credentials
"degree": {
"type": "ExampleBachelorDegree",
"name": "Bachelor of Science and Arts"
}
}
}
虽然[=bearer credentials=]增强隐私,但[=issuers=]仍需在设计中注意避免无意中透露比[=bearer credential=]的[=holder=]预期更多的信息。例如,在多个站点重复使用相同的[=bearer credential=]可以使这些站点串通非法跟踪或关联[=holder=]。类似地,看似非身份识别的信息(如出生日期和邮政编码)在同一[=bearer credential=]或会话中一起使用时可以统计地识别个人。
[=bearer credentials=]的[=Issuers=]应当(SHOULD)确保[=bearer credentials=]提供的隐私增强效益:
如果[=holders=]的软件检测到已颁发或请求包含敏感信息的[=bearer credentials=],或者两个或更多[=bearer credentials=]在一个或多个会话中的组合构成关联风险,应当(SHOULD)向其发出警告。虽然检测所有关联风险可能是不可能的,但某些风险确实是可以检测到的。
[=Verifiers=]不应当(SHOULD NOT)请求已知携带可用于非法关联[=holder=]的信息的[=bearer credentials=]。
在处理[=verifiable credentials=]时,[=verifiers=]在依赖相关[=claims=]之前会对其进行评估。此评估可以以任何期望的方式进行,只要满足执行验证的[=verifier=]的要求即可。许多验证者将执行附录 [[[#validation]]] 中列出的检查以及各种特定的业务流程检查,例如:
执行这些检查的过程可能导致信息泄露,从而导致[=holder=]的隐私侵犯。例如,一个简单的操作(如检查配置不当的撤销列表)可以通知[=issuer=]某个特定企业可能正在与[=holder=]互动。这可能使[=issuers=]串通在个人不知情的情况下关联他们。
敦促[=Issuers=]不要在[=verification=]过程中使用可能导致隐私侵犯的机制(如每个[=credential=]唯一的[=credential=]撤销列表)。向[=holders=]提供软件的组织应当(SHOULD)在[=credentials=]包含可能在验证过程中导致隐私侵犯的信息时发出警告。敦促[=Verifiers=]考虑拒绝产生隐私侵犯或启用低于标准隐私实践的[=credentials=]。
当[=holder=]从[=issuer=]接收[=verifiable credential=]时,[=verifiable credential=]需要存储在某处(例如,存储在[=credential repository=]中)。[=Holders=]需要意识到[=verifiable credential=]中的信息可能是敏感的且高度个性化的,使其成为数据挖掘的主要目标。提供"免费"存储[=verifiable credentials=]服务的服务可能会挖掘个人数据并将其出售给对构建个人和组织的个性化档案感兴趣的组织。
[=Holders=]需要了解其[=credential repository=]的服务条款,特别是为那些将[=verifiable credentials=]存储在服务提供商处的人提供的关联和数据挖掘保护措施。
一些有效的数据挖掘和画像缓解措施包括使用:
除上述缓解措施外,民间社会和监管参与供应商分析和审计可以帮助确保为受不符合其最佳利益的做法影响的个人制定和执行法律保护措施。
拥有关于同一[=subject=]的两条信息通常会揭示出比这两条信息的组合更多的关于[=subject=]的内容,即使这些信息是通过不同渠道传递的。聚合[=verifiable credentials=]构成隐私风险,生态系统中的所有参与者都需要意识到数据聚合的风险。
例如,假设两个[=bearer credentials=](一个用于电子邮件地址,一个声明[=holder=]超过 21 岁)在多个会话中提供给同一[=verifier=]。信息的[=verifier=]现在拥有一个唯一标识符(电子邮件地址)以及该个人的年龄相关("超过 21 岁")信息。现在很容易为[=holder=]创建个人档案,随着时间推移信息泄露而不断添加更多信息来构建它。此类[=credentials=]的聚合也可以由相互串通的多个站点执行,导致隐私侵犯。
从技术角度来看,防止信息聚合是一个具有挑战性的隐私问题。虽然新的加密技术(如零知识证明)正在被提出作为聚合和关联问题的解决方案,但长期标识符和浏览器跟踪技术的存在击败了即使是最现代的加密技术。
关联或聚合的隐私影响的解决方案往往不是技术性的,而是政策驱动的。因此,如果[=holder=]希望避免其信息的聚合,他们需要在传输的[=verifiable presentations=]中表达这一点,并由接收其[=verifiable presentations=]的[=holders=]和[=verifiers=]来遵守。
尽管所有相关方尽最大努力保障隐私,使用[=verifiable credentials=]仍可能导致去匿名化和隐私丧失。当以下任何情况发生时,可能会出现这种关联:
部分可以通过以下方式缓解这种去匿名化和隐私丧失:
不幸的是,这些缓解技术并不总是实用的,甚至与必要使用不兼容。有时,关联是一项需求。
例如,在某些处方药监控计划中,监控处方使用是一项要求。执法实体需要能够确认个人没有欺骗系统以获取受管制物质的多次处方。这种关联处方使用的法定或监管需求凌驾于个人隐私关切之上。
[=Verifiable credentials=]也将被用于有意跨服务关联个人。例如,当使用共同角色登录多个服务时,每个服务上的所有活动都有意地与同一个人关联。只要这些服务以预期的方式使用关联,这就不是隐私问题。
与使用[=verifiable credentials=]相关的隐私侵犯发生在这些[=verifiable credentials=]的出示产生非预期或意外的关联时。
法律程序可以强制[=issuers=]、[=holders=]和[=verifiers=]向执法机构等权威部门披露私人信息。相同的私人信息也可能因软件错误或安全故障而被意外披露给未经授权的一方。建议法律程序和合规制度的制定者起草要求在其私人信息被有意或意外披露给第三方时通知相关[=subjects=]的指南。建议软件服务提供商对可能导致此类私人信息与第三方共享的已知情况以及任何此类第三方的身份保持透明。
当[=holder=]选择与[=verifier=]共享信息时,[=verifier=]可能出于恶意行事并请求可能伤害[=holder=]的信息。例如,[=verifier=]可能要求银行账号,然后可以与其他信息一起用于欺诈[=holder=]或银行。
[=Issuers=]应当(SHOULD)尽可能多地将信息令牌化,以便如果[=holder=]意外将[=credentials=]传输给错误的[=verifier=],情况不会是灾难性的。
例如,不要包含银行账号来检查个人的银行余额,而是提供一个令牌,使[=verifier=]能够检查余额是否超过某一金额。在这种情况下,银行可以向[=holder=]颁发包含余额检查令牌的[=verifiable credential=]。然后[=holder=]将[=verifiable credential=]包含在[=verifiable presentation=]中,并使用数字签名将令牌绑定到信用检查机构。然后[=verifier=]可以将[=verifiable presentation=]包装在他们的数字签名中,并将其交回颁发者以动态检查账户余额。
使用这种方法,即使[=holder=]将账户余额令牌与错误方共享,攻击者也无法发现银行账号或账户的确切价值。此外,鉴于反签名的有效期,攻击者仅能在几分钟内获得对令牌的访问。
[=verifiable credentials=]和[=verifiable presentations=]中表达的数据是有价值的,因为它们包含受信任的第三方(如[=issuers=])或个人(如[=holders=]或[=subjects=])做出的真实声明。此数据的存储和可访问性可能无意中为恶意行为者创建敏感数据的蜜罐。这些对手通常寻求利用此类敏感信息库,旨在获取和交换该数据以获取经济利益。
建议[=Issuers=]保留向[=holders=]颁发[=verifiable credentials=]和管理这些凭证的状态和撤销所需的最少数据。类似地,建议[=issuers=]避免创建包含个人可识别信息(PII)或其他敏感数据的可公开访问的凭证。建议软件实施者使用强大的同意和访问控制措施保护[=verifiable credentials=],确保它们对未经授权的实体不可访问。
建议[=Holders=]使用在传输和静止时适当加密其数据的实现,并以不易从硬件或其他设备中提取的方式保护敏感材料(如加密密钥)。进一步建议[=holders=]仅在他们控制的设备上存储和处理其数据,远离集中式系统,以降低攻击其数据的可能性或在攻击成功时被包含在大规模盗窃中的可能性。此外,鼓励[=holders=]严格控制对其凭证和展示的访问,仅允许获得明确授权的人访问。
建议[=Verifiers=]仅请求特定交易所需的数据,且不保留超出任何特定交易需要的数据。
建议监管机构重新考虑现有的审计要求,以便使用更好地保护隐私的机制来实现类似的执法和审计能力。例如,坚持收集和长期保留个人可识别信息的以审计为重点的法规,如果相同的信息后来被泄露并被攻击者访问,可能会对个人和组织造成伤害。本规范描述的技术使[=holders=]能够更容易地证明关于自己和他人的属性,减少[=verifiers=]对长期数据保留的需要。替代方案包括保留信息已被收集和检查的日志,以及随机测试以确保合规制度按预期运行。
如 [[[#patterns-of-use]]] 节中详述的,使用模式可以与某些类型的行为相关联。当[=holder=]在[=issuer=]不知情的情况下使用[=verifiable credential=]时,这种关联会被部分缓解。然而,[=Issuers=]可以通过使其[=verifiable credentials=]短期有效并自动更新来击败这种保护。
例如,`ageOver` [=verifiable credential=]有助于获得进入酒吧的权限。如果[=issuer=]颁发这样一个具有非常短的有效期和自动更新机制的[=verifiable credential=],则[=issuer=]可以以负面影响[=holder=]的方式关联[=holder's=]行为。
向[=holders=]提供软件的组织应当(SHOULD)在他们重复使用具有短生命周期的[=credentials=]时向其发出警告,因为这可能导致行为关联。[=Issuers=]应当(SHOULD)避免颁发使其能够关联使用模式的[=credentials=]。
理想的尊重隐私的系统只需要将与[=verifier=]交互所必需的信息由[=holder=]披露。然后[=verifier=]记录披露要求已满足并丢弃任何已披露的敏感信息。在许多情况下,竞争优先事项(如监管负担)阻止了这种理想系统的使用。在其他情况下,长期标识符阻止了一次性使用。任何[=verifiable credentials=]生态系统的设计者应当(SHOULD)尽可能通过优先使用一次性[=verifiable credentials=]使其尽可能地尊重隐私。
使用一次性[=verifiable credentials=]提供了若干好处。第一个好处是对于[=verifiers=],他们可以确信[=verifiable credential=]中的数据是新鲜的。第二个好处是对于[=holders=],他们知道如果[=verifiable credential=]中没有长期标识符,该[=verifiable credential=]本身不能用于在线跟踪或关联他们。最后,没有什么可供攻击者窃取的,使整个生态系统在其中运行更加安全。
在理想的隐私浏览场景中,不会透露任何 PII。由于许多[=credentials=]包含 PII,向[=holders=]提供软件的组织应当(SHOULD)在其使用[=credentials=]和[=presentations=]处于隐私浏览模式时警告他们此信息可能被透露的可能性。由于每个浏览器供应商对隐私浏览的处理方式不同,且某些浏览器可能没有此功能,实施者不应依赖隐私浏览模式来提供任何隐私保护。相反,建议实施者依赖可由其软件直接使用的工具来提供隐私保障。
[=Verifiable credentials=]依赖于对[=issuers=]的高度信任。[=holder=]能够利用可能的隐私保护的程度通常强烈依赖于[=issuer=]对此类功能的支持。在许多情况下,利用零知识证明、数据最小化技术、不记名凭证、抽象声明和防止基于签名关联的隐私保护需要[=issuer=]的积极支持,他们需要将这些能力纳入其颁发的[=verifiable credentials=]中。
至关重要的是要注意,[=holders=]不仅依赖[=issuer=]的参与来提供有助于保护[=holder=]和[=subject=]隐私的[=verifiable credential=]能力,而且还依赖[=issuers=]不故意颠覆这些隐私保护。例如,[=issuer=]可能使用防止基于签名关联的签名方案对[=verifiable credentials=]进行签名。这将保护[=holder=]免受因签名值在[=verifiers=]之间共享而被关联。然而,如果[=issuer=]为每个已颁发的[=credential=]创建唯一密钥,则[=issuer=]可能能够跟踪[=credential=]的[=presentations=],而不管[=verifier's=]无法这样做。
除了前述[=issuer=]可能提供的隐私保护外,[=issuers=]需要意识到与他们在颁发[=credentials=]时使用的标识符和声明类型相关联的泄露数据。一个例子是[=issuer=]颁发驾驶执照,这些执照既揭示了其管辖范围所在的位置,也揭示了[=subject's=]居住位置。[=Verifiers=]可能通过请求[=credential=]来利用这一点,表面上是检查[=subject=]是否获准驾驶,实际上他们感兴趣的是凭证关于的元数据,例如哪个[=issuer=]颁发了凭证,以及可能由[=issuer=]泄露的附带信息,例如[=subject's=]家庭住址。为缓解此类泄露,[=issuers=]可以使用通用标识符来掩盖特定位置信息或其他敏感元数据;例如,在州或国家层面使用共享的[=issuer=]标识符,而不是在县、市、镇或其他较小的市政级别。此外,[=verifiers=]可以使用[=holder=]证明机制来保护隐私,通过提供[=issuer=]存在于一组受信实体中的证明,而无需披露确切的[=issuer=]。
[=Issuers=]、[=holders=]和[=verifiers=]在处理本规范描述的数据时应当(SHOULD)了解许多安全注意事项。忽视或不了解本节的影响可能导致安全漏洞。
虽然本节重点介绍了一系列广泛的安全注意事项,但这是一个不完整的列表。使用本规范中描述的技术的关键任务系统的实施者被强烈鼓励向安全和密码学专业人员咨询全面的指导。
密码学可以保护本规范中描述的数据模型的某些方面。实施者了解用于创建和处理[=credentials=]和[=presentations=]的密码学套件和库非常重要。实现和审计密码学系统通常需要丰富的经验。有效的红队演练也有助于消除安全审查中的偏见。
密码学套件和库有其保质期,最终会屈服于新的攻击和技术进步。生产质量的系统需要考虑到这一点,并确保存在机制可以轻松且主动地升级过期或被攻破的密码学套件和库,以及使现有[=credentials=]无效和替换。定期监控对于确保处理[=credentials=]的系统的长期可行性非常重要。
用于保护[=verifiable credentials=]和[=verifiable presentations=]的大多数数字签名算法的安全性取决于其私有签名密钥的质量和保护。密码学密钥的管理涵盖了一个广阔而复杂的领域。有关全面建议和深入讨论,读者可参阅 [[NIST-SP-800-57-Part-1]]。正如 [[FIPS-186-5]] 和 [[NIST-SP-800-57-Part-1]] 中强烈建议的那样,私有签名密钥不得用于多种目的;例如,私有签名密钥不得既用于加密又用于签名。
[[NIST-SP-800-57-Part-1]] 强烈建议私有签名密钥和公共验证密钥具有有限的密钥有效期,其中密钥有效期是"特定密钥被合法实体授权使用的时间跨度,或给定系统的密钥将保持有效的时间。" [[NIST-SP-800-57-Part-1]] 在不同条件下为不同密钥类型提供了关于密钥有效期的广泛指导,并建议私有签名密钥的密钥有效期为一到三年。
为了处理潜在的私钥泄露,[[NIST-SP-800-57-Part-1]] 提供了关于保护措施、伤害降低和撤销的建议。虽然本节主要关注私有签名密钥的安全性,但 [[NIST-SP-800-57-Part-1]] 也高度建议在使用所有[=verification material=]之前确认其有效性。
[=Verifiable credentials=]通常包含指向[=verifiable credential=]外部数据的 URL。存在于[=verifiable credential=]外部的链接内容——如图像、JSON-LD 扩展上下文、JSON Schema 和其他机器可读数据——不受[=verifiable credential=]上的保护机制的防篡改保护。
本规范的 [[[#integrity-of-related-resources]]] 节提供了一种可选机制来确保外部资源内容的完整性。对于不影响[=verifiable credential=]安全性的外部资源,此机制不是必需的。然而,对于内容更改可能引入安全漏洞的外部资源,其实现至关重要。
实施者需要认识到与未保护的外部机器可读内容 URL 相关的潜在安全风险。此类漏洞可能导致对其应用程序的成功攻击。在外部资源的更改可能危及安全性的情况下,实施者将受益于采用本规范中概述的内容完整性保护机制。
本规范允许创建没有签名或证明的[=credentials=]。这些[=credential=]类别通常对中间存储或自我声明的信息有用,类似于在网页上填写表格。实施者应当(SHOULD)意识到这些[=credential=]类型不是[=verifiable=]的,因为作者身份要么未知,要么无法被信任。
数据模型本身并不阻止中间人(MITM)、重放和欺骗攻击。在线和离线用例都可能容易受到这些攻击的影响,其中对手在传输或存储过程中拦截、修改、重用和/或复制[=verifiable credential=]数据。
[=verifier=]可能需要确保其是[=verifiable presentation=]的预期接收者,而不是中间人攻击的目标。某些保护机制(如 [[[VC-JOSE-COSE]]] [[VC-JOSE-COSE]] 和 [[[VC-DATA-INTEGRITY]]] [[VC-DATA-INTEGRITY]])提供了指定[=presentation=]预期受众或域的选项,这有助于降低此风险。
其他方法(如令牌绑定 [[RFC8471]],将[=verifiable presentation=]的请求与响应关联)可以帮助保护协议。任何未保护的协议都容易受到中间人攻击。
[=verifier=]可能希望限制[=verifiable presentation=]可以被使用的次数。例如,多个人出示代表活动门票的同一[=verifiable credential=]可能被允许进入活动,从[=issuer=]的角度来看这破坏了门票的目的。为防止此类重放攻击,[=verifiers=]要求[=holders=]在其[=verifiable presentations=]中包含额外的安全措施。示例包括以下内容:
[=Verifiers=]可能对知道[=holder=]被授权出示[=verifiable presentation=]内的[=claims=]有切身利益。虽然数据模型概述了[=verifiable credential=]所需的结构和数据元素,但它不包含确定所出示[=credentials=]授权状态的机制。为解决此问题,实施者可能需要探索补充方法,例如将[=verifiable credentials=]绑定到强身份验证机制或在[=verifiable presentations=]中使用附加属性以启用控制证明。
当[=verifiable credentials=]包含高度动态信息时,对有效期的仔细考虑变得至关重要。颁发有效期超出其预期使用范围的[=verifiable credentials=]会产生恶意行为者可能利用的潜在安全漏洞。有效期短于[=verifiable credential=]表达的信息预期被使用的时间范围会给[=holders=]和[=verifiers=]带来负担。因此,为[=verifiable credentials=]设置适合用例和[=verifiable credential=]中包含的信息的预期生命周期的有效期非常重要。
在设备上存储[=verifiable credentials=]在设备丢失或被盗时会带来风险。获得此类设备的攻击者可能会使用受害者的[=verifiable credentials=]未经授权地访问系统。缓解此类攻击的方法包括:
此外,冒充实例可以以各种形式表现,包括[=entity=]试图否认其行为的情况。在[=verifiable credentials=]领域提升信任和安全不仅仅是避免冒充;它还涉及实施不可否认机制。这些机制巩固了[=entity's=]对其行为或交易的责任,加强了问责并威慑恶意行为。实现不可否认是一项多方面的努力,包括一系列技术,如保护机制、持有证明和各种旨在促进信任和可靠性的协议中的认证方案。
确保[=entity's=]行为——如[=presentation=]——与这些行为的预期目的之间的一致性至关重要。它涉及拥有使用[=verifiable credentials=]的授权,以及以遵守其指定范围和目标的方式使用[=credentials=]。此上下文中的两个关键方面是未经授权的使用和不当使用。
超出预期目的使用[=verifiable credentials=]和[=verifiable presentations=]的实体正在从事未经授权的活动。一类未经授权的使用是保密性违规。考虑一个[=holder=]与[=verifier=]共享[=verifiable presentation=]以确定其年龄和居住状态的情况。如果[=verifier=]随后在未获得适当同意的情况下使用[=holder's=]数据,例如将数据出售给数据经纪商,这将构成对数据的未经授权使用,违反了[=holder=]在交易中可能具有的隐私期望。
类似地,[=issuer=]可以使用 termsOfUse 属性来指定[=holder=]可能被允许和预期如何以及何时使用[=credential=]。[=holder=]在 `termsOfUse` 中定义的范围之外使用[=credentials=]将被视为未经授权。
需要进一步研究以确定[=holder=]如何在[=presentation=]之后主张和执行其数据的授权使用。
虽然有效的加密签名和成功的状态检查表明[=credentials=]的可靠性,但它们并不表明所有[=credentials=]在所有上下文中都是可互换的。[=verifiers=]还验证任何相关[=claims=]至关重要,需要考虑[=claim=]的来源和性质以及[=holder=]出示[=credential=]的目的。
例如,在需要认证的医学诊断的场景中,携带必要数据的自我声明[=credential=]可能不够充分,因为它缺乏来自权威医学来源的有效性。为确保正确使用[=credential=],利益相关者需要评估凭证的相关性和权威性在其预期应用的特定上下文中的适用性。
[=verifiable credentials=]中的数据可能包含可注入的代码或来自脚本语言的代码。[=verifiable credentials=]的作者应避免此类包含,除非必要且仅在尽可能充分地缓解相关风险后才进行。
例如,包含多种语言或注释的单个自然语言字符串通常需要额外的结构或标记才能正确展示。标记语言(如 HTML)可以标记不同语言的文本范围或提供正确显示[=bidirectional text=]所需的字符串内部标记。也可以使用 `rdf:HTML` 数据类型在 JSON-LD 中准确编码此类值。
尽管有将信息编码为 HTML 的能力,但强烈不建议实施者这样做,原因如下:
如果实施者认为需要使用 HTML 或其他能够包含可执行脚本的标记语言来解决特定用例,建议他们分析攻击者如何使用标记对标记的消费者发起注入攻击。此分析之后应主动部署针对已识别攻击的缓解措施,例如在没有网络访问能力的沙箱中运行 HTML 渲染引擎。
实施者在处理本规范中描述的数据时应当(SHOULD)了解许多无障碍性注意事项。与任何 Web 标准或协议的实现一样,忽视无障碍性问题会使大量人口无法使用此信息。遵循无障碍性指南和标准(如 [[WCAG21]])以确保所有人(无论能力如何)都能使用此数据非常重要。当建立使用密码学的系统时,这一点尤其重要,因为密码学历史上为辅助技术带来了问题。
本节详细说明了使用此数据模型时需要考虑的一般无障碍性注意事项。
当今使用的许多实体[=credentials=](如政府身份证)具有较差的无障碍性特征,包括但不限于小字体、依赖小而高分辨率的图像以及没有为视力障碍者提供的便利。
当使用此数据模型创建[=verifiable credentials=]时,建议数据模型设计者使用数据优先方法。例如,在使用数据还是图形图像来描绘[=credential=]之间做选择时,设计者应当(SHOULD)以机器可读的方式表达图像的每个元素(如机构名称或专业[=credential=]),而不是依赖查看者对图像的解释来传达此信息。使用数据优先方法是首选的,因为它提供了为具有不同能力的人构建不同界面的基础元素。
建议实施者在发布本规范中描述的数据时了解许多国际化注意事项。与任何 Web 标准或协议实现一样,忽视国际化使得数据难以在不同的语言和社会中生产和消费,这限制了规范的适用性并大大降低了其作为标准的价值。
强烈建议实施者阅读 W3C 国际化活动发布的Web 上的字符串:语言和方向元数据文档 [[STRING-META]],该文档详细阐述了提供可靠的文本元数据以支持国际化的需求。有关国际化注意事项的最新信息,还敦促实施者阅读可验证凭证实现指南 [[VC-IMP-GUIDE]] 文档。
本节概述了使用此数据模型时需要考虑的一般国际化注意事项,旨在重点介绍实施者可能有兴趣阅读的Web 上的字符串:语言和方向元数据文档 [[STRING-META]] 的特定部分。
强烈鼓励数据发布者阅读Web 上的字符串:语言和方向元数据文档 [[STRING-META]] 中关于跨语法表达的部分,以确保在多种表达语法(如 [[JSON-LD11]]、[[JSON]] 和 CBOR [[?RFC7049]])之间表达语言和基本方向信息是可能的。
一般设计模式是在表达标记了语言以及可选的特定基本方向的文本字符串时使用以下标记模板。
"myProperty": {
"@value": "The string value",
"@language": "LANGUAGE"
"@direction": "DIRECTION"
}
当语言值对象用于替代字符串值时,该对象必须(MUST)包含一个值为字符串的 `@value` 属性,应当(SHOULD)包含一个 `@language` 属性(其值是包含 [[BCP47]] 定义的格式正确的 `Language-Tag` 的字符串),并且可以(MAY)包含一个 `@direction` 属性(其值是 [[JSON-LD11]] 中 `@direction` 属性定义的[=base direction=]字符串)。语言值对象不得(MUST NOT)包含 `@value`、`@language` 和 `@direction` 之外的任何其他键。
使用上述设计模式,以下示例以英语表达一本书的标题而不指定文本方向。
"title": {
"@value": "HTML and CSS: Designing and Creating Websites",
"@language": "en"
}
下一个示例使用阿拉伯语表达的类似标题,基本方向为从右到左。
"title": {
"@value": "HTML و CSS: تصميم و إنشاء مواقع الويب",
"@language": "ar",
"@direction": "rtl"
}
上面的文本如果没有明确表达语言和方向,很可能会被错误地渲染为从左到右,因为许多系统使用文本字符串的第一个字符来确定其[=base direction=]。
多个语言值对象可以(MAY)作为属性的数组值提供:
"title": [
{
"@value": "HTML and CSS: Designing and Creating Websites",
"@language": "en"
},
{
"@value": "HTML و CSS: تصميم و إنشاء مواقع الويب",
"@language": "ar",
"@direction": "rtl"
}
]
{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://achievement.example/multilingual/v2"
],
"type": [ "VerifiableCredential", "ExampleAchievementCredential" ],
"issuer": {
"id": "did:example:2g55q912ec3476eba2l9812ecbfe",
"type": "Profile"
},
"validFrom": "2024-03-14T22:32:52Z",
"validUntil": "2025-01-01T00:00:00Z",
"credentialSubject": {
"type": [ "AchievementSubject" ],
"achievement": {
"id": "urn:uuid:9a652678-4616-475d-af12-aca21cfbe06d",
"type": [ "Achievement" ],
"name": {
"en": "Successful installation of the Example application",
"es": "Instalación exitosa de la aplicación Example"
},
"criteria": {
"narrative": {
"es": "Instaló exitosamente de la aplicación Example.",
"en": "Successfully installed the Example application."
}
}
}
}
}
每个自然语言字符串属性值的语言和基本方向应当(SHOULD)通过每个属性值的语言值结构或通过整个凭证中所有值的默认语言和基本方向来提供。使用每个值的语言值结构是首选的,因为使用文档默认值可能导致下游处理器执行基于 JSON-LD 扩展的转换(否则是可选的)。有关更多信息,请参阅 [[JSON-LD11]] 规范中的字符串国际化部分。没有关联语言的自然语言字符串值应当(SHOULD)被视为语言值为 `undefined`(语言标记 "`und`")。没有关联基本方向的自然语言字符串值应当(SHOULD)被视为方向值为 "`auto`"。
虽然本规范不为[=verifiable credentials=]或[=verifiable presentations=]的[=validation=]过程提供一致性标准,但读者可能对此数据模型中的信息在[=validation=]过程中预期如何被[=verifiers=]使用感到好奇。本节记录了工作组就本规范中属性由[=verifiers=]预期使用的相关讨论的一部分。
当[=verifier=]从[=holder=]请求一个或多个[=verifiable credentials=]时,他们可以指定希望接收的凭证类型。凭证类型以及每种类型及其每个[=claims=]的验证模式由规范作者定义,并发布在 [[[VC-EXTENSIONS]]] 等地方。
凭证的类型通过 type 属性表达。特定类型的[=verifiable credential=]包含特定的[=properties=](可能是深层嵌套的),可用于确定[=presentation=]是否满足[=verifier=]执行的一组处理规则。通过请求特定 `type` 的[=verifiable credentials=],[=verifier=]能够从[=holder=]那里收集来自每个[=verifiable credential=]的[=issuer=]的特定信息,使[=verifier=]能够确定与[=holder=]交互的下一阶段。
当[=verifier=]请求特定类型的[=verifiable credential=]时,将有一组与该类型相关联的必需和可选[=claims=]。当必需[=claims=]未包含时,[=verifier's=]对[=verifiable credential=]的验证将失败,任何与特定类型不相关联的[=claim=]将被忽略。换句话说,[=verifier=]将对其接收的[=verifiable credential=]执行输入验证,并根据凭证类型规范拒绝格式不正确的输入。
在[=holder=]出示的[=verifiable credentials=]中,每个 `credentialSubject` 的 `id` [=property=]关联的值向[=verifier=]标识一个[=subject=]。如果[=holder=]同时也是[=subject=],则[=verifier=]可以在拥有与[=holder=]相关的[=verification=]元数据时对[=holder=]进行身份验证。然后[=verifier=]可以使用[=verifiable presentation=]中包含的由[=holder=]生成的签名来验证[=holder=]的身份。`id` [=property=]是可选的。[=Verifiers=]可以使用[=verifiable credential=]中的其他[=properties=]来唯一标识[=subject=]。
有关身份验证和 WebAuthn 如何与[=verifiable credentials=]配合使用的信息,请参阅 [[[VC-IMP-GUIDE]]] 文档。
与 `issuer` [=property=]关联的值向[=verifier=]标识一个[=issuer=]。
与 `issuer` [=property=]相关的元数据通过 [[[#verification]]] 节中定义的验证算法对[=verifier=]可用。此元数据包括对保护机制用于保护每个[=verifiable credential=]或[=verifiable presentation=]的验证方法的已验证控制者的标识,其中控制者通常是各自的 `issuer` 或 `holder`。
某些生态系统可能在[=issuers=]和验证方法控制者之间具有更复杂的关系,可能除了上述映射之外或作为其替代使用已验证颁发者列表。
与 `holder` [=property=]关联的值用于向[=verifier=]标识[=holder=]。
关于由 `holder` [=property=]值标识的[=holder=]的相关元数据通常对[=verifier=]可用或可由其检索。例如,[=holder=]可以发布包含用于保护[=verifiable presentations=]的[=verification material=]的信息。此元数据在检查[=verifiable presentations=]上的证明时使用。某些加密标识符在标识符本身中包含所有必要的元数据。在这些情况下,不需要额外的元数据。其他标识符使用可验证数据注册表,此类元数据会自动发布供[=verifiers=]使用,无需[=holder=]的任何额外操作。
有关[=subject=]和[=holder=]的其他示例,请参阅 和 。
验证(确认有效性)是验证者应用业务规则来评估[=verifiable credential=]特定使用的适当性的过程。
[=verifier=]可能需要根据复杂的业务规则验证给定的[=verifiable presentation=];例如,验证者可能需要确信[=holder=]与[=verifiable credential=]的[=subject=]是同一实体。在这种情况下,以下因素可以使[=verifier=]合理确信在包含的[=verifiable credentials=]中关于该标识符表达的声明实际上是关于当前出示者的:
`validFrom` 预期在[=verifier=]的预期范围内。例如,[=verifier=]可以检查[=verifiable credential=]的有效期开始时间不在未来。
用于证明[=verifiable credential=]或[=verifiable presentation=]中的信息未被篡改的保护机制称为加密证明。加密证明有多种类型,包括但不限于数字签名和零知识证明。一般而言,在验证加密证明时,实现预期确保:
一般而言,在验证数字签名时,实现预期确保:
[=verifier=]预期 `validFrom` 和 `validUntil` 属性将在某一范围内。例如,[=verifier=]可以检查[=verifiable credential=]的有效期结束时间不在过去。因为某些凭证即使其原始有效期已过期也可以用于次要目的,有效期(使用 `validFrom` 和 `validUntil` 属性表达)始终被视为验证(确认有效性)的组成部分,在验证(验真)之后执行。
如果 `credentialStatus` 属性可用,则[=verifier=]预期根据[=verifiable credential=]的 `credentialStatus` [=type=]定义和[=verifier's=]自身的状态评估标准来评估[=verifiable credential=]的状态。例如,[=verifier=]可以确保[=verifiable credential=]的状态不是"被[=issuer=]因故撤回"。
如果 `credentialSchema` 属性可用,则[=verifier=]预期根据[=verifiable credential=]的 `credentialSchema` [=type=]定义和[=verifier's=]自身的模式评估标准来评估[=verifiable credential=]的模式。例如,如果 `credentialSchema` 的 `type` 值是 [[?VC-JSON-SCHEMA]],则[=verifier=]可以确保凭证的数据针对给定的 JSON Schema 有效。
适用性是关于[=verifiable credential=]中的自定义[=properties=]是否适合[=verifier's=]的目的。例如,如果[=verifier=]需要确定[=subject=]是否年龄超过 21 岁,他们可能依赖特定的 `birthdate` [=property=],或更抽象的[=properties=],如 `ageOver`。
[=verifier=]信任[=issuer=]做出相关[=claims=]。例如,特许经营快餐店位置信任特许经营总部做出的折扣优惠券[=claims=]。除非[=holders=]和[=verifiers=]接受忽略政策的责任,否则应当(SHOULD)尊重[=issuer=]在[=verifiable credential=]中表达的政策信息。
使用当今通常被称为"人工智能"和/或"机器学习"的系统可能能够以达到或超过人类表现的水平执行复杂任务。这可能包括获取和使用[=verifiable credentials=]等任务。使用此类任务来区分人类和自动化"机器人"活动(如今天使用 CAPTCHA 常见的做法)可能因此不再提供足够或可接受的保护。
敦促使用[=verifiable credentials=]和/或对其内容执行验证的安全架构的实施者考虑基于机器的参与者(如当今通常被称为"人工智能"的那些)的存在,它们可能合法地持有[=verifiable credentials=]用于与其他系统的交互。实施者还可以考虑威胁行为者如何将此类"人工智能"系统与[=verifiable credentials=]结合使用,在与其系统交互时冒充人类。此类系统可能包括但不限于社交媒体、选举、能源分配、供应链和自动驾驶车辆系统等全球基础设施。
实现必须(MUST)将位于 `https://www.w3.org/ns/credentials/v2` 的基础上下文值视为已检索;以下值是基础上下文文件的十六进制编码 SHA2-256 摘要值:。可以通过从现代 Unix 命令行界面运行以下命令来确认上述加密摘要:`curl -s https://www.w3.org/ns/credentials/v2 | openssl dgst -sha256`。
强烈建议应用程序使用的所有 JSON-LD 上下文 URL 使用相同的机制或功能等效的机制来确保端到端安全性。如果资源的加密哈希值与预期哈希值不匹配,实现预期抛出错误。
在执行诸如JSON-LD 扩展或转换为 RDF 等操作期间应用上述基础上下文以及任何 `@context` 属性中的其他上下文和值的实现,预期在执行这些操作时不会遇到任何错误。如果执行了此类操作并导致错误,则[=verifiable credential=]或[=verifiable presentation=]必须(MUST)导致验证失败。
本规范中具有关联加密哈希值的文件发生更改的可能性极低。然而,如果在规范中发现关键勘误并需要更正以确保生态系统稳定性,则加密哈希值可能会更改。因此,文件的 HTTP 缓存时间未设置为无穷大,如果检测到加密哈希值更改,建议实施者检查勘误表。
本节提醒确保在验证[=verifiable credentials=]和[=verifiable presentations=]时,[=verifier=]拥有与[=issuer=]或[=holder=]在保护[=credential=]或[=presentation=]时所拥有的一致信息的重要性。此信息可能至少包括:
警告[=Verifiers=],从[=credential=]内引用的其他数据(如通过 URL 链接到的资源)默认不受加密保护。确保为对[=verifiable credential=]的安全性至关重要的任何 URL 提供相同类型的保护(通过使用永久缓存的文件和/或加密哈希)被认为是最佳实践。最终,知道任何链接的外部内容的加密摘要使[=verifier=]能够确认内容与[=issuer=]或[=holder=]预期的相同。
依赖 RDF 词汇处理的实现必须(MUST)确保在加载 JSON-LD 序列化(这些是规范性的)时,基础上下文中使用的以下词汇 URL 最终解析为以下文件。实现可以(MAY)使用词汇文件的其他语义等效序列化。为每个 JSON-LD 文档提供了加密哈希,以确保开发者可以验证每个文件的内容是正确的。
| JSON-LD 文档和哈希值 |
|---|
|
URL: https://www.w3.org/2018/credentials# Resolved Document: https://www.w3.org/2018/credentials/index.jsonld SHA2-256 Digest:
|
|
URL: https://w3id.org/security# Resolved Document: https://w3c.github.io/vc-data-integrity/vocab/security/vocabulary.jsonld SHA2-256 Digest:
|
It is possible to confirm the cryptographic digests listed above by running a command like the following, replacing `<DOCUMENT_URL>` with the appropriate value, through a modern UNIX-like OS command line interface: `curl -sL -H "Accept: application/ld+json" <DOCUMENT_URL> | openssl dgst -sha256`
实施者和文档作者可能注意到没有为 `schema.org` 提供加密摘要。这是因为 `schema.org` 词汇会定期更改;提供的任何摘要在发布后数周内就会过时。工作组讨论了此问题并得出结论:本规范使用的来自 `schema.org` 的词汇术语多年来一直保持稳定,其语义含义极不可能发生变化。
本规范为受益于此类定义的处理器和其他规范定义了以下基类:
| 基类 | 用途 |
|---|---|
| `CredentialEvidence` | 作为放置在 evidence 属性中的特定证据类型的超类。 |
| `CredentialSchema` | 作为放置在 credentialSchema 属性中的特定模式类型的超类。 |
| `CredentialStatus` | 作为放置在 credentialStatus 属性中的特定凭证状态类型的超类。 |
| `ConfidenceMethod` | 作为放置在 `confidenceMethod` 属性中的特定置信方法类型的超类。 |
| `RefreshService` | 作为放置在 credentialRefresh 属性中的特定刷新服务类型的超类。 |
| `RenderMethod` | 作为放置在 `renderMethod` 属性中的特定渲染方法类型的超类。 |
| `TermsOfUse` | 作为放置在 termsOfUse 属性中的特定使用条款类型的超类。 |
本节定义本规范使用的数据类型。
`sriString` 数据类型与一个值相关联,使用 [[[SRI]]] 规范中指定的方法为资源提供完整性信息。`sriString` 数据类型定义如下:
[=verifiable credential=]和[=verifiable presentation=]数据模型利用各种底层技术,包括 [[JSON-LD11]] 和 [[?VC-JSON-SCHEMA]]。本节将提供 `@context`、`type` 和 `credentialSchema` 属性的比较,并涵盖可以使用数据模型这些功能的一些更具体的用例。
`type` 属性用于唯一标识其出现的[=verifiable credential=]的类型,即指示[=verifiable credential=]包含哪组声明。此属性及其值集中的 `VerifiableCredential` 值是必需的。虽然包含一个描述此[=verifiable credential=]唯一子类型的附加值是良好实践,但允许在数组中省略或包含附加类型值。许多验证者将请求特定子类型的[=verifiable credential=],因此省略子类型值可能使验证者更难通知持有者他们需要哪个[=verifiable credential=]。当[=verifiable credential=]具有多个子类型时,在 `type` 属性中列出所有子类型是合理的。在[=verifiable credential=]的 [[JSON-LD11]] 表示中使用 `type` 属性能够强制执行[=verifiable credential=]的语义,因为机器能够检查语义。使用 [[JSON-LD11]],该技术不仅描述声明集的分类,还传达图中属性子图的结构和语义。在 [[JSON-LD11]] 中,这代表图中节点的类型,这就是为什么[=verifiable credential=]的某些 [[JSON-LD11]] 表示会在[=verifiable credential=]中的许多对象上使用 `type` 属性。
从 [[JSON-LD11]] 的角度来看,`@context` 属性的主要目的是以机器可读的方式传达[=verifiable credential=]中数据的含义和术语定义。`@context` 属性用于将[=verifiable credentials=]和[=verifiable presentations=]中属性的全局唯一 URL 映射为短格式别名,使 [[JSON-LD11]] 表示对人类更友好易读。从 [[JSON-LD11]] 的角度来看,此映射还允许通过增强[=verifiable credential=]或[=verifiable presentation=]中的数据与更大的机器可读数据图的关系,将[=credential=]中的数据建模为机器可读数据网络。这对于告诉机器如何在各方无法协调的生态系统中将数据的含义与其他数据关联是有用的。此属性(集合中的第一个值为 `https://www.w3.org/ns/credentials/v2`)是必需的。
由于 `@context` 属性用于将数据映射到图数据模型,而 [[JSON-LD11]] 中的 `type` 属性用于描述图中的节点,因此当这两个属性组合使用时,`type` 属性变得更加重要。例如,如果在使用 [[JSON-LD11]] 解析的 `@context` 资源中未包含 `type` 属性,可能导致声明在[=verifiable credential=]的生产和消费过程中被丢弃和/或其完整性不再受保护。或者,可能导致在[=verifiable credential=]的生产或消费过程中引发错误。这将取决于实现的设计选择,目前的实现中使用了两种路径,因此在使用[=verifiable credential=]或[=verifiable presentation=]的 [[JSON-LD11]] 表示时注意这些属性非常重要。
`credentialSchema` 属性的主要目的是定义[=verifiable credential=]的结构以及出现的每个属性值的数据类型。`credentialSchema` 对于定义[=verifiable credential=]中一组声明的内容和结构很有用,而[=verifiable credential=]中的 [[JSON-LD11]] 和 `@context` 最好仅用于传达数据的语义和术语定义,也可用于定义[=verifiable credential=]的结构。
虽然可以使用某些 [[JSON-LD11]] 功能来暗示[=verifiable credential=]的内容,但通常不建议使用 `@context` 来约束数据模型的数据类型。例如,`"@type": "@json"` 对于保持语义开放和未严格定义很有用。如果实施者希望约束[=credential=]中声明的数据类型,这可能是危险的,预期不会被使用。
当 `credentialSchema` 和 `@context` 属性组合使用时,生产者和消费者都可以对[=verifiable credential=]和[=verifiable presentation=]的预期内容和数据类型更有信心。
本节将提交给互联网工程指导组(IESG)进行审查、批准并在 IANA 注册。
本规范注册 `application/vc` 媒体类型,专门用于标识符合[=verifiable credentials=]格式的文档。
| Type name: | application |
| Subtype name: | vc |
| Required parameters: | None |
| Encoding considerations: | Resources that use the `application/vc` media type are required to conform to all of the requirements for the `application/ld+json` media type and are therefore subject to the same encoding considerations specified in Section 11 of [[[RFC7159]]]. |
| Security considerations: | As defined in the [[[VC-DATA-MODEL-2.0]]]. |
| Contact: | W3C Verifiable Credentials Working Group public-vc-wg@w3.org |
请注意,虽然[=verifiable credentials=]格式使用 JSON-LD 约定,但[=verifiable credential=]实现有许多约束和附加要求,证明了使用特定媒体类型的合理性。
此媒体类型可以在[=enveloping proof=]中用于表示封装的有效载荷。
凭证预期是有效的JSON-LD 文档。使用 `application/vc` 媒体类型提供的[=Verifiable credentials=]预期在文档正文中包含所有 [[[JSON-LD11]]] 上下文信息,包括对外部上下文的引用。通过 `http://www.w3.org/ns/json-ld#context` HTTP Link Header(见 [[[JSON-LD11]]] 的第 6.1 节)链接的上下文将被忽略。
本规范注册 `application/vp` 媒体类型,专门用于标识符合[=verifiable presentations=]格式的文档。
| Type name: | application |
| Subtype name: | vp |
| Required parameters: | None |
| Encoding considerations: | Resources that use the `application/vp` media type are required to conform to all of the requirements for the `application/ld+json` media type and are therefore subject to the same encoding considerations specified in Section 11 of [[[RFC7159]]]. |
| Security considerations: | As defined in [[[VC-DATA-MODEL-2.0]]]. |
| Contact: | W3C Verifiable Credentials Working Group public-vc-wg@w3.org |
请注意,虽然[=verifiable presentations=]格式使用 JSON-LD 约定,但[=verifiable presentation=]实现有许多约束和附加要求,证明了使用特定媒体类型的合理性。
此媒体类型可以在[=enveloping proof=]中用于表示封装的有效载荷。
展示预期是有效的JSON-LD 文档。使用 `application/vp` 媒体类型提供的[=Verifiable presentations=]预期在文档正文中包含所有 [[[JSON-LD11]]] 上下文信息,包括对外部上下文的引用。通过 `http://www.w3.org/ns/json-ld#context` HTTP Link Header(见 [[JSON-LD11]] 的第 6.1 节)链接的上下文将被忽略。
下面的 [[[#info-graph-vp-mult-creds]]] 是 [[[#info-graph-vp]]] 的一个变体:一个引用两个[=verifiable credentials=]的[=verifiable presentation=],使用基于 [[?VC-DATA-INTEGRITY]] 的[=embedded proofs=]。每个[=verifiable credential graph=]连接到其自己单独的[=proof graph=];`verifiableCredential` 属性用于将[=verifiable presentation=]连接到[=verifiable credential graphs=]。[=presentation=]的[=proof graph=]表示[=verifiable presentation graph=]、两个[=verifiable credential graphs=]以及从[=verifiable credential graphs=]链接的[=proof graphs=]的数字签名。在这种情况下,完整的[=verifiable presentation=]由六个信息[=graphs=]组成。
下面的 [[[#info-graph-vp-jwt-mult-creds]]] 显示了与 [[[#info-graph-vp-mult-creds]]] 相同的[=verifiable presentation=],但使用基于 [[?VC-JOSE-COSE]] 的[=enveloping proof=]。每个[=verifiable credential graph=]包含一个单独的 `EnvelopedVerifiableCredential` 实例,通过 `data:` URL [[RFC2397]] 引用通过[=enveloping proof=]保护的可验证凭证。
本节包含随时间对本规范所做的实质性更改。
自v2.0 第二候选推荐标准以来的更改:
自v2.0 第一候选推荐标准以来的更改:
自v1.1 推荐标准以来的更改:
自v1.0 推荐标准以来的更改:
工作组感谢以下个人不仅对本文档内容的贡献,还感谢他们在这个标准社区中的辛勤工作,推动了众多不同意见中的变更、讨论和共识:David Chadwick、Dave Longley、Ted Thibodeau Jr.、Brent Zundel、Ivan Herman、Joe Andrieu 和 Gabe Cohen。
本规范的工作得到了由 Christopher Allen、Shannon Appelcline、Kiara Robles、Brian Weller、Betty Dhamers、Kaliya Young、Manu Sporny、Drummond Reed、Joe Andrieu、Heather Vescent、Kim Hamilton Duffy、Samantha Chase、Andrew Hughes、Will Abramson、Erica Connell、Eric Schuh、Zaïda Rivai 和 Shigeya Suzuki 协助的 Rebooting the Web of Trust 社区的支持。由 Phil Windley、Kaliya Young、Doc Searls 和 Heidi Nobantu Saul 协助的 Internet Identity Workshop 的参与者也通过大量旨在教育、辩论和改进本规范的工作会议支持了本工作的完善。
工作组还感谢我们的工作组主席 Dan Burnett、Matt Stone、Brent Zundel、Wayne Chang 和 Kristina Yasuda,以及我们的 W3C 工作人员联系人 Kazuyuki Ashimura 和 Ivan Herman,感谢他们对团队通过多个 W3C 标准化周期的专业管理和稳定指导。我们还感谢 W3C 凭证社区组的主席 Christopher Allen、Joe Andrieu、Kim Hamilton Duffy、Heather Vescent、Wayne Chang、Mike Prorock、Harrison Tang、Kimberly Wilson Linson 和 Will Abramson,他们监督了纳入本规范的多个工作项目的孵化。
本规范部分工作由美国国土安全部科学技术局在合同 HSHQDC-17-C-00019、70RSAT20T00000010/P00001、70RSAT20T00000029、70RSAT21T00000016/P00001、70RSAT23T00000005、70RSAT23C00000030、70RSAT23R00000006、70RSAT24T00000014、70RSAT22T00000001 下资助,以及国家科学基金会在 NSF 22-572 下资助。本规范的内容不一定反映美国政府的立场或政策,不应推断任何官方认可。
工作组希望感谢以下个人对规范的审阅和反馈(按名字的字母顺序排列,如果未提供姓名则使用其 Github 用户名):
Abhishek Mahadevan Raju, Adam C. Migus, Addison Phillips, Adrian Gropper, Aisp-GitHub, Alen Horvat, Alexander Mühle, AlexAndrei98, Allen Brown, Amy Guy, Andor Kesselman, Andres Paglayan, Andres Uribe, Andrew Hughes, Andrew Jones, Andrew Whitehead, Andy Miller, Anil John, Anthony Camilleri, Anthony Nadalin, Benjamin Collins, Benjamin Goering, Benjamin Young, Bert Van Nuffelen, Bohdan Andriyiv, Brent Zundel, Brian Richter, Bruno Zimmermann, caribouW3, cdr, Chaoxinhu, Charles "Chaals" McCathieNevile, Charles E. Lehner, Chris Abernethy, Chris Buchanan, Christian Lundkvist, Christine Lemmer-Webber, Christoph Lange, Christopher Allen, Christopher Lemmer Webber, ckennedy422, Clare Nelson, confiks, Dan Brickley, Daniel Buchner, Daniel Burnett, Daniel Hardman, Darrell O'Donnell, Dave Longley, David Ammouial, David Chadwick, David Ezell, David Hyland-Wood, David I. Lehn, David Janes, David Waite, Denis Ah-Kang, Denisthemalice, Devin Rousso, Dmitri Zagidulin, Dominique Hazael-Massieux, Drummond Reed, Emmanuel, enuoCM, Eric Elliott, Eric Korb, Eric Prud'hommeaux, etaleo, Evstifeev Roman, Fabricio Gregorio, Filip Kolarik, Gabe Cohen, Ganesh Annan, George Aristy, glauserr, Golda Velez, Grace Huang, Grant Noble, Greg Bernstein, Gregg Kellogg, Heather Vescent, Henry Andrews, Henry Story, Ian B. Jacobs, Ilan, Isaac Henderson, isaackps, Iso5786, Ivan Herman, Jace Hensley, Jack Tanner, James Schoening, Janina Sajka, Jan Forster Cognizone, Jeff Burdges, Jeffrey Yasskin, Jim Masloski, Jim St.Clair, Joe Andrieu, Joel Gustafson, Joel Thorstensson, John Tibbetts, Jonathan Holt, José San Juan, Juan Caballero, Julien Fraichot, Justin Richer, Kaan Uzdoğan, Kaliya Young, Kazuyuki Ashimura, Ken Ebert, Kendall Weihe, Kerri Lemoie, Kevin Dean, Kevin Griffin, Kim Hamilton Duffy, Konstantin Tsabolov, Kristijan Sedlak, Kristina Yasuda, Kyle Den Hartog, Lal Chandran, Lance, Lautaro Dragan, Leonard Rosenthol, Liam Missin, Liam Quin, Line Kofoed, Lionel Wolberger, Logan Porter, Lovesh Harchandani, Lukas J. Han, Mahmoud Alkhraishi, Maik Riechert, Manu Sporny, Marcel Jackisch, Mark Foster, Mark Harrison, Mark Moir, Markus Sabadello, Martin Thomson, Marty Reed, Matt Peterson, Matt Stone, Matthew Peterson, Matthieu Bosquet, Matti Taimela, Melvin Carvalho, Michael B. Jones, Michael Herman, Michael Lodder, Michael Richardson, Mike Prorock, Mike Varley, Mircea Nistor, MIZUKI Sonoko / Igarashi, nage, Nate Otto, Nathan George, Niclas Mietz, Niko Lockenvitz, Nikos Fotiou, Nis Jespersen, Oliver Terbu, Pat McBennett, Patrick St-Louis, Paul Bastian, Paul F. Dietrich, Paulo Jorge Q. Ferreira, Pelle Braendgaard, Pete Rowley, Phil Archer, Phillip Long, Pierre-Antoine Champin, Rajesh Rathnam, Ralph Swick, Renato Iannella, Reto Gmür, Reza Soltani, Richard Bergquist, Richard Ishida, Richard Varn, Rieks Joosten, RorschachRev, Ryan Grant, Samuel Müller, Samuel Smith, Sarven Capadisli, Sebastian Crane, Sebastian Elfors, Shawn Butterfield, Shigeya Suzuki, Sho Nakatani, Shuji Kamitsuna, Snorre Lothar von Gohren Edwin, Sten Reijers, Stephen Curran, Steve Huguenin, Steve McCown, Steven Rowat, Taro, tcibm, Ted Thibodeau Jr., Tim Bouma, Timo Glastra, Tobias Käfer, Tobias Looker, Tom Jones, Torsten Lodderstedt, Tzviya Siegman, Victor Dods, Vincent Kelleher, Vladimir Alexiev, Víctor Herraiz Posada, Wayne Chang, whatisthejava, Will Abramson, William Entriken, and Yancy Ribbens.