§ AnonCreds Specification
Specification Status: v1.0 Draft
Latest Draft:
https://github.com/hyperledger/anoncreds-spec
Editors:
- Stephen Curran
- Artur Philipp - Technische Universität Berlin, IDunion
- Hakan Yildiz - Technische Universität Berlin, IDunion
- Sam Curren
- Victor Martinez Jurado
- Aritra Bhaduri
- Artem Ivanov
- Participate:
- GitHub repo
- Commit history
- Discord
§ Abstract
The AnonCreds (Anonymous Credentials) specification is based on the open source verifiable credentialimplementation of AnonCreds that has been in use since 2017, initially as part of theHyperledger Indy opensource project and now in theHyperledger AnonCreds project. The extensive use of AnonCreds around the world has made it a defacto standard for ZKP-based verifiable credentials, and this specification is theformalization of that implementation.
For more details on what AnonCreds are and how they work you can refer to theAnonymous credentials with type-3 revocation by Dmitry Khovratovisch, Michael Lodder and Cam Parra which is the compiled pdf from theirofficial TeX document published under CC4.0 license.
§ Status of This Memo
This is a proposal for version v1.0 of AnonCreds which aims at AnonCreds being ledger agnostic.
This document is a product of theAnonCreds Working Group.It represents the consensus of the AnonCreds community.The proposal for v1.0 has partly been worked out at theRWOT2022 event in the Hague, Netherlands.
Information about the current status of this document, any errata,and how to provide feedback on it may be obtained athttps://github.com/hyperledger/anoncreds-spec.
§ Copyright Notice
This specifications is subject to theCommunity Specification License 1.0available athttps://github.com/CommunitySpecification/1.0.
If source code is included in the specification, that code is subject to theApache 2.0 license unless otherwise marked. In the case of any conflict orconfusion within this specification between the Community Specification Licenseand the designated source code license, the terms of the Community SpecificationLicense shall apply.
§ Introduction
AnonCreds ZKP verifiable credentials provide capabilities that many see as important for digital identity use cases in particular, and verifiable data in general. These features include:
- A full implementation of the Layer 3 verifiable credential “Trust Triangle” of theTrust over IP Model.
- Complete flows for issuing verifiable credentials (Issuer to Holder), and requesting, generating and verifying presentations of verifiable claims (Holder to Verifier).
- Fully defined data models for all of the objects in the flows, including verifiable credentials, presentation requests and presentations sourced from multiple credentials.
- Fully defined applications of cryptographic primitives.
- The use of a Blind Signature scheme in the issuance process to enhance the privacy protections available to the holder recieving the credential, including:
- Only the holder learns the final credential signature, the issuer only learns a blinded version which only the holder can unblind.
- The issuer can sign messages blindly, never learning their value, while still being able to guarantee that the holder knows the value of the message being signed. This is used for the link secret, which the holder commits to during the issuance, the issuer blindly signs this message along with the rest of the credential attributes and then the holder removes the blinding to get a signature over the credential attributes including the unblinded link secret value.
- The use of Zero Knowledge Proofs (ZKPs) in the verifiable presentation process to enhance the privacy protections available to the holder in presenting data to verifiers, including:
- Proving that certain values are part of a signed credential without revealing them including: credential signature, link secret and any attributes a holder does not wish to reveal. This helps prevent correlation based on these values.
- The use of unrevealed identifiers for holder binding to prevent correlation based on such identifiers.
- The use of predicate proofs to reduce the sharing of PII and potentially correlating data, especially dates (birth, credential issuance/expiry, etc.).
- A revocation scheme that proves a presentation is based on credentials that have not been revoked by the issuers without revealing correlatable revocation identifiers.
This version (v1.0) removes any dependence on Hyperledger Indy by removing any requirements related to the storage of the objects used in AnonCreds, whether they be stored remotely on a “verifiable data registry” (including Hyperledger Indy) or in local secure storage.
The following diagram and explanation below give a high-level overview of all AnonCreds Data objects, their relations and the owner respectively receiver of each of the data objects.
AnonCreds require aVerifiable Data Registry (VDR). AVDR (box in green) is a public registry (often a ledger) used for storing some of the AnonCreds data objects.
Schemas are public and reusable templates, which define the attributes of issued AnonCredscredentials and can be written (e.g. by anIssuer) to theVDR.
Based on aSchema, arbitraryIssuers (box in yellow) can create a Credential Definition (Credential Definition) which references theSchema. ACredential Definition enablesIssuers to issue AnonCredsCredentials toHolders and enablesVerifiers (box in red) to verifyCredentials issued to and presented by aHolder. ACredential Definition consists of two pieces of information: First, thePrivate Credential Definition includes the private signing keys of theIssuer for signing and issuing AnonCredsCredentials toholders and is kept private by theIssuer. Second, thePublic Credential Definition includes the public keys of theIssuer, has to be stored on aVDR and is used byholders and arbitraryVerifiers in order to verify AnonCredsCredentials issued to and presented byHolders.
EachHolder (box in blue) has alink secret, which enablesCredential toHolder binding: Whenever aCredential is issued to aHolder by anIssuer, theHolder generates ablinding factor and uses this to commit to a blinded version of thelink secret which is sent to theIssuer. TheIssuer verifies the commitment, before producing a blind signature over the blindedlink secret along with the other attributes within the AnonCredsCredential. This blind signature is sent to theHolder, who removes theblinding factor to retrieve a credential signature over theCredential attributes including the unblindedlink secret. By using the samelink secret for everyCredential that is issued to theHolder, theHolder can prove the affiliation of multipleCredentials at presentation time.
Holders never present the raw signed credential data they - received fromIssuers - toVerifiers for verification purposes. Instead aVerifiable Presentation is created by theHolder and sent to theVerifier. AVerifiable Presentation is a derivation of an AnonCredsCredential which allows aHolder to proof the correctness of the revealed credential data, without revealing the original raw credential signature(s). Additionally,Holders prove knowledge thelink secret attribute within theCredential, without revealing this value to theVerifiers.Verifiers processVerifiable Presentations for verification ofcredential data.
AnonCreds allows the revocation ofCredentials issued toHolders byIssuers. In case revocation is required, at least one (Revocation Registry Definition), which references the associatedPublic Credential Definition, has to be stored to theVDR by theIssuer in addition to thePublic Credential Definition. ARevocation Registry Definition can haveRevocation Status Lists. When one or more credentials have to be revoked, theIssuer stores aRevocation Status List with the updated status of the credentials in question to theVDR.Holder use these additional pieces of information in order to generate aNon-Revocation Proof. ANon-Revocation Proof proves to aVerifier, that the credential theHolder presented to theVerifier, has not been revoked.Verifiers use the information provided by aRevocation Registry Definition and associatedRevocation Status Lists to verify theHolder`sNon-Revocation Proof. ATails File supports the revocation mechanism. EachRevocation Registry Definition requires exactly one Tails File.
§ Requirements, Notation and Conventions
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALLNOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”,“MAY”, and “OPTIONAL” in this document are to be interpreted asdescribed in BCP 14 [RFC2119] [RFC8174] when, and only when, theyappear in all capitals, as shown here.
§ Terminology
- Accumulator
- A [cryptographic accumulator] is used in the AnonCreds v1.0 Revocation scheme as a space- and time-efficient method of proving a value membership in a set of values without revealing the individual members of the set. In AnonCreds v1, an accumulator is a core element of theverifiable credential revocation mechanism.
- AnonCreds Method
- AnonCreds methods specify how AnonCreds objects are written (registered) and read (resolved) on a givenverifiable data registry implementation. AnonCreds was originally written to useHyperledger Indy as its onlyVDR implementation, but the evolution of AnonCreds to enable storing objects on anyVDR implementation means that AnonCreds methods (comparable toDID Methods from theW3C DID Core specification) are necessary. AnonCreds Methods are defined in theAnonCreds Methods Registry repository.
- AnonCreds Objects
- The published and shared data objects used in AnonCreds v1.0 including the published objectsschema,credential definition,revocation registry definition,revocation registry entry and the shared objectscredential offer,credential request, andpresentation request.
- BigNumber
- ABigNumber is an data object which safely allows mathematical operations on numbers of any magnitude. BigNumbers are commonly used in cryptography schemes, including those underlying AnonCreds v1.0.
- Blinded Secret
- A cryptographic technique where a secret value (a number) is blinded before it is shared such that the sender can later prove knowledge of the secret value without sharing it. The AnonCreds v1.0link secretmechanism is based on the use of a blinded secret.
- Blinded Secrets Correctness Proof
- AZKP-based proof that can be verified to show that ablinded secret was produced correctly from anunblinded secret without exposing the secret.
- Blinding Factor
- A blinding factor is a randomBigNumber selected from the set of integers up to the order of the RSA group,
n
. It is generated by theholder to blind theirlink secret during credential issuance. Knowledge of the blinding factor can be used to create aBlinded Secrets Correctness Proof.The blinding factor can be removed from the signature theissuer produces to retrieve a valid signature over theunblinded link secret. A blinding factor and associatedBlinded Secrets Correctness Proof are similarly generated for each non-disclosed attribute during credential presentation, such that aholder can prove they know these values without revealing them to theverifier. - Call Home
- Call home is a term used when evaluating the privacy characteristics ofverifiable credential deployments. If aholder presenting data from a verifiable credential must always contact (“call home to”) theissuer,holder actions are open to the actual, or perception of, tracking of the holder by the issuer.Verifiable credential schemes that do not make possible the tracking ofholder activities byissuers are preferred.
- Claim
- A claim is a part of digital identity related to asubject. A claim can be attested by the identity subject itself, or it can be asserted by another entity.
- Correlatability
- When a verifiable credential scheme that has the attribute ofunlinkability, the data from the process of sharing averifiable presentations with different verifiers cannot be correlated to identify theholder.
- Credential
- A credential is a set ofclaims about an identitysubject. A verifiable credential is a tamper-proof credential whose authorship is cryptographically verifiable. An anonymous credential, also known as AnonCreds, is a verifiable credential that has privacy-preserving properties to enable data minimization and correlation resistance.
- Credential Definition
- A credential definition (also known as CRED_DEF or CLAIM_DEF) contains the public data required forcredential issuances (used by theissuer) as well ascredential validation data (used byholders andverifiers). Any number of credentials can be issued based on a single credential definition. A credential definition is generated by theissuer beforecredential any issuances and published for anyone (primarilyholders andverifiers) to use. In generating the published credential definition, related private data is also generated and held as a secret by the issuer. The secret data includes the private keys necessary to generate signedverifiable credentials that can be presented and verified using the published credential definition. A credential definition can optionally be generated such that its generated credentials can be revoked.
- Credential Key Correctness Proof
- A proof generated during the creation of thecredential definition and included in thecredential offer so that theholder can verify that theissuer is in control of the private data associated with the publishedcredential definition.
- Credential Offer
- A credential offer is a data object sent by anissuer to aholder offering to issue acredential. The credential offer contains the details about the claims theissuer intends to issue to theholder. Aholder can reply to theissuer with acredential request. A credential offer also includes anonce and aCredential Key Correctness Proof.
- Credential Request
- A credential request is a request from anholder towards aissuer to get a credential issued by theissuer. The credential request references a precedingcredential offer and defines the claims theholder wants to get issued, including aBlinded Secret and associatedBlinded Secrets Correctness Proof. A credential request also includes anonce that is used in issuing the credential.
- Data Minimization
- An attribute of verifiable data sharing schemes that considers privacy of a scheme based on the amount of data shared in a given interaction. Ideally, the minimum amount of data is shared for the purpose of the interaction. Techniques such asselective disclosure,predicates, andunlinkability, all available in AnonCreds v1.0 support the goal of privacy-preserving, minimal data sharing.
- DID
- A Decentralized Identifier (DID), defined by theW3C DID Core Specification, is a type of identifier that is useful in enabling verifiable, decentralized digital identity. A DID refers to any subject (e.g., a person, organization, thing, data model, abstract entity, etc.) as determined by the controller of the DID. DIDs are not used in AnonCreds itself but there must be a verifiable identifier (usually a DID) with an enforced relationship betweenschema publishers andissuers and the AnonCreds objects they publish. This is outlined in a note inthis specification section.
- DID Method
- DID methods specify how DID documents are created and resolved (read) on a givenverifiable data registry implementation, allowing DIDs to be created and resolved in a wide variety of storage containers. The capabilities required by DID Methods are defined in the [DID Core specification], and the (many) DID Methods are defined in theDID Methods Registry repository.
- Holder
In this specification, the holder is a software component (agent) used by an entity (person, organization, etc.) in possession ofcredentials issued to them. Where “holder” is used in the specification we mean the software component. In some places where required, we clearly refer to an entity using holder software as separate from the holder software component. Holders interact withissuers to obtaincredentials, and derivepresentations from thecredentials they hold.
- Issuer
An issuer is one of the three entities that interact with each other within the domain of digital identities. It can assertclaims about asubject in the form of a tamper-proof credential whose origins are cryptographically verifiable.
- Issuer Identifier
An issuer identifier is a unique identifier for anissuer. It is used to identify theissuer of AnonCreds objects published to aVerifiable Data Registry.
- Link secret
A link secret is a unique identifier known only to theholder used in AnonCreds to bind credentials issued to aholder to thatholder, and to demonstrate that all of the source verifiable credentials in a presentation are bound to the same link secret that is known to theholder. During issuance and presentation processes theholder's link secret is blinded with ablinding factor such that it is not correlatable, and aBlinded Secrets Correctness Proof is provided by the holder to demonstrate they know the link secret without revealing it.
Link secret is also known by the deprecated term
master_secret
in some AnonCreds source code.- Nonce
A nonce is an arbitrary unique number that is often required as an input to the generation of a cryptographic proof to ensure it is uniquely generated and once produced, cannot be replayed. Within AnonCreds, nonces are used during the issuance and presentation processes to prevent replay attacks.
- Non-Revocation Proof
A non-revocation proof is a proof provided by aholder to demonstrate that a revocable credential they are presenting has not been revoked, without revealing a unique, correlatable identifier for the credential. Averifier verifies a non-revocation proof using information from therevocation registry to which thecredential belongs.
- Predicates
Azero-knowledge proof predicate is a boolean assertion (operators
<=
,<
,>
,>=
) in an presentation about the value of an integerclaim without disclosing the value of the claim.- Presentation Request
An AnonCreds presentation request is an object constructed by theverifier and sent to theholder defining the verifiable data that theverifier wants from theholder for some purpose.
- Prover
A prover is a synonym for holder that is sometimes used in aholder-verifier interaction. In this specification, we use the term “holder” in all cases. However the underlying AnonCreds implementations use “prover” in code.
- Revocation
A unilateral action by theissuer of averifiable credential issued to aholder to revoke that credential for some reason. Once an issued credential has been revoked, theholder can no longer produce anon-revocation proof for thecredential.Verifiers usually (but not always) are interested if a data is presented from a revokedcredential.
- Revocation Registry
A Revocation registry is a set of objects related to one another and acredential definition that holds information about the revocation status of a set of revocable credentials issued from thecredential definition. Each revocation registry consists of arevocation registry definition and one or morerevocation registry entries. There can be 0 or more revocation registries related to acredential definition, and every issued AnonCreds revocable credential is in a revocation registry.
- Revocation Registry Definition
A revocation registry definition is an object with public and private information about arevocation registry. The public part is published such that it an be resolved and used by anyone, while the private part is a secret held by theissuer for use when publishingrevocation registry entries that update the revocation status of one or more credentials.
- Revocation Registry Entry
A revocation registry entry is an object that is published by theissuer to set/update the revocation status of one or more issued credentials that are in arevocation registry. Each revocation registry entry has an identifier (sometimes called a
timestamp
), a cryptographic accumulator that summarizes the revocation state of all the credentials in therevocation registry and, depending on theAnonCreds Method being used to publish the object, either the revocation state of all of the credentials in the registry, or the set of credentials whose revocation state has changed (“deltas”) since the last revocation registry entry was published.- Revocation Status List
A Revocation status list is an object that contains the revocation status (“revoked” or “not revoked”) of all credentials in aRevocation Registry at the time of a givenrevocation registry entry. For [[AnonCreds Methods]] that storerevocation registry entries as deltas (changes to the revocation state of credentials from the previousrevocation registry entry), the set of deltas from the initial publication of therevocation registry must be collected and used to calculate the full revocation state of all of the credentials.
- Schema
A Schema is a object that defines the set ofclaims (also known as attributes) that will be populated byissuers in issuing a give type of AnonCredsverifiable credentials. Schemas have a name, version, and are published to averifiable data registry by aschema publisher using anAnonCreds Method.Credential definitions are generated from a specific schema.
- Schema Publisher
A Schema publisher is an entity that publishes aSchema to averifiable data registry. The schema publisher could be the oneissuer of a type of credential, but could also be another entity that creates aSchema to be used by manyissuers to issue the same type of credential.
- Selective Disclosure
Selective disclosure is the ability to minimize data the shared data from an issuedcredential in apresentation by revealing to averifier only a subset ofclaims in thecredential. The source credential is still verified by theverifier, but only the revealed values are disclosed.
- Signature Correctness Proof
AZKP-based proof that can be verified to show that a signature over a message is valid, without revealing the message or signature.
- Subject
A subject, also known as an identity subject, is the entity about whom theclaims in a credential are asserted. In AnonCreds, the credential subject is not formally defined incredential. Rather, the issuance of acredential is always to a specificholder. The semantics of the credential defines the relationship between theholder and the subject, with theholder frequently being the subject.
- Tails File
A tails file is a part of the AnonCreds v1.0 scheme that enables aholder to produce anon-revocation proof. A tails file is a static file generated as part of the creation of arevocation registry by theissuer, published, and retrieved by theholder of a credential that is in the relatedrevocation registry. Theholder must have the tails file in order to generate anon-revocation proof for a sourcecredential they are providing in apresentation.
- Unlinkability
Unlinkability is the attribute of some verifiable credentials schemes (notably AnonCreds) such that nocorrelatable identifiers are shared in carrying out verifiable credential issuance and presentation processes. Unlinkability requires that when the processes are repeated with the same or different parties (issuers,verifiers) no common unique identifiers are shared. Note that unlinkability may be lost if there are unique identifiers shared in the revealedclaim values ofpresentations.
- Verifiable Data Registry
DIDs, DID documents and publishedAnonCreds objects are stored in a verifiable data registry (VDR) such that an identifier for an object can be resolved (by anyone, in most cases), and the identified object returned. A VDR can be a distributed ledger, a blockchain, a web server, database or any other type of storage system. The process of going from the identifier to discovering and resolving the object is a DID Method (for DIDs) andAnonCreds Method (forAnonCreds objects). Resolved objects must adhere to their specified data model, regardless of the discover/resolution method used and the verifiable data registry in which the objects are stored.
- Verifiable Presentation
An AnonCreds verifiable presentation is a collection ofclaims andpredicates derived from one or morecredentials with an added proof that theverifier can verifier. AnonCreds enable the holder to prove it holds a claim from a VC without revealing the VC itself. Verifying a presentation shows theissuer of the sourcecredentials, to whom the credentials where issued, that theclaims have not been tampered with, and, if applicable, that the source credentials have not been revoked. AnonCreds presentations are designed to maximize the privacy of theholder sharing the presentation.
- Verifier
A verifier is an entity that verifies the information from aholder in apresentation.
- Zero-knowledge proof
In cryptography, a zero-knowledge proof is a method by which an entity can prove that they know a certain value without disclosing the value itself. Zero-knowledge proofs in AnonCreds enable a number of privacy-preserving capabilities.
- Prove knowledge of the value of thelink secret related to given ablinded link secret.
- Share data from multiplecredentials in a singleverifiable presentation without revealing to theverifier any correlatable identifiers.
- Useselective disclosure to reveal only necessaryclaims in averifiable presentation.
- Usepredicates to minimize the data shared by theholder, such as proving based on a date of birthclaim that they are older than 18without sharing their date of birth.
- Prove that the sourcecredentials shared in a presentation have not been revoked without sharing unique identifiers for thecredentials.
§ Cryptographic Notations
This specification contains the cryptographic calculations necessary to produce the data objects exchanged in using Hyperledger AnonCreds, and to verify the various proofs embedded in those objects. The following is information about the notations used in displaying the cryptographic calculations:
a || b
: Denotes the concatenation of octet stringsa
andb
.
I \ J
: For setsI
andJ
, denotes the difference of the two sets i.e., all the elements ofI
that do not appear inJ
, in the same order as they were inI
.
X[a..b]
: Denotes a slice of the arrayX
containing all elements from and including the value at indexa
until and including the value at indexb
. Note when this syntax is applied to an octet string, each element in the arrayX
is assumed to be a single byte.
range(a, b)
: For integersa
andb
, witha <= b
, denotes the ascending ordered list of all integers betweena
andb
inclusive (i.e., the integersi
such thata <= i <= b
).
length(input)
: Takes as input either an array or an octet string. If the input is an array, returns the number of elements of the array. If the input is an octet string, returns the number of bytes of the inputted octet string.
H(...)
: Any hash function.
Terms specific to pairing-friendly elliptic curves are:
E1, E2
: elliptic curve groups defined over finite fields. This document assumes thatE1
has a more compact representation thanE2
, i.e., becauseE1
is defined over a smaller field thanE2
.
G1, G2
: subgroups ofE1
andE2
(respectively) having prime orderr
.
GT
: a subgroup, of prime orderr
, of the multiplicative group of a field extension.
e
:G1 x G2 -> GT
a non-degenerate bilinear map.
r
: The prime order of theG1
andG2
subgroups.
P1, P2
: points onG1
andG2
respectively. For a pairing-friendly curve, this document denotes operations inE1
andE2
in additive notation, i.e.,P + Q
denotes point addition andx * P
denotes scalar multiplication. Operations inGT
are written in multiplicative notation, i.e.,a * b
is field multiplication.
§ AnonCreds Setup Data Flow
The following sequence diagram summarizes the setup operations performed by aSchema Publisher, theIssuer (one required and one optional) in preparing to issue an AnonCred credential based on providedSchema, and the one setup operation performed by eachHolder. On successfully completing the operations, theIssuer is able to issue credentials based on the givenSchema to theHolder. The subsections below the diagram detail each of these operations.
Data Registry participant SP as Schema Publisher participant I as Issuer participant H as Holder Note over L, H: Schema Publisher: Publish Schema SP ->> L: Publish Schema (Schema) L ->> I: Schema ID,
Schema Transaction ID Note over L, H: Issuer: Create, Store and Publish CredDef I ->> I: create_and_store_credential_def
(Schema, tag, support_revocation) Note right of I: store public /
private keys and
correctness proof I ->> L: Publish CredDef (CredDef) Note over L, H: Issuer: Create, Store and Publish Revocation Registry (Optional) I ->> I: create_and_store_revoc_reg (intCredDef) Note right of I: get keys Note right of I: store revoc_reg_def,
revoc_reg_accum,
priv_key,
tails_generator I ->> L: Publish RevReg
(revoc_reg_id,
revoc_reg_def_json,
revoc_reg_entry_json) Note over L, H: Holder: Create and Store Link Secret H ->> H: anoncreds_prover_create_link_secret H ->> H: store link secret rect rgb(191, 223, 255) Note left of H: 💡The "Verifier" role is
omitted in this
diagram, since
it is not required
for the setup end
Those with a knowledge of DIDs might expect that in the flow above, the firststep would be for theissuer to publish a DID. However, in AnonCreds,DIDs are not used in the processing of credentials, and notably, the public keysused in AnonCreds signatures come not from DIDs, but rather fromCredential Definition objects. DIDs may be used to identify the entity publishing theobjects that are then used in the processing of credentials – theSchema,Credential Definition,Revocation Registry Definition andRevocation Status Listobjects. There is an enforced relationship between an identifier (such as a DID)for the entity publishing the AnonCred objects, and the objects themselves. Forexample, in the Hyperledger Indy implementation of AnonCreds, for a credentialissuer to publish aCredential Definition on an instance of Indy it must have a DIDon that instance, and it must use that DID to sign the transaction to write theCredential Definition.
The DID of the publisher of an AnonCreds object MUST be identifiable from thepublished object and enforcement of the relationship between the DID and theobject must be enforced. For example, in the Hyperledger Indy implementation ofAnonCreds, the DID of the object publisher is part of the identifier of theobject – given the identifier for the AnonCreds object (e.g. one found inproving a verifiable credential), the DID of the publisher can be found.Further, the Hyperledger Indy ledger enforces, and makes available forverification, the requirement that the writing of the AnonCreds object must besigned by the DID that is writing the object.
If a DID-based messaging protocol, such asDIDComm is used betweenthe AnonCreds participants (theissuer,holder andverifier) the use of DIDs for messaging is independent of their use (or not)in the publishing AnonCreds objects. Such DIDs are used to facilitate securemessaging between the participants to enable the issuing of credentials and thepresentation of proofs.
§ Schema Publisher: Publish Schema Object
Each type of AnonCred credential is based on aSchema published to a VerifiableData Registry (VDR), an instance of Hyperledger Indy in this version ofAnonCreds. TheSchema is defined and published by theSchema Publisher. Any issuerwho can reference theSchema (including theSchema Publisher) MAY issuecredentials of that type by creating and publishing aCredential Definition based on theSchema. This part of the specification covers the operation to create andpublish aSchema. The flow of operations to publish aSchema is illustrated intheSchema Publisher: Publish Schema
section of theAnonCreds Setup DataFlow sequence diagram.
TheSchema is a JSON structure that can be manually constructed,containing the list of attributes (claims) that will be included in eachAnonCreds credential of this type. The following is an exampleSchema:
{"issuerId":"https://example.org/issuers/74acabe2-0edc-415e-ad3d-c259bac04c15","name":"Example schema","version":"0.0.1","attrNames":["name","age","vmax"]}
issuerId
- theIssuer Identifier of the schema. MUST adhere toIssuer Identifiers rules.name
(string) - the name of the schemaversion
(string) - the schema version as a documentation string that it’s not validated. The format is up to each implementor or publisher. For example, Indy usesSemantic VersioningattrNames
(str[]) - an array of strings with each string being the name of an attribute of the schema
Once constructed, theSchema is published to a Verifiable Data Registry(VDR) using the Schema Publishers selectedAnonCreds Objects Method.For example, seethisSchema that is published onthe Sovrin MainNet instance of Hyperledger Indy. TheschemaId
for that objectis:Y6LRXGU3ZCpm7yzjVRSaGu:2:BasicIdentity:1.0.0
.
The identifier for theschema is dependent on where theSchemais published and theAnonCreds method used.
§ Issuer Create and Publish Credential Definition Object
Each Issuer of credentials of a given type (e.g. based on a specificSchema) mustcreate aCredential Definition for that credential type. The flow of operations to create andpublish aCredential Definition is illustrated in theIssuer: Create, Store and Publish Credential Definition
section of theAnonCreds Setup Data Flow sequencediagram.
In AnonCreds, theCredential Definition andCredential Definition identifier include the following elements.
- A link to the Issuer of the credentials via the DID used to publish theCredential Definition.
- A link to theSchema upon which theCredential Definition is based (the credential type).
- A set of public/private key pairs, one per attribute (claim) in thecredential. The private keys will later be used to sign the claims whencredentials to be issued are created.
- Other information necessary for the cryptographic signing of credentials.
- Information necessary for the revocation of credentials, if revocation is tobe enabled by the Issuer for this type of credential.
We’ll initially cover the generation and data for aCredential Definition created without theoption of revoking credentials. In the succeedingsection, we describe theadditions to the generation process and data structures whencredential revocation is enabled for a givenCredential Definition.
§ Retrieving the Schema Object
Prior to creating aCredential Definition, the Issuer must get an instance of theSchema upon which theCredential Definition will be created. If the Issueris also theSchema Publisher, they will already have theSchema. If not, the Issuer must request that information from theVDRon which theSchema is published. In someAnonCreds Objects there is a requirement that theSchema andCredential Definitionmust be on the sameVDR.
§ Generating a Credential Definition Without Revocation Support
TheCredential Definition is a JSON structure that is generated using cryptographic primitives(described below) given the following inputs.
- ASchema and identifier for theschema for the credential type.
- A
tag
, an arbitrary string defined by the Issuer, enabling an Issuer tocreate multipleCredential Definitions for the sameSchema. - An optional flag
support_revocation
(defaultfalse
) which if truegenerates some additional data in theCredential Definition to enable credentialrevocation. The additional data generated when this flag istrue
is coveredin thenext sectionof this document.
The operation produces two objects, as follows.
- ThePrivate Credential Definition, an internally managed object that includes the private keysgenerated for theCredential Definition and stored securely by the issuer.
- TheCredential Definition, that includes the public keys generated for theCredential Definition, returned to the calling function and then published on a VDR(currently Hyperledger Indy).
The following describes the process for generating theCredential Definition andPrivate Credential Definition data.
- Build a credential schema using the schema definition.
- Build a non-credential schema that contains the single attribute
master_secret
, that will be used to hold the holder’s blinded link secret. The non-credential schema attribute is included in all AnonCreds verifiable credentials. - Generate random 1536-bit primes,, such that and are primes too.,, and, areSophie Germain and Safe primes.
- Compute.
- Compute random in the range of safe primes, using the non-credential and credential schema attributes.
- Compute random quadratic residue modulo (select a random number from to, and square it).
- Compute, and
- Credential Definition public key is and the private key is
Here is the rust implementation of the above process.
ThePrivate Credential Definition produced by the generation process has the following format:
{"p_key":{"p":"123...782","q":"234...456"},"r_key":null}
A weakness in this specification is that theIssuer does not provide akey correctness proof to demonstrate that the generated private key issufficiently strong enough to meet the unlinkability guarantees of AnonCreds.
The proof should demonstrate that:
p
andq
are both prime numbersp
andq
are not equalp
andq
are the same, sufficiently large, size- For example, using two values both 1024 bits long is sufficient, whereasusing one value 2040 bits long and the other 8 bits long is not.
TheIssuerSHOULD provide a published key correctness proof basedon the approach described inJan Camenisch and Markus Michels. Proving inzero-knowledge that a number is the product of two safe primes (pages 12-13).In a future version of AnonCreds, the additional key correctness proof could bepublished separately or added to theCredential Definition prior topublication. In the meantime,Issuers in existing ecosystems can sharesuch a proof with their ecosystem co-participants in an ad hoc manner.
The lack of such a published key correctness proof allows a maliciousIssuer to deliberately generate a private key that lacks the requirementslisted above, enabling the potential of a brute force attack that breaks theunlinkability guarantee of AnonCreds.
TheCredential Definition has the following format (based on thisexampleCredential Definition on the SovrinMainNet):
{"issuerId":"did:indy:sovrin:SGrjRL82Y9ZZbzhUDXokvQ","schemaId":"did:indy:sovrin:SGrjRL82Y9ZZbzhUDXokvQ/anoncreds/v0/SCHEMA/MemberPass/1.0","type":"CL","tag":"latest","value":{"primary":{"n":"779...397","r":{"birthdate":"294...298","birthlocation":"533...284","citizenship":"894...102","expiry_date":"650...011","facephoto":"870...274","firstname":"656...226","link_secret":"521...922","name":"410...200","uuid":"226...757"},"rctxt":"774...977","s":"750..893","z":"632...005"}}}
TheCredential Definition contains a cryptographic public key that can be used toverify CL-RSA signatures over a block ofL
messagesm1,m2,...,mL
. TheCredential Definition contains a public key fragment for each message being signed bysignatures generated with the respective private key. The length of the block ofmessages,L
, being signed is defined by referencing a specific Schema with acertain number of attributes,A = a1,a2,..
and settingL
toA+1
. Theadditional message being signed as part of a credential is for alink_secret
(called thelink secret everywhere except in the existing open sourcecode and data models) attribute which is included in all credentials. This valueis blindly contributed to the credential during issuance and used to bind theissued credential to the entity to which it was issued.
All integers within the aboveCredential Definition example json are shown with ellipses (e.g.123...789
). They are 2048-bit integers represented as617
decimal digits. These integers belong to an RSA-2048 group characterised by then
defined in theCredential Definition.
issuerId
- theIssuer Identifier of the credential definition. MUST adhere toIssuer Identifiers rules.schemaId
- (string) The identifier of theSchema on which theCredential Definition is based. The format of the identifier is dependent on theAnonCreds Objects Method used in publishing theSchema.type
- (string) The signature type of theCredential Definition. For this version of AnonCreds the value is alwaysCL
.tag
(string) - the tag value passed in by theIssuer to an AnonCred’sCredential Definition create and store implementation.value
- (object) an Ursa native object with theprimary
andrevocation
fields.primary
is the data used for generating credentials.n
is a safe RSA-2048 number. A large semiprime number such thatn = p.q
, wherep
andq
are safe primes. A safe primep
is a prime number such thatp = 2p'+ 1
, wherep'
is also a prime. Note:p
andq
are the private key for the public CL-RSA key thisCredential Definition represents.r
is an object that defines a CL-RSA public key fragment for each attribute in the credential. Each fragment is a large number generated by computings^{xri}
wherexri
is a randomly selected integer between 2 andp'q'-1
.master_secret
(also known aslink secret, but kept as master_secret for backwards compatibility) is the name of an attribute that can be found in eachCredential Definition. The associated private key is used for signing a blinded value given by theHolder to theIssuer during credential issuance, binding the credential to theHolder.- The rest of the attributes in the list are those defined in theSchema.
- The attribute names are normalized (lower case, spaces removed) and listed in theCredential Definition in alphabetical order.
rctxt
is equal tos^(xrctxt)
, wherexrctxt
is a randomly selected integer between2
andp'q'-1
. (I believe this is used for the commitment scheme, allowing entities to blindly contribute values to credentials.)s
is a randomly selected quadratic residue ofn
. This makes up part of the CL-RSA public key, independent of the message blocks being signed.z
is equal tos^(xz)
, wherexz
is a randomly selected integer between2
andp'q'-1
. This makes up part of the CL-RSA public key, independent of the message blocks being signed.
The identifier for theCredential Definition is dependent on where theCredential Definition is published and theAnonCreds method used.
§ Generating a Credential Definition With Revocation Support
The issuer enables the ability to revoke credentials produced from aCredential Definition bypassing to theCredential Definition generation process the flagsupport_revocation
astrue
.When using revocation in a credential, private key material is addedto thePrivate Credential Definition to allow the issuer torevoke credentials, and public key material is added to theCredential Definition to allow a verifier to check revocationstatus. The following describes the fields added to thePrivate Credential Definition and theCredential Definition.
The revocation scheme uses a pairing-based dynamic accumulator definedas a variant of theCKS scheme but with aType 3 elliptic curve pairing instead of a Type 1 pairing. The curve isBN254, which is definedover a 254-bit prime. The pairing is an Ate pairing where,, and is the group of rootsof unity in where, whichis another 254-bit prime.
In the amcl library used for the elliptic curve arithmetic, points arerepresented using projective co-ordinates, i.e. a point onthe curve is mapped to a projective point.Additionally, the big-integer co-ordinates are strings of 64hexadecimal characters, meaning there are up to 64 * 4 - 254 = 2 bits of‘excess’ in each encoding. The library includes the excess number ofbits as an integer (i.e.1
or2
) before the hexadecimalstring. The upshot is:
- Elements of are encoded as three 64-characterstrings of hexadecimal characters, each preceded by the excess, e.g.
1 1D1...A04 1 146...8BC 1 095...8A8
. - Elements of are encoded as six 64-characterstrings of hexadecimal characters, each preceded by the excess.
1 104...EC9 1 01A...FC2 1 226...1EB 1 234...D08 1 095...8A8 1 000...000
.
In this section, multiplicative notation is used: a pointon an elliptic curve is considered an element in the groupof points on the curve, and for an integer modulo the grouporder, we write to mean the point.
§ Private Revocation Keys
APrivate Credential Definition with revocation enabled has the following format. In this, thedetails of thep_key
element are omitted, as they are the same as was coveredinthe section above. The implementation can be found in theanoncreds-clsignatures-rs repository.
{"p_key":{"p":"123...782","q":"234...456"},"r_key":{"x":"332...566","sk":"992...237"}}
r_key
is an object defining the revocation private key for the credential.x
is an integer modulosk
is an integer modulo
The value is the order of the group on the curve BN254 (see above: is a 254-bit prime).x
andsk
are used to generate parts of the revocation public key as described below.
The issuer additionally holds a secret valuegamma
used to constructthe accumulator. This is inside theRevocationKeyPrivate
object inanoncreds-clsignatures-rs,which is separate from theCredentialRevocationPrivateKey
objectthat storessk
andx
.
§ Public Revocation Keys
ACredential Definition with revocation enabled has the following format (fromthisexample Credential Definition on theSovrin MainNet). In this, the details of theprimary
element are omitted, asthey are the same as was covered above.
{"issuerId":"did:indy:sovrin:F72i3Y3Q4i466efjYJYCHM","schemaId":"did:indy:sovrin:F72i3Y3Q4i466efjYJYCHM/anoncreds/v0/SCHEMA/state_license/4.2.0","type":"CL","tag":"latest","value":{"primary":{...},"revocation":{"g":"1 154...813 1 11C...D0D 2 095..8A8","g_dash":"1 1F0...3B5 1 229...41D 1 04B...F7D 1 061...8B7 2 095...8A8 1 000...000","h":"1 131...0DD 1 0D5...66E 2 095...8A8","h0":"1 1AF...246 1 127...361 2 095...8A8","h1":"1 242...F14 1 1AC...2FF 2 095...8A8","h2":"1 072...7A1 1 09E...622 2 095...8A8","h_cap":"1 196...C53 1 238...38B 1 196...C7E 1 198...D31 2 095...8A8 1 000...000","htilde":"1 1D5...797 1 034...232 2 095...8A8","pk":"1 0E7...A88 1 007...4B8 2 095...8A8","u":"1 18E...44B 1 018...F71 1 0D8...2C2 1 003...4CF 2 095...8A8 1 000...000","y":"1 068...F6B 1 16C...F7E 1 01F...68A 1 1E3...9F9 2 095...8A8 1 000...000"}}}
In the following, only therevocation
item is described, as the rest of items (primary
,ref
, etc.) are described in the previous section of this document.
revocation
is the data used for managing the revocation status ofcredentials issued using thisCredential Definitiong
is a generator for the elliptic curve groupg_dash
is a generator for the elliptic curve grouph
is an elliptic curve point selected uniformly at random fromh0
is an elliptic curve point selected uniformly at random fromh1
is an elliptic curve point selected uniformly at random fromh2
is an elliptic curve point selected uniformly at random fromh_cap
is an elliptic curve point selected uniformly at random fromhtilde
is an elliptic curve point selected uniformly at random frompk
is the public key in for the issuer with respect to this accumulator, computed asg^sk
(in multiplicative notation), wheresk
is fromr_key
aboveu
is an elliptic curve point selected uniformly at random fromy
is the an elliptic curve point in, computed ash_cap^x
(in multiplicative notation), wherex
is fromr_key
above
§ Publishing the Credential Definition on a Verifiable Data Registry
Once constructed, theCredential Definition is published by the Issuer to aVerifiable Data Registry using the issuers preferredAnonCreds Objects.
For example, seethisCredential Definition that is publishedin the Sovrin MainNet instance of Hyperledger Indy. Note that the contents of theCredential Definition that have are published to the Hyperledger Indy ledger, do not exactly match theCredential Definition data model. The specificAnonCreds Objects can describe how to resolve the contents stored on the ledger into theCredential Definition data model.
§ Issuer Create and Publish Revocation Registry Objects
Once theissuer has created aCredential Definition with revocationenabled, theissuer must also create and publish aRevocation Registry Definition andcreate and publish the firstRevocation Status List for the registry.
In this section, we’ll cover the create and publish steps for eachof theRevocation Registry Definition andRevocation Status List objects. The creation andpublishing of theRevocation Registry Definition includes creating and publishing theTAILS_FILE for theRevocation Registry.
§ Creating the Revocation Registry Object
A secure process must be run to create the revocation registry object, takingthe following input parameters.
revocDefType
: the type of revocation registry being created. This is alwaysCL_ACCUM
credDefId
: the ID of theCredential Definition to which theRevocation Registry is to be associatedtag
: an arbitrary string defined by the [ref: issuer], enabling an [ref: issuer] to create multipleRevocation Registry Definitions for the sameCredential Definition.maxCredNum
: The capacity of theRevocation Registry, a count of the number ofcredentials that can be issued using theRevocation Registry.tailsLocation
: A URL indicating where theTAILS_FILE for theRevocation Registry will be available to allholders of credential issued using this revocation registry.
Three outputs are generated from the process to generate theRevocation Registry: theRevocation Registry object itself, theTAILS_FILE content, and thePrivate Revocation Registry object.
§ Revocation Registry Definition Object Generation
TheRevocation Registry Definition object has the following data model. This example is fromthis transaction on theSovrin MainNet and instance of Hyperledger Indy.
{"issuerId":"did:web:example.org","revocDefType":"CL_ACCUM","credDefId":"Gs6cQcvrtWoZKsbBhD3dQJ:3:CL:140384:mctc","tag":"MyCustomCredentialDefinition","value":{"publicKeys":{"accumKey":{"z":"1 0BB...386"}},"maxCredNum":666,"tailsLocation":"https://my.revocations.tails/tailsfile.txt","tailsHash":"91zvq2cFmBZmHCcLqFyzv7bfehHH5rMhdAG5wTjqy2PE"}}
The items within the data model are as follows:
Update this to be the inputs for generating a Revocation Registry vs. the already published object
issuerId
- theIssuer Identifier of the revocation registry. MUST adhere toIssuer Identifiers rules and MUST be the sameissuerId
as theCredential Definition on which theRevocation Registry is based.revocDefType
- the type of revocation registry (This is currently alwaysCL_ACCUM
)credDefId
- The id of theCredential Definition on which theRevocation Registry is based.tag
- an arbitrary string defined by the [ref: issuer], enabling an [ref: issuer] to create multipleRevocation Registry Definitions for the sameCredential Definition.value
- The value of the revocation registry definitionpublicKeys
- Public keys data for signing the accumulator; the public key of a private/public key pairaccumKey
- Accumulator key for signing the accumulatorz
- a public key used to sign the accumulator (described further below)
maxCredNum
- The maximum amount of Credentials that can be revoked in the Revocation Registry before a new one needs to be startedtailsLocation
- The URL pointing to the related tails filetailsHash
- The hash of the tails fileTAILS_FILE (see also:next section) resulting from hashing the tails file version prepended to the tails file as SHA256 and then encoded to base58.
As noted, most of the items come directly from the input parameters provided bytheissuer. Thez
Revocation Registry accumulator public key isgenerated using (TODO: fill in details) algorithm. The use of the accumulatorpublic key is discussed in the Credential Issuance section, when the publicationof revocations is described. The calculation of the tailsHash is described inthenext section onTAILS_FILEgeneration.
The identifier for theRevocation Registry is dependent on where theRevocation Registry is published and theAnonCreds method used.
§ Tails File and Tails File Generation
The second of the outcomes from creating of aRevocation Registry is aTAILS_FILE. The contents of aTAILS_FILE is an array of calculatedpoints on curveG2
, one for each credential in the registry. Thus, if theRevocation Registry has a capacity (maxCredNum
) of 1000, theTAILS_FILE holdsan array of 1000G2
curve points. Each credential issued using theRevocation Registry isgiven its own index (1 to the capacity of theRevocation Registry) into the array,the index of the point for that credential. The contents of theTAILS_FILE is needed by theholder to produce(if possible) a “proof of non-revocation” to show their issued credential hasnot been revoked.
The process of generating the points that populate theTAILS_FILE aretail[index] = g_dash * (gamma ** index)
Detailed process for tails file generation:
- Create and open the tails file.
- To generate a tail point for an attribute located at a specific index, follow the steps.
- Convert index into an array of bytes(
u8
) using little endian ordering. - Create an element belonging to the finite field group from the
u8
array. - Calculate
pow
by doing modular exponentiation of revocation private key(gamma
) with the finite field element previously calculated. - Multiply
pow
byg_dash
, which is the generator of elliptic curve groupG2
, and this should be the required point on the curve. - Convert this tail point to an array of bytes(
u8
), and put them into the file as a slice buffer. - Repeat for all the attributes from index to, by calculating. Note that Instead of inserting in the sequence, insert the value (the first value in the sequence) in its place, and then continue with and on to. is not used by holders generating theNon-Revocation Proof and a dummy value is inserted in its place.
- Close the file buffer.
Relevant links:Anoncreds-rs repository,Anoncreds-CLSignatures repository
The process for hashing theTAILS_FILE is as follows:
- Append the tails file version and all the bytes of
G2
curve points one by one into a hasher. - Compute the hash digest using
SHA256
hashing algorithm.
The SHA256 hash of the array of points is returned to be inserted into thetailsHash
item of theRevocation Registry object (as described in theprevioussection). Typically, the array is streamed into afile (hence, the term “Tails File”) and published to aURL indicated bythetailsLocation
input parameter provided by theissuer.
The format of aTAILS_FILE is as follows:
- First two bytes are version number(currently
0u8 2u8
) - A list of the points, one per credential in the Revocation Registry. Each point is a collection of three integers implemented as points in 3 dimensions as per
ECP2
. Each point is 3x4 = 12 bytes long.
Thus the total size of a Tails File is 2+ 12*Size of the Revocation Registry
+6 (the L+1 entry).
While not required, the Hyperledger Indy community has created a component, the “Indy TailsServer,” which is basically a webserver for tails files.Holders get thetailsLocation
during theissuance process, download theTAILS_FILE (ideally) once and cache itfor use when generating proofs of non-revocation when creating a presentationthat uses its revocable verifiable credential. How theTAILS_FILE isused is covered elsewhere in this specification:
- in the section about theissuer publishing credential revocationstate updates, and
- in the section aboutholders creating a proof of non-revocation.
§ Revocation Registry Definition Object Generation
In addition to generating theRevocation Registry object, aPrivate Revocation Registry object is generated and securely stored by theissuer. The data model and definition of the items in thePrivate Revocation Registry is as follows:
To Do: Fill in the details about the Revocation Registry Definition
§ Publishing the Revocation Registry Object
Once constructed, theRevocation Registry is published by theissuer in aVerifiable Data Registry using the issuer’sAnonCreds Objects. For example, seethisRevocation Registry that is publishedon the Sovrin MainNet instance of Hyperledger Indy. The binaryTAILS_FILE associated with theRevocation Registry can be downloaded from thetailsLocation
in theRevocation Registry object.
§ Creating the Initial Revocation Status List Object
PublishedRevocation Status List objects contain the state of theRevocation Registry at a given point in time such thatholders can generate aproof of non-revocation (or not) about their specific credential andverifiers can verify that proof. An initialRevocation Status List isgenerated and published immediately on creation of theRevocation Registry so thatit can be used immediately byholders. Over time, additionalRevocation Status List objects are generated and published as the revocation status ofone or more credentials within theRevocation Registry change.
A secure process must be run to create the initialRevocation Status List object,taking the following input parameters.
revRegId
: the ID of theRevocation Registry for which the initialRevocation Status List is to be generated.- The process uses this identifier to find the associatedPrivate Revocation Registry to access the information within that object.
revocationList
- A bit array of lengthmaxCredNum
that indicates whether a credentialis initially revoked or not. The value of1
indicates the credential isinitially revoked, the value of0
indicates the credential is initially unrevoked.
The process collects from the identifiedPrivate Revocation Registry information tocalculate the cryptographic accumulator value for the initialRevocation Status List, including:
revocDefType
: the type of revocation registry. This is currently alwaysCL_ACCUM
maxCredNum
: The capacity of theRevocation Registry, a count of the number ofcredentials that can be issued using theRevocation Registry.tailsArray
: The contents of theTAILS_FILE, the array of primes,one for each credential to be issued from theRevocation Registry.privateKey
: The accumulator private key for theRevocation Registry.
With the collected information, the initial cryptographic accumulator for theRevocation Registry can be created. The format of the identifier for theRevocation Status List is dependent on theAnonCreds Objects Methodused by the issuer.
In simple terms, the cryptographic accumulator at any given point in time is the(modulo) product of the primes for each non-revoked credential in theRevocation Registry.
If all of the credentials are initially revoked (revocationList
only contains1
values), the accumulator value is0
.
The accumulator is calculated using the following steps:
To Do: Adding the algorithm for calculating the accumulator
THe following is an example of an initial, publishedRevocation Status List object:
{"revRegDefId":"4xE68b6S5VRFrKMMG1U95M:4:4xE68b6S5VRFrKMMG1U95M:3:CL:59232:default:CL_ACCUM:4ae1cc6c-f6bd-486c-8057-88f2ce74e960","revocationList":[0,1,1,0],"currentAccumulator":"21 124C594B6B20E41B681E92B2C43FD165EA9E68BC3C9D63A82C8893124983CAE94 21 124C5341937827427B0A3A32113BD5E64FB7AB39BD3E5ABDD7970874501CA4897 6 5438CB6F442E2F807812FD9DC0C39AFF4A86B1E6766DBB5359E86A4D70401B0F 4 39D1CA5C4716FFC4FE0853C4FF7F081DFD8DF8D2C2CA79705211680AC77BF3A1 6 70504A5493F89C97C225B68310811A41AD9CD889301F238E93C95AD085E84191 4 39582252194D756D5D86D0EED02BF1B95CE12AED2FA5CD3C53260747D891993C","timestamp":1669640864487}
The items in the data model are:
revRegDefId
: the identifier of the associatedRevocation Registry Definition. Theformat of the identifier is dependent on theAnonCreds Objects Methodused by the issuer.revocationList
: Bit array defining the status of the credential in the [ref: Revocation Registry]. A value of1
means the credential is revoked, a value of0
means the credential is not revoked.currentAccumulator
: the calculated cryptographic accumulator reflecting the initial state of theRevocation Registrytimestamp
: the timestamp at which the accumulator value is valid
§ Publishing the Initial Initial Revocation Status List Object
Once constructed, the initialRevocation Status List is published by theissuer in aVerifiable Data Registry using their selectedAnonCreds Objects Method.
It is not required for theVerifiable Data Registry to store the revocation list as defined in this model. For example, the Indy ledger uses deltas (Revocation Registry Entries) to store the change in revoked/un-revoked indices instead of storing the entire revocation list. It is also possible to compress therevocationList
entry using e.g. GZIP to reduce the size on the ledger.
§ Holder Create and Store Link Secret
To prepare to use AnonCreds credentials, theHolder must create alink secret, a unique identifier that allows credentials issued to aHolder to be bound to thatHolder and presented withoutrevealing a unique identifier, thus avoiding correlation of credentials byVerifiers. Thelink secret is kept private by theHolder. Thelink secret is used during the credential issuanceprocess to bind the credential to theholder and in the generation of apresentation. For the latter, it allows theholder to create a zeroknowledge proof that they were issued the credential.This proof demonstrates knowledge thelink secret and prove that it is one of the signed credential attributes, without revealing thelink secret to theverifier. The details of howthelink secret is used to do this is provided in the issuance,presentation generation and verification sections of this specification.
Thelink secret is a sufficiently random unique identifier. Forexample, in the Hyperledger Indy implementation, thelink secret isproduced by a call to the Rustuuid Crate’snew_v4()
method toachieve sufficient randomness.
Once generated, thelink secret is stored locally by theHolder for use in subsequent issuance and presentation interactions. If lost,theHolder will not be able to generate a proof that the credential wasissued to them. Theholder generates only a singlelink secret, using it for all credentials theholder is issued. Thisallows forverifiers to verify that all of the credentials used ingenerating a presentation with attributes from multiple credentials were allissued to the sameHolder without requiring theHolder todisclose the unique identifier (link secret) that binds thesecredentials together.
There is nothing to stop aHolder from generating multiplelink secrets and contributing them to different credential issuance processes.However, doing so prevents theHolder from producing a presentationcombining credentials issued to distinctlink secrets that can beproven to have been issued to the same entity. It is up to theVerifierto require and enforce the binding between multiple credentials used in apresentation.
§ AnonCreds Issuance Data Flow
The issuance of an anonymouscredential requires several steps and involves the rolesissuer,holder as well as theVerifiable Data Registry (see diagram below).
Data Registry participant I as Issuer participant H as Holder I ->> I: Create Credential Offer I ->> H: Send Credential Offer H ->> H: Verify Credential Offer opt H ->> L: Request Schema L ->> H: Return Schema end H ->> L: Request Credential Definition L ->> H: Return Credential Definition H ->> H: Create Credential Request H ->> I: Send Credential Request I ->> I: Verify Credential Request I ->> I: Issue Credential I ->> H: Send Credential H ->> H: Remove Credential Blinding H ->> H: Verify and Store Credential rect rgb(191, 223, 255) Note left of H: 💡The "Verifier" and "Schema Publisher" roles are
omitted in this diagram, since they do not participate
in the credential issuance data flow. end
Theissuer prepares aCredential Offer for theholder (step 1). ACredential Offer includes a commitment about thecredential (referencing aPublic Credential Definition) theissuer is intending to issue to theholder. Theissuer sends theCredential Offer to theholder (step 2), who evaluates the offer (step 3) and fetches data about the offer (thePublic Credential Definition) from theVerifiable Data Registry (steps 4-7).
Using the data from theCredential Offer and thePublic Credential Definition retrieved from theVerifiable Data Registry, theholder prepares aCredential Request (step 8), a formal request to theissuer to issue acredential based on the givenPublic Credential Definition to theholder. TheCredential Request includes a cryptographic commitment to theholder'slink secret. Theholder sends theCredential Request to theissuer (step 9).
Theissuer verifies and decides whether to accept theCredential Request (step 10) and if so, prepares thecredential (step 11). Theissuer sends thecredential to theholder (step 12). Theholder then removes the blinding factor from the credential (step 13), verifies thecredential and (usually) securely stores it (step 14).
Details about each step in the issuance process are covered in the following sections.
§ Credential Offer
The AnonCreds issuance process begins with theissuer constructing and sending aCredential Offer to the potentialholder. The Credential Offer contains the following JSON elements:
{"schema_id": string,"cred_def_id": string,"nonce": string,"key_correctness_proof": <key_correctness_proof>}
schema_id
: The ID of theSchema on which thePublic Credential Definition for the offeredCredential is based.cred_def_id
: The ID of thePublic Credential Definition on which theCredential to be issued will be based.nonce
: A random number generated for one time use by theissuer for preventing replay attacks and authentication between protocol steps. Thenonce
must be present in the subsequentCredential Request from theholder.key_correctness_proof
: The Fiat-Shamir transformation challenge value in the non-interactive mode ofSchnorr Protocol. It is calculated by theissuer as the proof of knowledge of the private key used to create theCredential Definition. This is verified by theholder during the creation ofCredential Request.
The JSON content of thekey_correctness_proof
is:
"key_correctness_proof":{"c":"103...961","xz_cap":"563...205","xr_cap":[["<attribute 1>","821...452"],["master_secret","156...104"],["<attribute 1>","196...694"]]}
The values in the proof are generated as follows:
c
: (aBigNumber) can be viewed as the committed value derived from the hash of the concatenated byte values in the process ofcreating the Credential Definition.
where
where, and are values in thePublic Credential Definition
are the values in the map inPublic Credential Definition, individual attribute public keys
is similar to which equals to, where is a randomly selected integer between and
is similar to, which equal to, where are randomly selected integers between and
xz_cap
:xr_cap
: for attributes
Bothxz_cap
and the second element in the tuple of thexr_cap
vectorareBigNumbers.
Theissuer sends theCredential Offer to theholder.
§ Credential Request
ACredential Request is a formal request from aholder to anissuer to get acredential based on theCredential (and the referencedPublic Credential Definition) sent by theissuer to theholder.
On receipt of theCredential Offer, theholder retrieves thereferencedPublic Credential Definition from aVerifiable Data. The holder MAY want to retrieve theSchema referenced intheCredential Offer and verify the consistency between the list ofattributes in theSchema and in thePublic Credential.
In addition, theholder also requires access to theirlink.
The nonce of theCredential Offer is used to generate the proof of correctnessfor blinded credential secrets, where it is hashed with the blinded secrets tocreate the proof which is sent to theissuer.
§ Verifying the Key Correctness Proof
Theholder must first verify thekey_correctness_proof
in theCredential Offer using data from the referencedPublic Credential Definition. Thekey_correctness_proof
data is described in theprevioussection about theCredential Offer.
Thekey_correctness_proof
verification is as follows:
- Check that all attributes inPublic Credential Definition and
master_secret
(anattribute that will be related to thelink secret) are included inxr_cap
. - Compute, where.
- If and, then. The proof is accepted.
For, we first find the multiplicative inverse of
Then
The same can be derived for all by finding the multiplicative inverse of, where {1 < i < L} for attributes.
§ Constructing the Credential Request
Theholder constructs the followingCredential Request JSON structure:
{"prover_did":"BZpdQDGp2ifid3u3Up17MG","cred_def_id":"GvLGiRogTJubmj5B36qhYz:3:CL:8:faber.agent.degree_schema","blinded_ms":{ # Structure detailed below},"blinded_ms_correctness_proof":{ # Structure detailed below},"nonce":"604812518357657692681285"}
entropy
: a required string.- Called
prover_did
in earlier AnonCreds implementations, and calledprover_id
inUrsa,entropy
is arandom alphanumeric string generated by theholder and used by theissuer to add entropy in generating the credential signature. Thevalue is combined by theissuer with the credential revocation index(cred_idx
) if the credential is revocable, and the resulting string is hashedto create thecredential_context
, an input to the credential signingprocess. Thecredential_context
is them2
item in the issued verifiablecredential signature. - Historically in Aries agent implementations, the
prover_did
was populated bytheholder with aDID they hold, usually the DIDCommpeer-to-peer DID shared by the theholder to theissuer.However, the item is not verified by theissuer as a DID nor as an identifierfor theholder, and as such an random string is sufficient. - Theholder can verify the provide
entropy
value was used by the[[ref: issuer] in generating the signature by combiningentropy
with thecred_idx
value from the issuer (if the credential is revocable), hashingthe resulting string and checking that the hash matchesm2
in thecredential signature.
- Called
cred_def_id
: The ID of thePublic Credential Definition on which theCredential to be issued will be based.blinded_ms
: Thelink secret in its blinded form. Described in detail in the sectionBlinding the Link Secret (below).blinded_ms_correctness_proof
: TheBlinded Secrets Correctness Proof of the blindedlink secret. Described in detail in the sectionThe Blinded Link Secret Correctness Proof (below).nonce
: Used for preventing replay attacks and authentication between protocol steps. Theholder creates an 80 bit nonce in the request which is a randomlygenerated number.
Once constructed, theholder sends theCredential Request to theissuer, who then can reply to theholder by sending an issued credential.
§ Blinding the Link Secret
Theholder generates ablinding factor and uses this to create a cryptographic commitment to theirlink secret. This is theblinded_ms
(blinded link secret) in theCredential Request
. Theblinded_ms
will be signed by theissuer along with the rest of the credential attributes to create a blinded Signature. Theholder removes theblinding factor from the blinded Signature to retrieve the Credential Signature over their unblindedlink secret and the credential attributes.
During presentations, theholder can prove knowledge of thelink secret within credential or set of credentials being presented, without revealing thelink secret itself. This is the capability that enables the binding of thecredentials to each other and to theholder without revealing a correlatable identifier.
Confirm purpose of the blinding factor and add how it is generated.
Theblinding factor is a secret generated by theholder for blindingthelink secret before sending it to theissuer. Theblinding factor, is created by selecting a random integer that is less than the order of the RSA group,n
.
The process of blinding the link secret uses theissuer'sCredentialPrimaryPublicKey
,, which is included in thePublic Credential Definition,and containsz
,r
,s
andn
(describedhere). Whiler
containsthe public keys for all of the attributes to be signed, the only one of interestin this process is
Thelink secret, is blinded by
is multiplied by theblinding factor,,
The resulting blinded link secret data structure inserted into theCredential Offer is defined as follows:
"blinded_ms":{"u":"331...544","ur":null, # Populated when the credential definition supports revoation"hidden_attributes":["master_secret"],"committed_attributes":{}}
Where:
u
:ur
: isnull
if revocation is not active for the [[ref: Public Credential Definition], and if revocation is active where is randomly selected quadratic residue of order of the bilinear groupsq
and is part of the revocation public key.hidden_attributes
: is an array of hidden attributes from the list of [[ref: Public Credential Definition]. For AnonCreds v1.0, it is always a single entry oflink_secret
.- Theholder's blindedlink secret is a default hidden attribute in AnonCreds, meaning it is not explicitly defined in theSchema list of attributes but is included in both thePublic Credential Definition and all issuedcredentials. Whilst it is cryptographically possible to have multiple hidden attributes, in this version of AnonCreds, onlylink secret is used.
committed_attributes
: An empty list of attributes in this version of AnonCreds.
§ The Blinded Link Secret Correctness Proof
In addition to creating the blinded link secret, theholder also creates a blinded link secret correctness proof and inserts it into theCredential Request. The data structure for the blinded link secret correctness proof is as follows:
"blinded_ms_correctness_proof":{"c":"702...737","v_dash_cap":"202...924","m_caps":{"master_secret":"907...913"},"r_caps":{}}
The values in the proof are generated as follows:
c
: (aBigNumber) can be viewed as the committed value derived from the hash of the concatenated byte values in the process ofcreating the Credential Definition and thenonce
value .
where
- is described above.
- where is randomly selected 3488-bit value and is 593-bit value by referenceAnonymous credentials with type-3 revocation by Dmitry Khovratovisch, Michael Lodder and Cam Parra
- is the nonce value.
v_dash_cap
:, where is the blinding factor and is a 3488-bit random number.m_caps
:, where is the set of all hidden attributes.r_caps
: is an empty structure in this version of AnonCreds.
§ Issue Credential
After theissuer receives theCredential Request from theholder, theissuer processes theCredential Request and decides whether to issue the credential as requested in theCredential Request to theholder. In this section, we’ll cover issuing a credential that cannot be revoked, and then cover the additional steps/data elements in issuing a credential that can be revoked.
§ Verifying the Credential Request
Before deciding to issue the credential, theissuer must first verify theCredential Request from theholder by using the nonce from credential offer () to verify the blinded link secret correctness proof.
Theblinded_ms_correctness_proof
is verified byissuer. Theblinded_ms_correctness_proof
verification is as follows:
- Compute, where.
- If, then. The proof is accepted.
For, we first find the multiplicative inverse of
Then
Once the Credential Request is verified and if theissuer decides to proceed with issuing the credential, the credential creation process is performed.
§ Encoding Attribute Data
The Anoncreds signature is not applied on the data attributes themselves, but rather on 32-byte integers encoded from the data attribute values. In the current version of AnonCreds, the process of encoding the attributes (also known as canonicalization) isa task performed by theissuer, who should do the encoding in a manner understood byall potentialverifiers such that any verifier can confirm that the revealedraw
attributes in the presentation producethe encoded value signed by theissuer. To enable the broadest possible interoperability, theHyperledger Aries community formalized thefollowing encoding rules for theraw
attribute values in an AnonCreds credential, and those rules are adopted into this specification, as follows:
- keep any integer as is
- convert any string integer (e.g. “1234”) to be an integer (e.g. 1234)
- for data of any other type:
- convert to string (use string “None” for null)
- encode via utf-8 to bytes
- apply SHA-256 to digest the bytes
- convert the resulting digest bytes, big-endian, to integer
- stringify the integer as a decimal.
An example implementation in Python of these rules can be foundhere.
A gist of test value pairs can be foundhere.
To enable broad interoperability, and to improve the security of AnonCreds byeliminating the risk of maliciousholders altering theraw
datavalues in hopes that theverifier will not check the encoding as partof the overall presentation verification, future versions of AnonCredscredentials will not includeissuer-created encoded values in the AnonCredscredentials, and will insteadrequire the encoding of theraw
data values on as needed basis.
Implementations of AnonCredsMAY
- Verify the encoded values provided by the issuer and reject the credential input if the encodingdoes not follow the encoding rules in this specification.
- Ignore theissuer-provided encoded values and calculate the encodedvalues before generating signatures based on the encoding rules above.
- Ignore the encoded values placed in credentials and/or presentations andgenerate the encoded values “on-the-fly” based on the encoding rules above.
§ Constructing a Credential
To construct a non-revocablecredential, theissuer must have available:
- The identifiers for theschema andPublic Credential Definition.
- ThePrivate Credential Definition data to be used in signing the credential.
- The
raw
value for each attribute to be included in the credential. - The
encoded
value derived from eachraw
value using theencoding attribute data rules (above). - The blinded link secret from theholder'sCredential Request.
Additional data is needed for issuing a revocable credential, as described in the sectionSupporting Revocation in a Credential.
The JSON of a generated AnonCreds credential is as follows:
{"schema_id": string,"cred_def_id": string,"rev_reg_id":null,"values":{"first_name":{"raw":"Alice","encoded":"113...335"},"last_name":{"raw":"Garcia","encoded":"532...452"},"birthdate_dateint":{"raw":"19981119","encoded":"19981119"}},"signature":{"p_credential":{"m_2":"992...312","a":"548...252","e":"259...199","v":"977...597"},"r_credential":null},"signature_correctness_proof":{"se":"898...935","c":"935...598"},"rev_reg":null,"witness":null}
schema_id
: is the ID of theSchema upon which thePublic Credential Definition was generated.cred_def_id
: is the ID for thePublic Credential Definition on which theCredential issued is based.rev_reg_id
isnull
if the credential is not revocable. A description of the element when the credential is revocable is in the sectionSupporting Revocation in a Credential.values
is the list of attributes in the credential, including for each:- the name of the attribute (in this case
first_name
,last_name
, andbirth_dateint
), - the
raw
data for the attribute, and - the
encoded
data for the attribute, derived from theraw
value has defined in theencoding attribute data rules.
- the name of the attribute (in this case
signature
is the cryptographic signature generated for the credential.- A description of the
p_signature
elements and generation process are in the sectionThe Credential Signature. r_credential
isnull
if the credential is not revocable. A description of ther_signature
elements and generation process when the credential is revocable are in the sectionSupporting Revocation in a Credential.
- A description of the
signature_correctness_proof
is theSignature Correctness Proof generated for the credential. A description of the elements and generation process are in the sectionThe Credential Signature Correctness Proof.rev_reg
isnull
if the credential is not revocable. A description of the element and generation process when the credential is revocable are in the sectionSupporting Revocation in a Credential.witness
isnull
if the credential is not revocable. A description of the element and generation process when the credential is revocable are in the sectionSupporting Revocation in a Credential.
Once constructed, theissuer sends the credential to theholder for verification and storage.
Please note the data attribute “birth_dateint” in the example above. The convention ofputting a_dateint
suffix on a credential attribute name is used to indicatethat the field contains a date in the form of an integer, such as “2022.11.21”as the integer “20221121” (the number 20,221,121). By putting the date in thatform, AnonCreds predicates can be applied to the data, such as proving “olderthan 21” based on date of birth without sharing the date of birth. Thisconvention was initially definedhereby theHyperledger Ariescommunity.
§ The Credential Signature
The credential signature elements are constructed as follows:
- Compute where is a random 2724-bit number with most significant bit as and is a random prime such that
- Compute where are primes generated during issuer setup, and is the multiplicative inverse of.
m_2
is a linkable identifier to the holder encoded in base 10 that is also called themaster_secret
in old versions. It is constructed as follows:a
is the signature of the blinded known attributes. It’s generation is given above.e
is a random prime generated by theissuer for creating signature.v
is a number generated by theholder to unblind the signature of the blinded attributes. It is constructed as follows:- , where is the blinding factor which the holder has and is a random number generated by the issuer.
§ The Credential Signature Correctness Proof
The credential signature correction proof elements are constructed as follows:
Using random, compute
where is thenonce
from credential request and is SHA-256 hashing algorithm.Signature correctness proof.
se
is the credential signature correctness proof.c
is the witness for the credential signature correctness proof.
§ Supporting Revocation in a Credential
When a credential is revocable, in addition to the listed inputs needed forconstructing a credential,theissuer also needs the ID and privateRevocation Registry data. Using the inputs, the revocation-related fields in thecredential JSON are populated. Thefollowing describes the elements and how they are produced.
rev_reg_id
is the ID of theRevocation Registry Definition published on aVerifiable Data Registry that is to be used by theholder when trying to generate a Non-Revocation Proof for this credential as part of an AnonCreds presentation.
r_credential
is the following JSON data structure:
"r_credential":{"sigma":"1 14C...8A8","c":"12A...BB6","vr_prime_prime":"0F3...FC4","witness_signature":{"sigma_i":"1 1D72...000","u_i":"1 0B3...000","g_i":"1 10D...8A8"},"g_i":"1 10D7...8A8","i":1,"m2":"FDC...283"}
The items in the data structure are:
c
: is a random number belonging in the group G2vr_prime_prime
: is also a random number belonging in the group G2sigma
: is calculated as
where, are from revocation public key, is from the blinded credential secrets, where is the issuer’s accumulator index, is from revocation public key, and is from the revocation private key.
witness_signature
:sigma_i
: is calculated asu_i
: isg_i
: is a point in curve G1 which calculated by
g_i
: is a point in curve G1 which calculated byi
: is the issuer’s accumulator indexm2
: is the credential context which acts as a linkable identifier to the holder.
rev_reg
is the following JSON data structure:
"rev_reg":{"accum":"21 118...1FB"}
The item in the data structure is:
accum
: is the accumulator value of the issuer which is updated with the new tails point as soon as new revocation credential is generated, and published to the public ledger.
witness
is the following JSON data structure:
"witness":{"omega":"21 124...AC8"}
The item in the data structure is:
omega
: is calculated by where is the current set of non revoked indices and is the number of indices contained in the accumulator.
§ Receiving a Credential
On receipt of a credential from anissuer, theholder mustverify the credential and, if verified, will likely store the credential in asecure location.
To verify thesignature_correctness_proof
, theholder does the following:
- Verify that is a prime and lies within it’s range.
- Compute
- Verify
- Compute
- Verify
The verifying and securely storing of the credential by theholdercompletes the AnonCreds issuance process.
An AnonCreds credential is expected to be retained by theholder thatparticipated in the issuance process. Theholder should not transferthe credential to others for their use, and should only use the credential togenerate an AnonCreds verifiable presentation, as outlined in theAnonCreds Presentation section of this specification.
§ AnonCreds Presentation Data Flow
Data Registry participant SP as Schema Publisher participant I as Issuer participant H as Holder participant V as Verifier Note over L, V: AnonCreds Presentation Data Flow V->>V: Create presentation request V->>H: Send presentation request H->>H: Select credentials to satisfy the presentation request H->>L: If necessary: Request revocation entries L->>H: Return revocation entries H->>H: Generate presentation H->>V: Send presentation V->>L: Request credential definitions, revocation entries L->>V: Return credential definitions, revocation entries V->>V: Verify presentation
The flow of operations to request, create, and verify a verifiable presentationis illustrated in theAnonCreds Presentation DataFlow sequence diagram.
The Verifier starts the process in step 1 by creating and sending a presentationrequest to the Holder.
In step 2, the Verifier sends the presentation request to the Holder.
In steps 3-6, the Holder collects the required information and creates theverifiable presentation to satisfy the presentation request received from theVerifier. If the Holder does not have the necessary credentials to satisfy therequest, the Holder may ignore the presentation.
In step 7, the Holder sends the verifiable presentation according to thepresentation request to the Verifier.
In step 8-10, the Verifier collects the required information and verifies theverifiable presentation and accepts it if the signature is valid, otherwiserejects the verifiable presentation.
Question: VDR access for schema, revocation etc. retrieval mandatory?
§ Create Presentation Request
Theverifier starts the presentation process in step 1 of theAnonCreds Presentation DataFlow by creating and sending apresentation to theholder.
Thepresentation request provides information about the attributes andpredicates theverifier is asking the theholder to reveal,restrictions on what verifiable credentials can be the sources for theattributes and predicates, and limitations on the freshness of the credentialrevocation status. Presentation requests are defined at the “business logic”layer, with any cryptographic processing applied. The verification processincludes verifications that the presentation satisfies the request. Theverifier SHOULD validate that the presentation satisfies the businessrequirements for which the presentation was provided.
In reading this section, the termattribute
is used in two ways, and readersshould be aware of the context of each use. A presentation request has **requestedattributes that are to be included in the presentation provided from theholder. Those requested attributes in turn referenceattribute names andvalues from source verifiable credentials held by theholder.
Thepresentation request is created by theverifier in JSON format, as follows:
{"name": string,"version": string,"nonce": string,"requested_attributes":{"<attr_referent>": <attr_info>, ...,},"requested_predicates":{"<predicate_referent>": <predicate_info>, ...,},"non_revoked": Optional<non_revoc_interval>,"ver": Optional<str>}
name
is a string set by theverifier, a name for thepresentation request.version
is a string set by theverifier, the version of thepresentation requestnonce
is a string, a decimal, 80-bit number generated by theverifier thatSHOULD be unique perpresentation request. The nonce is included in the requestto prevent replay attacks through its use in creating and verifying the presentation.requested_attributes
specify the set of requested attributesattr_referent
is a verifier-defined identifier for the requested attribute(s) to be revealed.attr_info
describes a requested attribute. Seeattr_info
requested_predicates
specify the set of requested predicatespredicate_referent
is a verifier-defined identifier for the requested predicate.predicate_info
describes a requested predicate. Seepredicate_info
non_revoked
specifies an optional non-revocation intervalnon_revoc_interval
. See theRequest Non-RevocationProofs section.ver
is an optional string, specifying thepresentation request version.- If omitted, “1.0” is used by default.
- “1.0” to use unqualified identifiers for restrictions
- “2.0” to use fully qualified identifiers for restrictions
attr_info
has the following format:
{"name": <string>,"names": <[string, string]>,"restrictions": <restrictions>,"non_revoked": <non_revoc_interval>,}
All of the items are optional, but one ofname
ornames
MUST be included, and not both.
name
is a string, the name of an attribute from a source credential.- The name is case insensitive with spaces ignored.
names
is a array of strings, the names of attributes from a sourcecredential- The names are case insensitive with spaces ignored.
- The attribute names MUST be sourced from a single credential.
restrictions
is a condition on the source credential that can be used tosatisfy this attribute request.- Seerestrictions for details about supported restrictions.
- Omitting
restrictions
implies that:- Theholder MAY provide self-attested attributes for the request in thepresentation, or
- that the name(s) of the requested attributes match the name(s) of theclaim(s) in the source verifiable credential.
non_revoked
specifies a non-revocation intervalnon_revoc_interval
forthis requested attribute.- SeeRequest Non-Revocation Proofs section.
- If
non_revoked
is defined at the outer level of the JSON and is notdefined at theattr_info
level, the out level data applies to theattribute. - If
non_revoked
is defined at the outer level of the JSON AND at theattr_info
layer, theattr_info
data applies to the attribute.
predicate_info
has the following format:
{"name": string,"p_type": string,"p_value": int,"restrictions": <restrictions>,"non_revoked": <non_revoc_interval>,}
name
(required) is a string, the name of an attribute from a sourcecredential to use in the predicate expression.- The name is case insensitive and spaces are ignored.
- To be useful, the attribute in the source credential MUST be an integer, butthat requirement cannot be enforced. Theverifier MUST understand how the attribute value isset by the issuer(s) in the expected source credentials.
p_type
is a string, the type of the predicate. Possible type values are[“>=”, “>”, “<=”, “<”].p_value
is an integer value.- The boolean expression that is to proven in zero knowledge is evaluated as:“
<name> <p_type> <p_value>
.” For example, to check an “older than” basedon date of birth, the expression might be “birth_dateint <= 20020116
”
- The boolean expression that is to proven in zero knowledge is evaluated as:“
restrictions
is a condition on the source credential that can be used tosatisfy this predicate request.- Seerestrictions for details about supported restrictions.
- If omitted, the only restriction on the requested predicate is that the
name
matches the attribute name in the source credential used to satisfy thepredicate.
non_revoked
specifies a non-revocation intervalnon_revoc_interval
forthis predicate attribute.- SeeRequest Non-Revocation Proofs section.
§ Restrictions
Therestrictions
item on attributes (optional) and predicates (required) is aJSON structure that forms a logical expression involving properties of thesource verifiable credential. Theholder must use source verifiablecredentials that satisfy therestrictions
expression for eachattribute/predicate entry. Each element of the logic expression is a property ofsource credentials and a value to be matched for that property. The followingproperties can be specified in the JSON. All except themarker
property isspecified with a value that must match the property. For themarker
property,the value is always1
.
schema_id
- the identifier of the schema upon which the source credential isbased.schema_issuer_did
- the identifier, usually aDID, of the publisherof the schema upon which the source credential is based.schema_name
- thename
property of the schema upon which the sourcecredential is based.schema_version
- theversion
property of the schema upon which the sourcecredential is based.issuer_did
- the identifier, usually aDID, of the [[re: issuer]] of thesource credential.cred_def_id
- the identifier of theCredential Definition of thesource credential.attr::<attribute-name>::marker
- an attribute<attribute-name>
must exist in the source credential.- When used, the value of the JSON item must be “1”.
attr::<attribute-name>::<attribute-value>
- the attribute<attribute-name>
must be found in the source credential with a value of<attribute-value>
.- When this property is used, theverifer MUST request that the
<attribute-name>
be revealed as otherwise there is no way to be sure therestriction has been satisfied.
- When this property is used, theverifer MUST request that the
A boolean expression is formed by ORing and ANDing the source credentialproperties. The following JSON is an example. Any of the source credentialproperties listed above can be used in the expression components:
"restrictions":[{"issuer_did":"<did>","schema_id":"id"},{"cred_def_id":"<id>","attr::color::marker":"1","attr::color::value":"red"}]
The properties in each list item are AND’d together, and the array elements areOR’d together. As such, the example above defines the logical expression:
The attributes must come from a source verifiable credential such that: issuer_did = <did> AND schema_id = <id> OR cred_def_id = <id> AND the credential must contain an attribute name "color" AND the credential must contain an attribute name "color" with the attribute value "red"
§ Request Non-Revocation Proofs
Thepresentation request JSON itemnon_revoked
allows theverifier to define an acceptable non-revocation interval for a requestedattribute(s) / predicate(s), as follows:
{"from": Optional<int>,"to": Optional<int>,}
from
is an unsigned long long value, theUnix Time timestamp of theinterval beginning.to
is an unsigned long long value, theUnix Time timestamp of theinterval end.
As noted in thepresentation request specification above, anon-revoked
itembe may at the outer level of thepresentation request such that it applies toall requested attributes and predicates, and/or at the attribute/predicate level, applyingonly to specific requested attributes and/or predicates and overriding the outer layer item.
Thenon-revoked
items apply only to requested attributes/predicates in a presentationthat derive from revocable credentials. No proof of non-revocation is needed (orpossible) from credentials that cannot be revoked. Verifiers should be awarethat different issuers of the same credential type (sameschemaId
) may or maynot use revocation for the credentials they issue.
The use of a “non-revoke interval” was designed to have the semantic meaningthat theverifier will accept a non-revocation Proof (NRP) from anypoint in thefrom
toto
interval. The intention is that by being as flexibleas the business rules allow, theholder and/orverifier mayhave cachedVDR revocation data such that they don’t have to go to theVDR to get additionalRevRegEntry data. The verification ofthe provided non-revocation interval in apresentation request islimited. For additional details, see theVerify Non-Revocation Proof section of thisspecification.
In practice, the use of the interval is not well understood and tends to causeconfusion amongst those buildingpresentation requests. The AnonCredscommunity recommends using matchingfrom
andto
values as outlined in theAries RFC 0441 Present Proof BestPractices.Theverifier can then use business rules (outside of AnonCreds) todecide if the revocation is sufficiently up to date.
While one might expect theto
value to always be the current time (“Prove thecredential is not revoked now”), its inclusion allows theverifier toask for a non-revocation proof sometime in the past. This addresses use casessuch as “Prove that your car insurance policy was not revoked on June 12, 2021when the accident occurred.”
§ Presentation Request Example
The following is an example of a fullpresentation request for a presentationfor a set of revealed attribute names from a single source credential, a self-attestedattribute, and a predicate.
{"nonce":"168240505120030101","name":"Proof of Education","version":"1.0","requested_attributes":{"0_degree_uuid":{"names":["name","date","degree"],"restrictions":[{"schema_name":"degree schema"}]},"0_self_attested_thing_uuid":{"name":"self_attested_thing"},"non_revoked":{"from":1673885735,"to":1673885735,}},"requested_predicates":{"0_age_GE_uuid":{"name":"birthdate_dateint","p_type":"<=","p_value":20030101,"restrictions":[{"schema_name":"degree schema"}]}}}
In step 2 of theAnonCreds Presentation Data Flow,theverifier sends thepresentation request to theholder.
§ Generate Presentation
In step 3, 4, and 5 of theAnonCreds Presentation DataFlow, theholder collects the requiredinformation to create the verifiable presentation according to thepresentation request receivedfrom theverifier.
Each attribute and predicate in the presentation request must be satisfied by asource credential held by theholder that meets the associatedrestrictions
item in the presentation request. The same source credential MAYbe used to satisfy multiple attributes and predicates. Each attribute in thepresentation request may specify (using thenames
item) that multipleclaims from the source credential must be shared. If there is norestrictions
itemin the presentation request, theholder MAY satisfy the presentation requestwith self-attested attributes.
To prevent confusion, the term “attribute” in this sectionalways refers totherequired_attributes
in a presentation request, and the term “claim” isused for the data elements in a verifiable credential.
Theverifier may specify in the presentation request that if some orall of the attributes/predicates are to be satisfied by revocable credentials,theholder must accompany the verifiable credential proofs withnon-revocation proofs (NRPs) for the source credentials. The generation of NRPsis describedin the generate non-revocation proofssection of the specification.
Often in discussions about verifiable presentations, the term “prover”is used to indicate the participant generating the presentation. Throughout theHyperledger AnonCreds implementation the termprover
is used in the names ofmethods performed by that participant. However, because in AnonCreds theholder and theprover are always the same entity, we’ll useholder to refer to the participant generating the requested presentation toemphasize that the same entity is both issued credentials and generatingpresentations from those credentials.
§ Collecting the Source Verifiable Credential Data
Before theholder can generate the presentation to satisfy a request,the source verifiable credentials that will be used in the presentation must becollected.
The source verifiable credentials found for use in generating a presentationmust meet the following requirements:
- All of the source credentials MUST have been issued to the same link secret.
- The source credential for each presentation request attribute and predicatemust satisfy the attribute’s or predicate’s associated
restrictions
item,and must include claim names that match the attribute’sname
ornames
item, or claim name that match the requested predicate.
The mechanism to find the credentials in the holder’s wallet that satisfy apresentation request is outside the scope of this specification. As such, theremainder of this section covering how this process is done in Hyperledger Ariesimplementations is non-normative.
Aries implementations have historically used a mechanism calledWallet QueryLanguage (WQL) to find the source credentials in theholder agent’sstorage. Agents iterate through the presentation request attributes andpredicates, converting therestrictions
item from each into a correspondingWQL query, and calling an Aries key management service, such asAries Askar,to return the credentials in the wallet that satisfy the query.
Completing the process results in a list of 0 or more source verifiablecredentials that satisfy each attribute and predicate. If there is not a sourceverifiable credential for each, a business process must be invoked to decide ifor how to proceed. For example, if some of the attributes or predicates cannotbe satisfied with a credential already in theholder's storage, aprocess to get the necessary additional verifiable credentials may be initiated.If more than one verifiable credential satisfy any of therestrictions
items,theholder software might select one to use by default, such as themost recently issued, non-revoked of the credentials, and/or might invoke a userinterface to allow the entity that controls theholder software toselect from the set of possible credentials to use.
In order to proceed to the presentation generation step, there must be onecredential selected for each attribute and predicate in the presentationrequest.
§ Prepare Inputs to Presentation Generator
The next step of the process to create a presentation is to prepare the inputsto a call to AnonCreds to generate the presentation. The following are theinputs to the generation process(implementation).The holder must prepare each of the inputs by getting data either from localstorage or, in the case of public data, retrieving it from the appropriateverifiable data registry(ies). AnonCreds implementations may provide functionsto help in preparing some of the data.
pres_req
– The presentation request from theverifier.credentials
– The list of credentials chosen by the holder for use in the presentation, including the request attributes and predicates to be populated from the each of the credentials. See note below.self_attested
- A Hash Map containing each attribute to be satisfied with a self-attested response. Each entry includes the name of a presentation request attribute, and the self-attested value for that attribute.link_secret
- The link secret for the credentials in the presentation.schemas_json
- A Hash Map containing theSchemaId
and completeSchema
for theschemas of the credentials in the presentation.credential_defs_json
- A Hash Map containing theCredentialDefinitionId
and the completeCredentialDefinition
for the credential definitions of thecredentials in the presentation. Included in theCredentialDefintion
are therevocation related values of theCredentialDefinition
.
Thecredentials
data structure contains for each listed credential:
- The complete
credential
data structure, as received from theissuer. - A list of the presentation request attributes and predicates that will bepopulated from the credential.
- For each of the source credential claim to be included in a requestattribute, an indicator if the credential is to be revealed or not(
true
/false
) in the presentation.
- For each of the source credential claim to be included in a requestattribute, an indicator if the credential is to be revealed or not(
- The
timestamp
for the selectedRevRegEntry that will be used toproduce the non-revocation proof, if required. - The
witness
for the credential based on theRevRegEntry being usedto produce the non-revocation proof, if needed.
If the credential is not revocable, the latter two inputs arenull
, and arenot used. See the later section ongenerating a presentation for a revocablecredential for details about populatingthetimestamp
andwitness
data elements.
The indicator of whether a claim is to be revealed or not in AnonCreds 1.0 mustbe carefully understood by verifiers. While a verifer requests a set of claimsfrom the prover, the prover may choose to not reveal theraw
value of some ofthose claims. If the prover does not reveal all of the requested claims,AnonCreds treats the presentation as cryptographically verified. It is thenup to the verifier to decide, after cryptographic verification, if apresentation with unrevealed values is acceptable for the business purpose ofthe presentation.
§ Generate the Presentation
From the inputs, the presentation data is generated and put into the followingdata structure:
presentation_request
– The presentation request from the verifier.presentation
– The set of proofs generated to satisfy the presentationrequest, including:- For each source credential, a primary
eq_proof
of the issuer signatureacross all of the claims in the credentials. - For each source credential that is revocable and for which the verifierhas requested proof of non-revocation, a non-revocation proof,
non_revoc_proof
.- See the specification section onnon-revocation-proofgeneration for details on this datastructure.
- For each requested predicate, a primary
ge_proof
(predicate) proof basedon the requested claim from a source credential, the boolean operator (one of<=, <, >, >=
), and the comparison value in the presentation requestpredicate. - One aggregate proof,
aggregated_proof
, across all of the source credentialsthat proves that the same link secret was used in the issuance of all of thecredentials. - The mapping from each of the requested attributes and predicates to theprimary proofs that satisfies the request.
- A mapping for the requested attributes of the
raw
andencoded
values from each revealed source credential claim. - A list of the self-attested attributes provided for the requestedattributes that permit self-attested attributes.
- A list of the unrevealed attributes.
- A mapping of the requested predicates to the
ge_proof
that satisfies therequest.
- A mapping for the requested attributes of the
- An array
identifiers
containing theschemaId
andcredDefId
for eachsource credential in the presentation.- Also included for each source credentials for which a non-revocation proofis provided is the
revRegDefId
and thetimestamp
of theRevocation Registry Entry used in the non-revocation proof.
- Also included for each source credentials for which a non-revocation proofis provided is the
- For each source credential, a primary
The following is an example of a multi-credential presentation withoutrevocation.
Replace this example with one that includes:
- two request attributes
- one predicate request
- one unrevealed attribute
- one self-attested attribute
{"presentation_request":{"nonce":"182453895158932070575246","name":"Step 3 Send your Health Information","version":"1.0","requested_attributes":{"biomarker_attrs_0":{"names":["name","concentration","unit","range","collected_on","biomarker_id","researcher_share"],"restrictions":[{"schema_name":"MYCO Biomarker","attr::name::value":"Iron"}]},"consent_attrs":{"restrictions":[{"schema_name":"MYCO Consent Enablement","schema_version":"0.1.0","attr::jti_unique_identifier::value":"205b1ea0-7848-48d4-b52b-339122d84f62"}],"name":"jti_unique_identifier"}},"requested_predicates":{}},"presentation":{"proof":{"proofs":[{"primary_proof":{"eq_proof":{"revealed_attrs":{"biomarker_id":"33034450023603237719386825060766757598085121996569112944281451290292212516012","collected_on":"92231735610070911075924224447204218356256133056723930517696107260511721601349","concentration":"10","name":"85547618788485118809771015708850341281587970912661276233439574555663751388073","range":"106828626115908025842177441696860557581575579893927923198365300598359723920768","researcher_share":"101264834079306301897660576123112461042861436742738894013248454492965796383403","unit":"38351211041892038382023569421847544683371072212679556578649761181279472893849"},"a_prime":"80156520245352052628208149565161465200964633377479145197038408116901327106468493831807000641577246417448908134495822028339761705905365398613527463662816881507291787145610182891716009505407072490691097943029471835157968113065071523597746984296197661560454442163361095634052138951650373193896962906203169809352467024247772052836999799731422581068645748537557874869718897034120634529002420631012358510111427944993245065350416694516913472010105229188198167306183788520891926236449848811955646933539477960935319919207451858981065765523367984374104834278565184338252025155136368869580505679884921590811310587077071610172673","e":"115602723672843258810892161808995599340414281260248127600708536325470178701996999306086286379312077726886107268519700961209712187789855371","v":"1250383260306407741656763352595256748825474237767244783206569756476708112785930898966696687140808011529311298553822794830872826226191807175199015541611342880032928005827271961840046208463350458298210749103878893742434685172894883857423865293195542824393317226300133796527531436931435189766065404966370796699897584860421160155369018136946091524266742514828667575397735892093187106092545876795688095293610064164136737808333322708435913545499149948994191514980395955519036106660001526586674248282052492138917987323789012051794441548696998993861159018178474063785171288325900474499496141522583368982451169653258746506425495702762445790848698570457196767532483566475068200091609719957656394696938689265240025099424248587121592521826940348286940172887963179718337593603053496022182071613592070622825622277436966372346642772481567879001423472517233061740522533372490151585309457871632521280719357505751796940152868034526426510835","m":{"master_secret":"3455871040557234123393960708120725061759594951341120214330342075748561632734634451036095543889895409812764789858455375956895105746442946098665140470124325622343440794421325163223","client_share":"4233663763294709836704307308997831519311512039775169744174375585917035614714239153287862168426091336550799195245481707264207548331415960277065672755643752404180562900805493953484"},"m2":"12942698897200869280316481431207639453433287089474860040781378232999349549981799159560238504559317917040820580596635945161264308025301203452846862479261473387068350544024561412435"},"ge_proofs":[]}},{"primary_proof":{"eq_proof":{"revealed_attrs":{"jti_unique_identifier":"46414468020333259158238797309781111434265856695713363124410805958145233348633"},"a_prime":"52825780315318905340996188008133401356826233601375100674436798295026172087388431332751168238882607201020021795967828258295811342078457860422414605408183505911891895360825745994390769724939582542658347473498091021796952186290990181881158576706521445646669342676592451422000320708168877298354804819261007033664223006892049856834172427934815827786052257552492013807885418893279908149441273603109213847535482251568996326545234910687135167595657148526602160452192374611721411569543183642580629352619161783646990187905911781524203367796090408992624211661598980626941053749241077719601278347846928693650092940416717449494816","e":"40342480172543061520030194979861449480343743039487113094246205723322643070249538229638327935935486373873622430409109409257546971244601965","v":"217871997575635857881367472262154388060800564043554848081521162883333745687724235201324121915821236796357195214089699645741515836727882126142579489701412861659136426497703162695983681701205672924385915403141611021784136285588350763399255203187442277784718461565122805239422370067600654500115262174706580098147603414365915243447789285877195068031630371954678432401446457453517813298670236942253026249413255471803997869331683293818651006043399070308083119054618677128448043841313844695654424369871669436628257531643623230026240200330490039607166147891705813033761093730859310423856156850596341547950105490585959768382544221555877471751940512766452511773683786023245283041103270102119125303027835868565240336923422734962345750992898991606841120358203160628015844345063465293475128118937815965000466081345494616126511595974927544434058100817176268040385848789013718618727873445834393897904247054897801708217939187593785671914","m":{"iat_consent_timestamp":"7919242808448912829024078929834347184203169048480606699350973804205285806978474375691141504249426249676222104091995582731720654507393708298132400435805626192291975477967402460279","master_secret":"3455871040557234123393960708120725061759594951341120214330342075748561632734634451036095543889895409812764789858455375956895105746442946098665140470124325622343440794421325163223","data_controller":"16070549690575784944224634793654539357398383214512772967411296056738507137421264813779497172425030465490587794790393434847583852932544021088761347641812155158324233253206392974293","notice":"2790610958721083178459621377821800672322230987466716467063649577108407884592339521820875278264969393963213925568888672412150769438560815981777952572004955362915245795447078373509","sensitive":"13552814315985495030467505807226704038231487014593307078913973520081443107274508887651839292151852713782653522711975492131914644109941607616672243509214979259100892541150351227883","services":"14860984314279608355643170908802532226194914773406547259519961082467311361623076451869406343140860447342041426195737612897540117192702117380288330928866665314831926780606136352645","sub_subject_identifier":"11736177517163751882849070942823049196298287414132249166618760803125435466270948777194044507635346721244111946358927525083691171695431736819244809221351813271261283779276670885101","moc_method_of_collection":"10026360820367693771310999595495505533281326977349798360729122862705999157070660881611421445424239119786180921960380892002204780026072600494332540208429642332890963846523547470729","jurisdiction_data_processing":"15829143141425514118932461858094583045441924952665872659029333578019676797278419825311275014912077620757631693167948665554731430154156737419706553672424812320891308795411687679270","iss_internet_processing_uri":"6900796243066434651671715348976599009606292569990892886896520779618011026060325075822786686418461731663661832508437549373109822105600719490952253743950241384782222356411498407620","version_consent_specification":"7796257942256624260327966366702213561879098947042014532961291550019706546662478888172243088973621029223408695289700984802154645011280488167967047321149956253054269901250137513345","policy_url":"12241676508867847022708464707584814145889660003604359058532137895063826021524887759921830911553663255421852525705197991376264187781979066233701110706958983099645275940668404311601"},"m2":"6509130065158989037891281073557909501783443634141673890142284302459280804904096303151728187237486991775852971807701594247754409108836089746736345158069365449802597798950172729241"},"ge_proofs":[]}}],"aggregated_proof":{"c_hash":"81763443376178433216866153835042672285397553441148068557996780431098922863180","c_list":[[2,122,246,66,85,35,17,213,1],[1,162,117,246,95,154,129,32]]}},"requested_proof":{"revealed_attrs":{"consent_attrs":{"sub_proof_index":1,"raw":"205b1ea0-7848-48d4-b52b-339122d84f62","encoded":"46414468020333259158238797309781111434265856695713363124410805958145233348633"}},"revealed_attr_groups":{"biomarker_attrs_0":{"sub_proof_index":0,"values":{"researcher_share":{"raw":"bf712cb328a92862b57f0dc806dec12a","encoded":"101264834079306301897660576123112461042861436742738894013248454492965796383403"},"unit":{"raw":"μM","encoded":"38351211041892038382023569421847544683371072212679556578649761181279472893849"},"concentration":{"raw":"10","encoded":"10"},"name":{"raw":"Iron","encoded":"85547618788485118809771015708850341281587970912661276233439574555663751388073"},"range":{"raw":"9.00-30.0","encoded":"106828626115908025842177441696860557581575579893927923198365300598359723920768"},"collected_on":{"raw":"2020-07-05","encoded":"92231735610070911075924224447204218356256133056723930517696107260511721601349"},"biomarker_id":{"raw":"c9ace7dc-0485-4f3f-b466-16a27a80acf1","encoded":"33034450023603237719386825060766757598085121996569112944281451290292212516012"}}}},"self_attested_attrs":{},"unrevealed_attrs":{},"predicates":{}},"identifiers":[{"schema_id":"CsQY9MGeD3CQP4EyuVFo5m:2:MYCO Biomarker:0.0.3","cred_def_id":"CsQY9MGeD3CQP4EyuVFo5m:3:CL:14951:MYCO_Biomarker"},{"schema_id":"FbozHyf7j5q7TDn2s8MXZN:2:MYCO Consent Enablement:0.1.0","cred_def_id":"TUku9MDGa7QALbAJX4oAww:3:CL:531757:MYCO_Consent_Enablement"}]}}
Once the presentation data structure is generated, it is sent to the verifierfor processing.
The following describes the data structures listed above, including theprocess of generating the data of the various types of proofs.
The Presentation Request
Thepresentation_request
is a copy of thepresentation_request
data structure fromthe verifier, as describedearlier in the specification.
Presentation
Thepresentation
contains:
- Proofs of the source credentials.
- An aggregated proof across all of the source credentials.
- A mapping of how the requested attributes and predicates are satisfied.
- A list of the identifiers related to each of the source credentials in theproof.
Thepresentation
data structure is as follows. As noted in the JSON commentsincluded, details for each section of thepresentation
is provided below.
"presentation":{"proof":{"proofs":[{"primary_proof":{"eq_proof":{ # Described in detail below},"ge_proofs":[ # Described in detail below]}}],"aggregated_proof":{ # Described in detail below}},"requested_proof":{ # Described in detail below}"identifiers":{ # Described in details below}}
Theproofs
array contains an entry for each source verifiable credential.For each is aprimary_proof
covering the claims in the source credential calledtheeq_proof
, and age_proof
for each of the predicate proofs sourced fromthe verifiable credential.
Generating the Challenge Hash
For this step theholder follows the following steps:
Generate a random 592-bit number for each (unrevealed attributes)
For each credential and issuer’s public key:
- Choose random 3152-bit.
- Take from and compute:
and add them to.
- Compute.
- Generate random 456-bit and random 3748-bit number.
- Hide the unrevealed attributes using:
and add them to
Load from issuer’s public key
For each predicate where operator * is one of:
- Calculate such that
- Calculate such that :
- Find (by exhaustive search) such that:
Generate random 2128-bit numbers.
Blind values of and by computing:
and add these values to in the order.
Generate random 592-bit numbers, random 672-bit numbers, and random 2787-bit.
Compute:
and add these values to in order.
Finally, theholder computes the Fiat-Shamir challenge hash():
where is the nonce sent byverifier in proof request.
Each primaryeq_proof
is generated as follows:
- For primary credential compute:
where is the set of unrevealed attributes.
- Compute
- Data attributes in
eq_proof
are:
"eq_proof":{"revealed_attrs":{"jti_unique_identifier":"46414468020333259158238797309781111434265856695713363124410805958145233348633"},"a_prime":"52825780315318905340996188008133401356826233601375100674436798295026172087388431332751168238882607201020021795967828258295811342078457860422414605408183505911891895360825745994390769724939582542658347473498091021796952186290990181881158576706521445646669342676592451422000320708168877298354804819261007033664223006892049856834172427934815827786052257552492013807885418893279908149441273603109213847535482251568996326545234910687135167595657148526602160452192374611721411569543183642580629352619161783646990187905911781524203367796090408992624211661598980626941053749241077719601278347846928693650092940416717449494816","e":"40342480172543061520030194979861449480343743039487113094246205723322643070249538229638327935935486373873622430409109409257546971244601965","v":"217871997575635857881367472262154388060800564043554848081521162883333745687724235201324121915821236796357195214089699645741515836727882126142579489701412861659136426497703162695983681701205672924385915403141611021784136285588350763399255203187442277784718461565122805239422370067600654500115262174706580098147603414365915243447789285877195068031630371954678432401446457453517813298670236942253026249413255471803997869331683293818651006043399070308083119054618677128448043841313844695654424369871669436628257531643623230026240200330490039607166147891705813033761093730859310423856156850596341547950105490585959768382544221555877471751940512766452511773683786023245283041103270102119125303027835868565240336923422734962345750992898991606841120358203160628015844345063465293475128118937815965000466081345494616126511595974927544434058100817176268040385848789013718618727873445834393897904247054897801708217939187593785671914","m":{"iat_consent_timestamp":"7919242808448912829024078929834347184203169048480606699350973804205285806978474375691141504249426249676222104091995582731720654507393708298132400435805626192291975477967402460279","master_secret":"3455871040557234123393960708120725061759594951341120214330342075748561632734634451036095543889895409812764789858455375956895105746442946098665140470124325622343440794421325163223","data_controller":"16070549690575784944224634793654539357398383214512772967411296056738507137421264813779497172425030465490587794790393434847583852932544021088761347641812155158324233253206392974293","notice":"2790610958721083178459621377821800672322230987466716467063649577108407884592339521820875278264969393963213925568888672412150769438560815981777952572004955362915245795447078373509","sensitive":"13552814315985495030467505807226704038231487014593307078913973520081443107274508887651839292151852713782653522711975492131914644109941607616672243509214979259100892541150351227883","services":"14860984314279608355643170908802532226194914773406547259519961082467311361623076451869406343140860447342041426195737612897540117192702117380288330928866665314831926780606136352645","sub_subject_identifier":"11736177517163751882849070942823049196298287414132249166618760803125435466270948777194044507635346721244111946358927525083691171695431736819244809221351813271261283779276670885101","moc_method_of_collection":"10026360820367693771310999595495505533281326977349798360729122862705999157070660881611421445424239119786180921960380892002204780026072600494332540208429642332890963846523547470729","jurisdiction_data_processing":"15829143141425514118932461858094583045441924952665872659029333578019676797278419825311275014912077620757631693167948665554731430154156737419706553672424812320891308795411687679270","iss_internet_processing_uri":"6900796243066434651671715348976599009606292569990892886896520779618011026060325075822786686418461731663661832508437549373109822105600719490952253743950241384782222356411498407620","version_consent_specification":"7796257942256624260327966366702213561879098947042014532961291550019706546662478888172243088973621029223408695289700984802154645011280488167967047321149956253054269901250137513345","policy_url":"12241676508867847022708464707584814145889660003604359058532137895063826021524887759921830911553663255421852525705197991376264187781979066233701110706958983099645275940668404311601"},"m2":"6509130065158989037891281073557909501783443634141673890142284302459280804904096303151728187237486991775852971807701594247754409108836089746736345158069365449802597798950172729241"},
revealed_attrs
: The mapping of revealed attributes with their values.a_prime
: This is the value generated during init proof and challenge hash calculatione
: The value of in the proof.v
: The value of in the proof.m
: The hashmap containing hidden attribute name with calculated value.m2
: The value of in the proof.
Each primaryge_proof
is generated as follows:
- For each predicate compute:
- Data attributes in
ge_proof
are:
ge_proofs:[{ u, r, mj, alpha, t, predicate}]
u
: The hashmap containing values of in the proof.r
: The hashmap containing values of, and in the proof.mj
: of the concerned predicate obtained from the equality proof.alpha
: The value of in the proof.t
: The hashmap containing values of, and from the init proof.predicate
: The concerned predicate from the proof request.
Theaggregated_proof
proves that the samelinked secret was used toissue all of the source verifiable credentials in the presentation.
Theaggregated_proof
structure is as follows:
"aggregated_proof":{"c_hash":"base10string","c_list":[["base10string"]]}
Here is an example:
"aggregated_proof":{"c_hash":"81763443376178433216866153835042672285397553441148068557996780431098922863180","c_list":[[2,122,246,66,85,35,17,213,1],[1,162,117,246,95,154,129,32]]}
where:
c_hash
is the fiat shamir challenge hash,c_list
is the list of commitments that we calculated during the challenge hash generation. It’s size depends on the number of attributes to prove in a credential, and it is generated seperately for each credential.
Therequested_proof
is the mapping from the presentation request attributesand predicates to the data in the presentation that satisfies the request. Thisis divided into five parts:
- The request attributes, where a single attribute
name
is requested. - The request attribute groups, where a set of
names
are requested from a single source credential. - Request attributes without
restrictions
that are satisfied with self attested attributes. - Request attributes that are unrevealed.
- Request predicates.
A JSON summary, with comments, for the data in each of the parts is listed below:
Revealed Attributes
An entry for each singlename
request attribute from the presentation request.
"revealed_attrs":{"consent_attrs":{ # The request attribute name from the presentation request"sub_proof_index":1, # The index of the source credential primary proof for the claim"raw":"205b1ea0-7848-48d4-b52b-339122d84f62", # The raw and encoded claim values"encoded":"46414468020333259158238797309781111434265856695713363124410805958145233348633"}}
It is important for all verifiers to understand that the revealed attributeproof (eq_proof
described earlier) is a proof on theencoded
value, not ontheraw
value. As such, it is up to the verifier to know the “raw to encoded”algorithm used by the issuer, and to verify that the revealedraw
value properlyencodes to the provenencoded
value. It is possible for a malicious holder toput an unrelatedraw
value into a presentation to fool a verifier that does notchecking the encoding process. In most Aries implementations, the encoding is checkedby the Aries framework, as a “post-cryptographic verification” step.
A future version of the AnonCreds specification is likely to do an “on the fly”encoding in AnonCreds rather than including both values in the sourcecredentials and presentations. This would prevent the holder from replacing theraw
value without detection.
Revealed Attribute Groups
An entry for each groupnames
request attribute from the presentation request.
"revealed_attrs":{"consent_attrs":{ # The request attribute name from the presentation request"sub_proof_index":1, # The index of the source credential primary proof for the claims"values":{ # An entry for the each of the names in the request attribute group"claim_name":{ # The name of the claim, its raw and encoded value"raw":"205b1ea0-7848-48d4-b52b-339122d84f62","encoded":"46414468020333259158238797309781111434265856695713363124410805958145233348633"}}}}
Self Attested Attributes
This is a set any other data thatholder wants to provide to theverifier that is not signed by any issuer thus it’s attested only by the holder. This is a set of attributes that the holder is attesting to the verifier. The holder is not claiming that the data is true, only that they are attesting to it.
"self_attested_attrs":{"consent_attrs":"I agree to share my data with the verifier"}
Unrevealed Attributes
These are a hashmap of unrevealed attributes that the verifier requested in the presentation request, but the holder has decided not to reveal, along with their sub proof index numbers. Theverifier can use the sub proof index numbers to retrieve thecorresponding primary proof from theproof
array in the presentation.
"unrevealed_attrs":{"consent_attrs":{ # The request attribute name from the presentation request"sub_proof_index":1 # The index of the source credential primary proof for the claim}}
Predicates
An entry for each predicate request from the presentation request.
"predicates":{"consent_attrs":{ # The request predicate name from the presentation request"sub_proof_index":1, # The index of the source credential primary proof for the claim}}
Identifiers
Theidentifiers
contains a list of the identifiers to be resolved by theverifier to retrieve the cryptographic material necessary to verify each of theproofs in the presentation. The identifiers are listed in an array with oneentry per source verifiable credential, ordered by theproofs
list earlier inthe presentation.
The data structure is:
"identifiers":[{"schema_id":"CsQY9MGeD3CQP4EyuVFo5m:2:MYCO Biomarker:0.0.3","cred_def_id":"CsQY9MGeD3CQP4EyuVFo5m:3:CL:14951:MYCO_Biomarker",}]
The example above is for a source credential that is not revocable. For arevocable source credential, therev_reg_id
andtimestamp
(the identifierfor theRevocation Registry Entry used in the non-revocation proof) areadded. Those are described in the section below ongeneration of non-revocationproofs
§ Generate Non-Revocation Proofs
Aholder preparing an AnonCreds presentation must determine what, ifany, non-revocation proofs (NRPs) must be included the presentation based on acombination of what is in the proof request and what verifiable credentials areto be used in the presentation. As noted in thesection on revocation in thepresentation request, the presentationrequest may have thenon-revoked
item at the outer-most level, applying to allsource credentials, or at therequested_attribute
and/orrequested_predicate
level, applying only to specific source credentials. Further, theholder must determine if the source verifiable credential for the requestedattributes/predicates where a NRP is requested is a revocable credential.Obviously, an NRP cannot be produced for a verifiable credential issued withoutthat does not support revocation. Where a revocation interval is specified inthe request, and where the source credential to satisfy the request isrevocable, the holder must provide a non-revocation proof.
Once theholder has determined the which source credentials willrequired an accompanying NRPs in the presentation, theholder mustcollect and prepare the necessary proof generation inputs.
§ Collecting Data for Generating the Non-Revocation Proof
Recall from the earlier section onpreparing inputs to the presentation generationprocess that for each revocablesource credential, the holder must provide the following data elements:
witness
– A single value calculated from theRevocation Registry used by the holder to create the non-revocation proof.timestamp
– Thetimestamp
of theRevocation Registry Entry usedby the holder to create the non-revocation proof.timestamp
is an attribute oftheRevocation Registry Entry that allows the verifier to uniquelyidentify theRevocation Registry Entry used by the holder. Thetimestamp
must meet thenon_revocation_interval
requirements specified inthe presentation request.
Thewitness
is an integer that is used in the non-revocation zeroknowledge proof to demonstrate to the verifier that the holder’s credential hasnot been revoked. Recall that theaccumulator
of aRevocation Registry is the product of the tails file entries for all of the unrevokedcredentials in the registry. For a specific holder, itswitness
is the productof the tails file entries for all of the unrevoked credentials in the registryexcept for the holder’s own credential. Obviously, if the witness equals theaccumulator, the holder’s credential has been revoked. But, if not, then a validnon-revocation proof demonstrates that thewitness
times the entry from the tailsfile for the holder’s credential equals the accumulator, without revealingeither thewitness
, the credential’s index, or its tails file entry.
An AnonCreds process is used to calculate thewitness
value, takes thefollowing inputs:
tails_reader
– A reference to a local copy of theTails File forthe Revocation Registry for reading.revoc_reg_def
– The Revocation Registry Definition, as retrieved from theVerifiable Data Registry to which the issuer published it.rev_status_list
– A data structure about theRevocation Registry to be used for creating the non-revocation proof. It includes:rev_reg_def_id
– the ID of theRevocation Registry Definition.issuer_id
– the ID of the issuer of the source credential and hence, theRevocation Registry Definition.revocation_list
– a bit vector containing the status (revoked
,not revoked
) of all of the credentials in the revocation registryaccum
– the value of the accumulator from theRevocation Registry to be used for creating the non-revocation proof.timestamp
– the value of the timestamp from theRevocation Registry to be used for creating the non-revocation proof.
rev_reg_idx
– The index in the revocation registry of the holder’scredential. This is the credentials for whichrev_state
: An optional, previouswitness
that can be updated to producethe newwitness
output.old_rev_status_list
– An optional, previousrev_status_list
(describedabove) that was in place at the time the previous witness was generated.
The holder must use thefrom
andto
timestamp revocation intervalrequirements from the presentation request and knowledge of theRevocation Registry Entries to determine whichRevocation Registry to retrieve and use in generating the NRP for a given credential. TheselectedRevocation Registry Entry must either have been active at thetime of thefrom
value or have been published by the issuer between thefrom
andto
values. How to determine an appropriateRevocation Registry to use is up to the holder, and their use of the capabilities of therelevantVerifiable Data Registry.
When Hyperledger Indy is theVerifiable Data Registry for theRevocation Registry Entry, the state is received from Indy ledger as the“deltas” (state changes) from either the initial state of the Registry or from apreviousRevocation Registry Entry. While the older Indy version ofAnonCreds used the “deltas” representation directly, the newer AnonCreds versionrequires that the holder software convert the Indy “deltas” format into therev_status_list
representation, with every credential in the registry is givenarevoked
ornot revoked
boolean value.
The benefit of the “full state” representation forRevocation Registry is that the:Verifiable Data Registry can be “dumb”,returning the same static file given to it by the Issuer. With the Indy “deltas”approach, the [[Verifiable Data Registry (VDR)]] must be an active servicereturning an on-the-fly calculated result based on the inputs of the holder’srequest.
In collecting therevocation_list
data in therev_status_list
, the holdermay discover that their credential has been revoked by the issuer. The holdermay choose at that point to stop the presentation process. If the holder decidesto proceed, they will not be able to create a valid non-revocation proof for thesource credential.
The output of the process is the newwitness
for a credential that will beused as input to the generate presentation process.
§ Non-Revocation Proof Generation Steps
Init proof generation:
- Load issuer’s public revocation key
- Load the non-revocation credential
- Obtain recent V, acc (from Verifier, Sovrin link, or elsewhere).
- Update:
Here is taken from and updated there.
- Select random;
- Compute:
and adds these values to
- Generate random
- Compute:
and add these values to.
- For non-revocation credential compute:
and add them to.
Each NRP is added alongside the credential to which the NRP is applied, to thepresentation generated by theholder using this datamodel:
"non_revoc_proof":{"x_list":{"rho":"...","r":"...","r_prime":"...","r_prime_prime":"...","r_prime_prime_prime":"...","o":"...","o_prime":"...","m":"...","m_prime":"...","t":"...","t_prime":"...","m2":"...","s":"...","c":"..."},"c_list":{"e":"...","d":"...","a":"...","g":"...","w":"...","s":"...","u":"..."}}
The values in the data model are:
x_list
is the list of the schnorr proofs.rho
is the value ofr
is the value ofr_prime
is the value ofr_prime_prime
is the value ofr_prime_prime_prime
is the value ofo
is the value ofo_prime
is the value ofm
is the value ofm_prime
is the value oft
is the value oft_prime
is the value ofm2
is the value ofs
is the value ofc
is the value of
c_list
is the list of commitments.e
is the value ofd
is the value ofa
is the value ofg
is the value ofw
is the value ofs
is the value ofu
is the value of
As well, in the presentation data model, added to theidentifiers
item, is thetimestamp (Unix epoch format) of theRevRegEntry used to construct the NRP(see example below). Theverifier needs therev_reg_id
andtimestamp
to getthe correct accumulator to use in verifying the NRP.
"identifiers":[{"schema_id":"7BPMqYgYLQni258J8JPS8K:2:degree schema:46.58.87","cred_def_id":"7BPMqYgYLQni258J8JPS8K:3:CL:70:faber.agent.degree_schema","rev_reg_id":"7BPMqYgYLQni258J8JPS8K:4:7BPMqYgYLQni258J8JPS8K:3:CL:70:faber.agent.degree_schema:CL_ACCUM:61d5a381-30be-4120-9307-b150b49c203c","timestamp":1656269796}]
In step 6 of theAnonCreds Presentation DataFlow, theholder sends the verifiablepresentation, including any embedded NRPs, to theverifier.
Link: indy-anoncreds/docs/dev/anoncred.pdf
§ Verify Presentation
In step 8, 9, and 10 of theAnonCreds Presentation DataFlow, theVerifier collects the requiredinformation necessary to verify the verifiable presentation, attempts to verifythe proofs that make up the presentation and returns either atrue
if successful,and afalse
if any of the proofs fail, or if the presentation does not meetthe presentation request.
In theprevious section on presentation generation,the contents of the presentation is described. In verifying the presentation,each proof is extracted from the presentation and verified. The followingsub-sections cover the verification of the proofs related to the sourcecredentials (theeq_proof
, anyge_proof
s, and theaggregate_proof
), andany non-revocation proofs in the presentation.
For each source credential in the presentation, theVerifier mustretrieve (possibly from its cache, otherwise from theVDR) thepublishedSchema andCredential Definition based on theschema_id
andcred_def_id
values from theidentifiers
data item. For thenon-revocation proof, additional issuer published data must be collected, asdescribed below.
While in this section we mostly focus on the verification of the proofs in thepresentation, there are other data elements included, such as the revealedattributes, self-attested attributes, and thePresentation Request forwhich the presentation was generated. Some of these values contribute to theverification process, as noted below. Finally, an important part of theverification process isnot carried out in AnonCreds v1.0 and must beperformed by the callingverifier. We highlight that as well.
§ Verify Validity Proofs
An AnoncCreds validity proof is the combination of both equality and inequality predicate proofs. The validity proof is bound to the primary credential by the value that is presented in both proofs. The validity proof is verified by the following steps:
- For each credential, take each sub-proof and compute
Add to .
- For each predicate:
- Using and compute
and add these values to in the order.
§ Verify Non-Revocation Proof
If the presentation includes one or more Non-Revocation Proofs (NRPs) theverifier must also extract from the verifiable presentation the NRPsand process each of them. If any of the NRPs cannot be verified because oneor more of the attributes/predicates came from a revoked credential, theoverall status of the presentation is rejected as not verifiable. The followingoutlines the process for verifying an NRP.
Theverifier begins by extracting from the section of the presentationfor a given revocable credential thenon_revoc_proof
andidentifiers
dataitems. Theverifier must retrieve (possibly from its cache, otherwisefrom theVDR) the publishedRevRegEntry given therev_reg_id
andtimestamp
values from theidentifiers
data item. Theverifierextracts theaccumulator
item from theRevRegEntry retrieved. Notethat theverifier does not need to collect the revocation status of allof the credentials in the registry, nor the contents of the tails file for theRevReg. Only the issuer andholder needs that data. During theverification process, theverifier does not learn the index of theholder's credential in theRevReg.
Once theverifier gets the data in thenon_revoc_proof
data item fromthe presentation for the NRP being processed, plus the accumulator fromappropriateRevRegEntry, the following steps are carried out to verifythe NRP.
Calculation for NRP:
Then all these values are added to. This is then added with the validity proof which when hashed with and(received fromholder) re constructs the challenge hash.If, then the proof is valid.
The NRP is bound to the primary credential by the value that is presented in both proofs.
The verification code MUST surface to theverifier if any part of thepresentation, including any NRP(s), fail cryptographic verification. Theverification code MAY surface additional detail about what part of thepresentation failed, such as which NRP failed verification (if any).
Theverifier SHOULD evaluate the presentation to make sure that theholder provided all requested NRPs. Notably, if any expected NRPsare not received in the presentation, theverifier SHOULD check to seeif the given credential type is revocable. If not, it is acceptable that noNRP was received. However, if the credential used in the generation of theproof is revocable, and theholder did not provide the NRP, theverification code SHOULD surface to theverifier that the presentationfailed cryptographic verification.
§ Other Verification
The AnonCreds verification code checks some additional non-cryptographicelements of the presentation.
- That all of the requested attributes to be revealed are covered as either
revealed
orunrevealed
attributes. Any missing attributes trigger afalse
verification. - That the non-revocation proofs (NRPs) meet the revocation interval requirements of thePresentation Request. Note that the acceptable revocation interval may (and usually is)larger than the
from
andto
values in thePresentation Request as describedhere.
§ Encoding Not Verified
Verifiers using AnonCreds 1.0MUST verify that revealed attributespresented by theHolder encode to the values signed by theIssuer. AIf not done, a maliciousHolder could successfullysubstitute a different revealed attribute than what the issuer encoded andsigned.
As noted in theissuance section of thisspecification the encoding of raw attribute data tothe integers that are actually signed by theIssuer is defined andhandled by theIssuer, and is not defined in this specification, norperformed by the implementation. As such, the verification of the encoding islikewise delegated to theVerifier, enabling the risk to the verifieroutlined above.
§ AnonCreds Revocation Data Flow
AnonCreds includes a mechanism that supports the revocation of verifiablecredentials. This mechanism includes:
- Anissuer setting up to issue revocable credentials.
- Anissuer issuing revocable credentials.
- Anissuer activating or revoking issued credentials.
- Averifier requesting a presentation to include a non-revocation prooffor one or more revocable credentials.
- Aholder generating based on the presentation request of the verifier anon-revocation proof for attributes derived from revocable credentials.
- Averifier verifying a non-revocation proof included in apresentation from aholder.
A fundamental goal of AnonCreds is to not provide a correlatable identifier foreither aholder or a credential as part of generation and verificationof an AnonCreds presentation. Applying that goal to revocation means that therevocation mechanism must support theholder proving a credential usedin generating a presentation is not revoked without providing a correlatableidentifier for that credential or the holder itself. As such, the AnonCredsrevocation mechanism uses a Zero Knowledge Proof (ZKP) that allows theholder to prove a credential they hold is not revoked without revealing anidentifier for their credential or the holder.
§ AnonCreds Issuer Setup With Revocation
The details ofissuer setting up revokable credential types are coveredin theissuer setupsection of this specification. Note thewarning and recommendation against theuse ofISSUANCE_ON_DEMAND
in that partof the specification.
§ AnonCreds Issuance with Revocation
The details of anissuer issuing a revokable credential to aholder are covered in theissuance dataflow section of this specification.
§ AnonCreds Credential Activation/Revocation and Publication
When anissuer decides to revoke a previously issued credential (oractivate a previously inactive/revoked credential), they do so by publishinganother instance of theRevRegEntry object. Recall from the issuersetup section, the specification aboutRevRegEntry[creating and publishing the firstRevRegEntry](data_flow_setup.md#creating-the-initial-revocation-registry-entry-object)for aRevReg. In that process, the accumulator for the initial state oftheRevReg is published. When subsequentRevRegEntrytransactions are published to the ledger, each includes an updated value of theaccumulator. The update of the accumulator is necessary with each revocation or(re)activation of a credential or set of credentials since the last publishedRevRegEntry. This is because only the factors (all factors are listedin the respective tails file) of credentials which are active (meaning not beingrevoked) contribute to the accumulator. Therefore in addition to the updatedaccumulator value, everyRevRegEntry contains lists of indices ofcredential factors which have been either revoked or (re)activated within theRevRegEntry. This list of factor indices is a so calledWitness and enables theHolder to successfully generate a proof of nonrevocation.
An example of thedata in theRevRegEntry is shown in the following example of aRevRegEntry, pulled fromthis transaction on the SovrinMainNet.
"data":{"revocDefType":"CL_ACCUM","revocRegDefId":"4xE68b6S5VRFrKMMG1U95M:4:4xE68b6S5VRFrKMMG1U95M:3:CL:59232:default:CL_ACCUM:4ae1cc6c-f6bd-486c-8057-88f2ce74e960","value":{"accum":"21 116...567","prevAccum":"21 128...C3B","issued":[],"revoked":[172]}},
In the above:
revocDefType
: is defined by the comparable entry in theRevReg, and for thisversion of AnonCreds is hard-coded toCL_ACCUM
.revocRegDefId
: is the Id of theRevReg to which this entry isbeing added.accum
: is the new value of the accumulator based on the state of thecredentials in theRevReg, including those listed in this transaction. Thevalue is calculated by the Issuer based on the credential state changes, andsubmitted as part of the transaction, and verified by the ledger before beingpublished.prevAccum
: is the previous value of the accumulator. The value is suppliedby the Issuer in the transaction request, and verified by the ledger beforebeing published.issued
: an array (possibly empty or not supplied) of the indices within theRevReg of the credentials whose state has changed toactive
(also known asnot revoked
) since the lastRevRegEntry was published to the ledger.revoked
: an array (possibly empty or not supplied) of the indices within theRevReg of the credentials whose state has changed torevoked
(also known asnot active
) since the lastRevRegEntry was published to the ledger.
In the example transaction above no credentials areissued
(meaning changedfrom statusrevoked
toissued
) and only one, the credential with index172
, is changed torevoked
. Both lists can have an arbitrary number ofentries, up to the total number of credentials in theRevReg.
The algorithm to calculate the value of aRevRegEntry accumulator atany time is the same: determine the (modulo) product of the primes for eachnon-revoked credential in theRevocation Registry, as describedhere.
Theissuer MUST track of the revocation status of all of thecredentials within aRevReg so that it can both calculate the correctaccumulator and send to theVDR accurate lists (issued
andrevoked
)of the indices of the credentials whose status has changed since the lastRevRegEntry was published. If the list and accumulator published toVDR get out ofsync aholder will not be able to generate a valid NRP.
AVDR publishing aRevReg MAY perform its own calculation ofthe accumulator based on the list updates received in aRevRegEntrytransaction to ensure that the calculation of the accumulator after all of therevocation status updates to the credentials within theRevReg havebeen applied, rejecting the transaction if the calculated accumulator does notmatch that from theissuer.
If anissuer's local revocation information gets out of sync with whatis in the VDR, theissuer MUST rationalize the differences and produceaRevRegEntry transaction that accounts for both the last publishedRevRegEntry published in theVDR and the desired revocationstatus of all of the credentials in theRevReg.
Theholder is not involved in the process of revoking a credential.There is no technical requirement for anissuer to notify theholder that a credential they were issued has been revoked. That said, it is acourtesy that may improve the user experience of theholder.Aries RFC0183 RevocationNotificationis an example of how that can be done. Even if not notified by theissuer of the revocation of a credential, theholder can detect theircredential has been revoked when they retrieve the list of revoked credentialsfrom theVDR and discover the index of their credential in the list.
§ AnonCreds Presentation Request with Revocation
Carrying out an AnonCreds presentation with revocation is a two-step process, beginning with arequest from theverifier asking theholder to include anon-revocation proof (NRP) in the presentation, and then theholdercreating the NRP and including it in the presentation sent to theverifier.
The verifier requesting a non-revocation proof, and theholdergenerating the non-revocation proof are covered in the sections of thisspecification aboutrequesting andgenerating presentations, respectively.
§ AnonCreds Verification with Revocation
Averifier receives the presentation from theholder andprocesses thenon-revocation-related parts of the presentation andtherevocation-related parts of the presentation(if any) in the presentation. The resulting status of the presentation combines theverification outcomes from processing all proofs within the presentation. Ifverification of one or more of the embedded proofs is unsuccessful, thepresentation is rejected as unverifiable.
§ AnonCreds Methods
In the AnonCreds data flows are specifications of data models that containidentifiers to public AnonCreds objects (Schemas,CredDefs,Revocation Registry Definitions andRev_Reg_Entrys) that are published by issuersto locations (Verifiable Data Registries or VDRs) that must beaccessible to holders and verifiers to enable presentation generation andverification. The format of the objects identifiers and thelocation of the objects are not defined in this specification. Rather, similarto the approach ofDID Methods defined in theW3C DIDSpecification,AnonCreds methodsallow for the registration and resolution mechanisms for AnonCreds objectsacross a range of VDRs. A registry of supportedAnonCreds methods canbe found in theAnonCreds Methods Registry.
EachAnonCreds method specifies the format of the object identifiers,to whatVerifiable Data Registry the objects are published, how issuersregister (publish) objects, and how issuers and verifiers can resolve theidentifiers to retrieve the published objects. Implementations of agents(issuers, holders, verifiers) with AnonCreds support should be organized so asto allow issuers to use at least oneAnonCreds method for registration,and to allow holders and verifiers to use one or moreAnonCreds Methodsfor resolution. AnonCreds issuers will likely choose just a single AnonCredsregistration method(s) they will use, and all AnonCreds participants will choosethe set of AnonCreds resolvers they will require based on the issuers and typesof credentials they want to support. As with DIDs, an external UniversalAnonCreds Resolver is possible, as is a Universal AnonCreds Registrar.
§ AnonCreds Identifiers
AnonCreds identifiers MUST be a Uniform Resource Identifier (URI)conformant withRFC3986, althoughone notable exception is permitted. The exception is that for backwardscompatibility, the AnonCreds identifiers used in the early (predid:indy
) open source Hyperledger Indy AnonCreds implementation are permitted.In theAnonCreds Method Registry,this is theHyperledger Indy Legacy AnonCreds Method.
§ Issuer Identifiers
All AnonCreds objects that are published to aVerifiable Data Registry (Schema,Credential Definition,Revocation Registry Definition, andRevocation Status List) contain anissuerId
reference. This identifier references the creator (issuer) of the specific AnonCreds object.
AnonCreds identifiers MUST be a Uniform Resource Identifier (URI)conformant withRFC3986, althoughone notable exception is permitted. The exception is that for backwardscompatibility, the Indy DIDs used in the early (predid:indy
) open sourceHyperledger Indy implementation are permitted.
An AnonCreds object issuer identifier MAY be publicly resolvable. AnonCreds methods MUST define the format of the issuer identifier, and MUST verify that the publisher of the AnonCreds object controls the issuer identifier before publishing the object.
§ Revocation Support
Implementers only familiar with the “deltas”-style data format of Hyperledger IndyRevRegEntries may not be aware that other VDRs maystore the contents of eachRevRegEntry as“full state”, meaning the status of each credential in the registry(revoked or not) is stored, vs. only the differences from the previousRevRegEntry as in Hyperledger Indy. Either approach is fineas long as data is normalized by the AnonCreds method to theRevRegformat expected for AnonCredsgenerate presentationprocessing. This allows a AnonCreds Methods to trade-off the size of theRevRegEntry in the VDR with the need for VDR-side processing to collectall of the deltas needed by the holder.
An AnonCreds Method may opt to not supportrevocation at all, and generatean error if the issuer attempts to create aCredDef that includes revocationsupport.
§ AnonCreds Method Registry
The AnonCreds Method Registry is publishedhere. Theregistry contains a description, metadata and a link to a specification for eachAnonCreds Method submitted by its implementers/maintainers. The registry is a web pagegenerated fromthisrepository.
The AnonCreds Methods registry repository and published registry ismanaged by the AnonCreds Specification Working Group based on thisgovernanceframework.
Each entry in theAnonCreds MethodRegistrylinks to a specification for the associatedAnonCreds objects method.The method specifications must include information about the AnonCreds identifiersused by the method, along with the mechanisms for AnonCreds objects registrationand resolution. In some cases, theAnonCreds methodspecification is defined within aDID Method specification, while inother cases, theAnonCreds method is a standalonespecification.
§ W3C Verifiable Credentials Representation
This section describes how legacy AnonCreds credentials and presentations can be represented in the form ofW3C Verifiable Credentials standard.
§ Credential
This section describes howW3C credential concepts are applied toAnonCreds W3C credential representation.
Example AnonCreds W3C Credential
{"@context":["https://www.w3.org/2018/credentials/v1","https://raw.githubusercontent.com/hyperledger/anoncreds-spec/main/data/anoncreds-w3c-context.json"],"type":["VerifiableCredential","AnonCredsCredential"],"issuer":"did:sov:3avoBCqDMFHFaKUHug9s8W","issuanceDate":"2023-11-15T10:00:00.036203Z","credentialSchema":{"type":"AnonCredsDefinition","definition":"did:sov:3avoBCqDMFHFaKUHug9s8W:3:CL:13:default","schema":"did:sov:3avoBCqDMFHFaKUHug9s8W:2:basic_person:0.1.0"},"credentialSubject":{"firstName":"Alice","lastName":"Jones","age":"18"},"proof":[{"type":"AnonCredsProof2023","signature":"AAAgf9w5.....8Z_x3FqdwRHoWruiF0FlM"},{"type":"Ed25519Signature2020","created":"2021-11-13T18:19:39Z","verificationMethod":"did:sov:3avoBCqDMFHFaKUHug9s8W#key-1","proofPurpose":"assertionMethod","proofValue":"z58DAdFfa9SkqZMVPxAQpic7ndSayn1PzZs6ZjWp1CktyGesjuTSwRdoWhAfGFCF5bppETSTojQCrfFPP2oumHKtz"}]}
§ Context
W3CContext section requires including of@context
property toverifiable credential.
The value of the@context
property must be one or more resolvableURIthat result in machine-readableJSON-LD information about the objectformat.
Thecontext definition used for AnonCreds W3C credentials representation can bediscoveredhere.
In the case of W3C AnonCreds credentials, the@context
attribute includes an extraentryhttps://raw.githubusercontent.com/hyperledger/anoncreds-spec/main/data/anoncreds-w3c-context.json
which is required for the resolution of custom structure definitions and looks the following:
{ ..."@context":["https://www.w3.org/2018/credentials/v1","https://raw.githubusercontent.com/hyperledger/anoncreds-spec/main/data/anoncreds-w3c-context.json"], ...}
§ Identifiers
W3CIdentifiers section defines an optional capability to assignsome kind of identifier to the verifiable credential so that others can express statements about the same thing.
In the case of W3C AnonCreds credentials, theid
attribute is not included intoCL
credential proof signature, butitcan be optionally set in credential to support other integrity proof types.
§ Types
W3CTypes section requires including oftype
property to verifiablecredential.The value of thetype
property must be one or moreURI resolvablethrough the defined@context to the information required for determining whether a verifiable credential hasa valid structure.
In the case of W3C AnonCreds credentials, thetype
attribute includes an extra entryAnonCredsCredential
pointing to the difference in a base credential structure and looks the following:
{ ..."type":["VerifiableCredential",// general verifiable credential definition"AnonCredsCredential",// definition for AnonCreds credentials] ...}
§ Credential Subject
W3CCredential Subject section requires includingofcredentialSubject
property to verifiable credential.
Credential subject value containsclaims about one or more subjects.
In the context of W3C AnonCreds credentials, credential subject property is compliant with the following statements:
- Credentials always include claims about only one subjects.
- So that
credentialSubject
property is always represented as an object entry, but not an array.
- So that
- Credentials claims are always represented as key value pairs, where
value
is theraw
value of CL credentialattributes.- Encoded credential values are not included in the credential subject. Libraries implementing specification must usethe algorithmto generate encoded values during the signature generation and proof verification.
In the case of W3C AnonCreds credentials, thecredentialSubject
attribute looks the following:
{ ..."credentialSubject":{"firstName":"Alice","lastName":"Jones","age":"18"} ...}
§ Data Schemas
W3CCredential Schema section defines an optional capability toincludecredentialSchema
property to enforce a specific structure on a given verifiable credential and encoding usedto map the claims of a verifiable credential to an alternative representation format.
In the case of W3C AnonCreds credentials, thecredentialSchema
attribute defines a customAnonCredsDefinition
schema in order to include the information about AnonCreds related definitions to credential and looks the following:
{ ..."credentialSchema":{"type":"AnonCredsDefinition","definition":"did:sov:3avoBCqDMFHFaKUHug9s8W:3:CL:13:default","schema":"did:sov:3avoBCqDMFHFaKUHug9s8W:2:fabername:0.1.0"}, ...}
Credential Schema Data:
type
-AnonCredsDefinition
schema
- id ofSchemadefinition
- id ofCredential Definition
§ Issuer
W3CIssuer section requires including ofissuer
property to express theissuer of a verifiable credential.
In the case of W3C AnonCreds credentials, theissuer
attribute should be represented as aresolvableDID URL and looks the following:
{ ..."issuer":"did:sov:3avoBCqDMFHFaKUHug9s8W", ...}
§ Issuance Date
W3CIssuance Date section requires including ofissuanceDate
property to express the date and time when a credential becomes valid.The value of theissuanceDate
property must be a string value ofanXMLSCHEMA11-2 combined date-time.
In the case of W3C AnonCreds credentials, theissuanceDate
attribute should contain the time when a credential wasissued ortransformed from legacy form, and looks the following:
{ ..."issuanceDate":"2010-01-01T19:23:24Z", ...}
§ Proofs (Signatures)
W3CProofs (Signatures) section requires including ofproof
property to express confirmation of the credential’s validity.
According to the specification, one or many proof objects can be added to verifiable credentials.In the case of W3C AnonCreds credentials, theproof
attribute must containAnonCreds CL
proofand may contain moreNon-AnonCreds Data Integrity proofs.
§ AnonCreds CL proof
AnonCreds CL
proof constructed from theCL
signature of a verifiable credential.
The defined@context includes a definition for theAnonCredsProof2023
type describing the format of theproofentry:
{ ..."proof":[{"type":"AnonCredsProof2023","signature":"AAAgf9w5lZg....RYp8Z_x3FqdwRHoWruiF0FlM"}] ...}
Credential Proof Signature Data:
type
-AnonCredsProof2023
signature
- CL credential signature as string received by:building the following object fromcryptographic signature:
{"signature":{..},"signature_correctness_proof":{..},"rev_reg": Option<{..}>,"witness": Option<{..}>,}
signature
-cryptographic credential signature correctness proofgenerated for the credential.signature_correctness_proof
-credential signature correctness proofgenerated for the credential.rev_reg
-null
if the credential is not revocable. A description of the element and generation processwhen the credential is revocable are in thesectionSupporting Revocation in a Credential.witness
-null
if the credential is not revocable. A description of the element and generation processwhen the credential is revocable are in thesectionSupporting Revocation in a Credential.
encoding the object as described in thesection
§ Non-AnonCreds Integrity proof
In order to better conform to the W3C specification AnonCreds based credential allows includingof non-AnonCredsData Integrity Proof which must begenerated using one of NIST-approved algorithms (RSA, ECDSA, EdDSA).
§ Status
W3CStatus section defines an optional capability to includecredentialStatus
property to express credential status information, such as whether it is revoked.
In the case of W3C AnonCreds credentials, if a credential is revocable, thetype
attribute ofcredentialStatus
mustbeAnonCredsCredentialStatusList2023
(defined in the scope of@context) pointing thatAnonCreds Credential Revocation Flow is used for credential issuance.Theid
attribute ofcredentialStatus
must contain id of revocation registry.
Also, credential revocation data including revocation registry and witness values (rev_reg
andwitness
) must beincluded into the credential proof signature as demonstrated above inAnonCreds CL proof section.
A description of generation process when the credential is revocable is in thesectionSupporting Revocation in a Credential.
{ ..."credentialStatus":{"type":"AnonCredsCredentialStatusList2023","id":"did:sov:NcYxiDXkpYi6ov5FcYDi1e:4:NcYxiDXkpYi6ov5FcYDi1e:3:CL:NcYxiDXkpYi6ov5FcYDi1e:2:gvt:1.0:tag:CL_ACCUM:TAG_1"}, ...}
§ Expiration
W3CExpiration section defines an optional capability to includecredential expiration information.
In the case of W3C AnonCreds credentials, instead of includingexpirationDate
property there is defined anotherAnnounced Revocation Data Flow implementing throughthe using ifcredentialStatus
property.
{ ..."credentialStatus":{"type":"AnonCredsCredentialStatusList2023","id":"did:sov:NcYxiDXkpYi6ov5FcYDi1e:4:NcYxiDXkpYi6ov5FcYDi1e:3:CL:NcYxiDXkpYi6ov5FcYDi1e:2:gvt:1.0:tag:CL_ACCUM:TAG_1"}, ...}
§ AnonCreds W3C Revocable Credential
{"@context":["https://www.w3.org/2018/credentials/v1","https://raw.githubusercontent.com/hyperledger/anoncreds-spec/main/data/anoncreds-w3c-context.json"],"type":["VerifiableCredential","AnonCredsCredential"],"issuer":"did:sov:3avoBCqDMFHFaKUHug9s8W","issuanceDate":"2023-11-15T10:00:00.036203Z","credentialSchema":{"type":"AnonCredsDefinition","definition":"did:sov:3avoBCqDMFHFaKUHug9s8W:3:CL:13:default","schema":"did:sov:3avoBCqDMFHFaKUHug9s8W:2:basic_person:0.1.0"},"credentialStatus":{"type":"AnonCredsCredentialStatusList2023","id":"did:sov:3avoBCqDMFHFaKUHug9s8W:4:3avoBCqDMFHFaKUHug9s8W:3:CL:3avoBCqDMFHFaKUHug9s8W:2:basic_person:1.0:tag:CL_ACCUM:TAG_1"},"credentialSubject":{"firstName":"Alice","lastName":"Jones","age":"18"},"proof":[{"type":"AnonCredsProof2023","signature":"AAAgf9w5.....8Z_x3FqdwRHoWruiF0FlM"},{"type":"Ed25519Signature2020","created":"2021-11-13T18:19:39Z","verificationMethod":"did:sov:3avoBCqDMFHFaKUHug9s8W#key-1","proofPurpose":"assertionMethod","proofValue":"z58DAdFfa9SkqZMVPxAQpic7ndSayn1PzZs6ZjWp1CktyGesjuTSwRdoWhAfGFCF5bppETSTojQCrfFPP2oumHKtz"}]}
§ Presentation
This section describes howW3C presentation concepts are applied toAnonCreds W3C presentation representation.
Example AnonCreds W3C Presentation:
{"@context":["https://www.w3.org/2018/credentials/v1","https://raw.githubusercontent.com/hyperledger/anoncreds-spec/main/data/anoncreds-w3c-context.json"],"type":["VerifiablePresentation","AnonCredsPresentation"],"verifiableCredential":[{"@context":["https://www.w3.org/2018/credentials/v1","https://raw.githubusercontent.com/hyperledger/anoncreds-spec/main/data/anoncreds-w3c-context.json"],"type":["VerifiableCredential","AnonCredsCredential"],"credentialSchema":{"type":"AnonCredsDefinition","definition":"did:sov:3avoBCqDMFHFaKUHug9s8W:3:CL:13:default","schema":"did:sov:3avoBCqDMFHFaKUHug9s8W:2:basic_person:0.1.0"},"credentialSubject":{"firstName":"Alice","age":[{"type":"AnonCredsPredicate","predicate":">=","value":18}]},"issuanceDate":"2023-11-15T10:59:48.036203Z","issuer":"did:sov:3avoBCqDMFHFaKUHug9s8W","proof":{"type":"AnonCredsPresentationProof2023","proofValue":"eyJzdWJfcHJvb2Yi...zMTc1NzU0NDAzNDQ0ODUifX1dfX19"}}],"proof":{"type":"AnonCredsPresentationProof2023","challenge":"413296376279822794586260","proofValue":"eyJhZ2dyZWdhdGVkIjp7ImNfaGFzaCI6IjEwMT...IsMzAsMTM1LDE4MywxMDcsMTYwXV19fQ=="}}
§ Context
W3CContext section requires including of@context
property toverifiable presentation.
The value of the@context
property must be one or more resolvableURIthat result in machine-readableJSON-LD information about the objectformat.
Thecontext definition used for AnonCreds W3C presentations representation can bediscoveredhere.
In the case of W3C AnonCreds presentations, the@context
attribute includes an extraentryhttps://raw.githubusercontent.com/hyperledger/anoncreds-spec/main/data/anoncreds-w3c-context.json
which is required for the resolution of custom structure definitions and looks the following:
{ ..."@context":["https://www.w3.org/2018/credentials/v1","https://raw.githubusercontent.com/hyperledger/anoncreds-spec/main/data/anoncreds-w3c-context.json"], ...}
§ Types
W3CTypes section requires including oftype
property to verifiablepresentation.The value of thetype
property must be one or moreURI resolvablethrough the defined@context to the information required for determining whether a verifiable presentationhas a valid structure.
In the case of W3C AnonCreds presentations, thetype
attribute includes an extra entryAnonCredsPresentation
pointing to the difference in a base presentation structure and looks the following:
{ ..."type":["VerifiablePresentation",// general verifiable presentation definition"AnonCredsPresentation"// definition for AnonCreds presentation] ...}
§ Verifiable Credential
W3CVerifiable Credential section requires includingofverifiableCredential
property to a verifiable presentation constructed from one ormoreverifiable credentials.
The listedcredentials must include attributes and predicated requested inthepresentation request.
Verifiable credentials mostly looks same as described at theCredential Structuresection but with some differences.
§ Credential Subject
In the case of W3C AnonCreds presentations, in contrast to the general verifiable credential structure(when all attributes represented as key value pairs), thecredentialSubject
attribute values can be representedin two forms:
- string - corresponds to a requested attribute which was revealed in the presentation
"credentialSubject":{ ..."firstName":"Alice", ...}
- array of objects - corresponds to a requested predicates resolved by presentation without revealing an exact value
- The value is an array as multiple predicates can be requested over the same attributed
"credentialSubject":{ ..."age":[{"type":"AnonCredsPredicate","predicate":">=","value":18}] ...}
- A predicate object consists of the following data:
type
-AnonCredsPredicate
type defined in the scope of@context and describes the format ofthe resolved predicatepredicate
- type of the predicate:same as in requestvalue
- value of the predicate:same as in request
§ Proof (Signature)
In the case of W3C AnonCreds presentations, theproof
attribute for each verifiable credential must be an object ofAnonCredsPresentationProof2023
type which looks the following:
"proof":{"type":"AnonCredsPresentationProof2023","proofValue":"AAEBAnr2Ql...0UhJ-bIIdWFKVWxjU3ePxv_7HoY5pUw","timestamp": Option<1234567>,}
Verifiable Credential Proof Data
proofValue
- CL credential proof as string received by:- building the following object fromcryptographic proofdata:
{ sub_proof:{"primary_proof":{ ...},"non_revoc_proof":{ ...}}}
sub_proof
-cryptographyc proofgenerated for each used credential
- encoding the object as described in thesection
- building the following object fromcryptographic proofdata:
timestamp
- (Optional) if revocation supported and requested, time as a total number of seconds from Unix Epochrepresenting pointing to the specif moment of revocation registry
§ Proof
W3CProofs (Signatures) section requires including ofproof
property to express confirmation of the presentation’s validity.
As we described in the above section verifiable credentials can contain two proof entries (CL AnonCreds of Non-AnonCredsData Integrity).Unlike verifiable credentials, presentations can contain only one proof object.
It isverifier andholder responsibility to negotiate which proof must be used(CL AnonCreds of Non-AnonCreds Data Integrity) in the presentation:
- Generate an W3C AnonCreds presentation, with all it’s privacy-preserving power and predicates
- Present the VC using one of Non-AnonCreds Integrity Proof Signatures
{ ..."proof":{"type":"AnonCredsPresentationProof2023","challenge":"182453895158932070575246","proofValue":"AAAgtMR4DrkY--ZVgKHmUANE04ET7TzUxZ0vZmVcNt4nCkwBABUACQJ69kJVIxHVAQAIAaJ19l-agSA"} ...}
Presentation Proof structure
challenge
-nonce taken from thepresentation requestproofValue
- aggregated CL proof as string received by:- building the following object fromcryptographic proofdata:
{ aggregated:{"c_hash":"...","c_list":[...]}}
aggregated
-aggregate proof,across all the source credentials that proves that the same link secret was used in the issuance of all thecredentials.
- encoding the object as described in thesection
- building the following object fromcryptographic proofdata:
§ AnonCreds W3C Presentation containing Revocable Credential
{"@context":["https://www.w3.org/2018/credentials/v1","https://raw.githubusercontent.com/hyperledger/anoncreds-spec/main/data/anoncreds-w3c-context.json"],"type":["VerifiablePresentation","AnonCredsPresentation"],"verifiableCredential":[{"@context":["https://www.w3.org/2018/credentials/v1","https://raw.githubusercontent.com/hyperledger/anoncreds-spec/main/data/anoncreds-w3c-context.json"],"type":["VerifiableCredential","AnonCredsCredential"],"credentialSchema":{"type":"AnonCredsDefinition","definition":"did:sov:3avoBCqDMFHFaKUHug9s8W:3:CL:13:default","schema":"did:sov:3avoBCqDMFHFaKUHug9s8W:2:basic_person:0.1.0"},"credentialStatus":{"type":"AnonCredsCredentialStatusList2023","id":"did:sov:3avoBCqDMFHFaKUHug9s8W:4:3avoBCqDMFHFaKUHug9s8W:3:CL:3avoBCqDMFHFaKUHug9s8W:2:basic_person:1.0:tag:CL_ACCUM:TAG_1"},"credentialSubject":{"firstName":"Alice","age":[{"type":"AnonCredsPredicate","predicate":">=","value":18}]},"issuanceDate":"2023-11-15T10:00:00.036203Z","issuer":"did:sov:3avoBCqDMFHFaKUHug9s8W","proof":{"type":"AnonCredsPresentationProof2023","proofValue":"eyJzdWJfcHJvb2Yi...zMTc1NzU0NDAzNDQ0ODUifX1dfX19"}}],"proof":{"type":"AnonCredsPresentationProof2023","challenge":"413296376279822794586260","proofValue":"eyJhZ2dyZWdhdGVkIjp7ImNfaGFzaCI6IjEwMT...IsMzAsMTM1LDE4MywxMDcsMTYwXV19fQ=="}}
§ Proof data encoding
Almost all properties of AnonCredscredential signature andpresentation are big numbers.The traditional JSON serialization os such data is not very compact.Instead, we useMessagePack binary data serialization format which is faster and producessmaller value.You can find more details on howMessagePack works readingthespecification.
Encoding the resulting bytes asBase64Url string without padding
§ Context
The AnonCreds context, locatedathttps://raw.githubusercontent.com/hyperledger/anoncreds-spec/main/data/anoncreds-w3c-context.json can be used toimplement a local cached copy.For convenience, the AnonCreds context is also provided in this section.
:::
{"@context":{"@version":1.1,"@protected":true,"ac":"https://anoncreds.example/2022/ns#","xsd":"http://www.w3.org/2001/XMLSchema#","AnonCredsCredential":"ac:AnonCredsCredential","AnonCredsDefinition":{"@id":"ac:AnonCredsDefinition","@context":{"@version":1.1,"@protected":true,"definition":{"@id":"ac:definition","@type":"@id"},"schema":{"@id":"ac:schema","@type":"@id"}}},"AnonCredsCredentialStatusList2023":"ac:AnonCredsCredentialStatusList2023","AnonCredsPresentation":"ac:AnonCredsPresentation","AnonCredsPresentationProof2023":{"@id":"ac:AnonCredsPresentationProof2023","@context":{"@version":1.1,"@protected":true,"proofValue":{"@id":"ac:proofValue","@type":"xsd:string"},"challenge":{"@id":"ac:challenge","@type":"xsd:string"}}},"AnonCredsProof2023":{"@id":"ac:AnonCredsProof2023","@context":{"@version":1.1,"@protected":true,"signature":{"@id":"ac:signature","@type":"xsd:string"}}},"AnonCredsPredicate":{"@id":"ac:AnonCredsPredicate","@context":{"@version":1.1,"@protected":true,"predicate":{"@id":"ac:predicate","@type":"xsd:string"},"value":{"@id":"ac:value","@type":"xsd:decimal"}}}}}
§ AnonCreds Conventions
Over the years of using Hyperledger AnonCreds, several conventions (listed here) have been defined can or must be usedin deploying AnonCreds. The conventions are not required in the currentAnonCreds implementation, butare necessary to follow for interoperability with other AnonCreds implementations.
§ Encoding Credential Claims
As described in this specification, the claim data that is actually signed inproducing an AnonCreds verifiable credential is not the “raw”, human-readabledata of the claims, but rather an integer derived from the raw data. The act ofencoding the data was defined to be done by the issuer. However, unless theissuer implements exactly the encoding expected by all others in an ecosystem,the signatures produced for a presentation will not verify. Thus, although theissuer is nominally in control of the encoding, practically, all issuers MUSTfollow theencoding defined in this specification.
In a future version of AnonCreds we expect to move the encoding process awayfrom the issuer and into AnonCreds.
§ Date and Date/Time Predicates
A powerful capability in AnonCreds is the ability to use predicates on dates,such as proving based on a date of birth (a strongly correlatable value) that aperson is older than a certain age without revealing the date of birth. However,because ofhow credential claims are encoded(above), for a date-based predicate to work, the date must be an integer. Thus,a “date of birth” claim in anISO 8601 Standard DateString will not be ableto be used in a predicate. Rather, the convention of the AnonCreds community hasbeen to put the data into the form of the date as an integer of valueYYYYMMDD
This convention was initially definedhereby theHyperledger Ariescommunity.
For the same reasons, AnonCredsdatetime
claims that are to be used in predicatesSHOULD be issued inUnix Time format.
In a future version of AnonCreds we expect to define the type of each claim in acredential so that thedate
anddatetime
values as strings can beautomatically encoded as integers and Unix Time values (respectively). Thisenables supporting both human-friendly displaying of the claims as well assupport for predicates.
§ Presentation Request Revocation Intervals
While the AnonCredsPresentation Request format allows the flexibleapplication offrom
toto
ranges for when theHolder must provetheir credential was not revoked, those deploying AnonCreds have found that it israrely practical or necessary to use such flexibility, and the best practicesare to set the two values (from
,to
) to be the same inPresentation. ForVerifiers interested in the current revocation statusof the credential, both values should be set to the current time, while if theverifier wants to see the revocation status of the credential at some point inthe past, both values should be set to point in time.
Details about this convention can be found in thePresentation Request sectionof this specification.
Since theHolder must prove non-revocation based on aRevocation published by the issuer, the actual interval that theHolder must use is notfrom
toto
, but rather from theRevocation active at timefrom
to theRevocation Registry Entryactive at timeto
, where “time” is as determined by the transaction timesrecorded at the location on which the issuer published theRevocation.
§ IANA Considerations
This document has no IANA actions.
§ Security Considerations
There are a number of security considerations that issuers, holders, andverifiers should be aware of when processing data described by thisspecification. Ignoring or not understanding the implications of this sectioncan result in security vulnerabilities.
While this section attempts to highlight a broad set of security considerations,it is not a complete list. Implementers are urged to seek the advice of securityand cryptography professionals when implementing mission critical systems usingthe technology outlined in this specification.
§ Zero Knowledge Proofs in AnonCreds
The security of AnonCreds is primarily based on the security of the AnonCredscryptography, and in particular, thezero knowledge proofs (ZKPs), uponwhich this specification is based. Each ZKP used in AnonCreds requiresthe following security properties be met, as introduced in many ZKP articles,such as this one onnon-interactive zero knowledge proofs:
- Completeness
- If statement is true, a verifier will be convinced by prover.
- Soundness
- If statement is false, a cheating prover cannot convince verifier it is trueexcept with some negligible probability.
- Zero-Knowledge
- The verifier learns nothing beyond the statement’s validity.
The security of the ZKPs is based on the security of RSA cryptography, andspecifically that the factoring ofn
, wheren
is the product of twosafe primes, is a computationally hard problem.
These properties apply in the places where zero knowledge proofs are used in AnonCreds:
- No linkable identifiers for the holder are shared to the issuer during theissuing process, yet theissuer is convinced by theholderthat theholder knows thelink secret to which thecredentials are to be issued.
- Theissuer may know other correlatable data about theholder, but not thelink secret to which the credential isissued.
- No linkable identifiers for the holder are shared to the verifier during thepresentation process, yet theverifier is convinced by theholder that theholder knows thelink secret to which thecredentials were issued.
- Theverifier may receiveclaims about theholderthat are correlatable, but not thelink secret to which thepresented credentials were issued.
- Even though the signatures over the credentials in a presentation aregenerated to be unique per presentation by theholder, theverifier is convinced that the presented signatures were derived from thesignatures generated by theissuer using the cryptographicinformation in thecredential definitions published by theissuers.
- Theverifier is convinced that the signatures in the presentation arevalid despite the selective disclosure ofclaims from the verifiablecredentials.
- Theverifier is convinced that the presented predicates are true ifand only if the requested predicate expression based on theclaimvalue is also true.
- Theverifier is convinced that theholders source verifiablecredentials are not revoked (assuming it is revocable) if thenon-revocation proofs generated by theissuer are valid.
§ Eavesdropping
The prevention of eavesdropping during the exchange of AnonCreds objects duringissuance and verification is outside the scope of this specification. Thesecurity of the data shared between parties shall be protected by implementingbest practices in communications amongst mobile wallet and IT infrastructure,likeISO27001 andInformation Security Management systems (ISMS). That said,the AnonCreds cryptography prevents an eavesdropper from gaining other than anyplaintext information the parties of an interaction might intentionally oraccidentally share.
- Issuances are generated uniquely using nonces and theholder'sgeneratedblinded link secret such that an eavesdropper that lacksknowledge of the holder’slink secret cannot replay the interactionor derive presentations from the verifiable credential.
- Presentation requests are generated uniquely using a nonce, and presentationsare derived based on theholder'slink secret such that aneavesdropper that lacks knowledge of the holder’slink secret cannotreplay the interaction or derive additional presentations from the sourceverifiable credentials.
§ Replay
Replay prevention in AnonCreds for both issuances and presentations areprevented through the use of nonces. During the 3-step issuance process theissuer (in the Credential Offer) and then theholder (in theCredential Request) provide and verify the use of nonces before proceeding.Likewise in the presentation request, theverifier provides a noncethat is incorporated by theholder in generating the presentation, andverified by theverifier.
§ Message Tampering
Message tampering during AnonCreds exchanges is ineffective whenthe secrets are securely protected by theissuers andholders.Arbitrary modification of AnonCreds data without access to the appropriate secret data isdetectable through the failure of the verification of the data objects. See thesecurity considerations sections about theprotection ofdata andprotection of keymaterial for more on protecting those secrets andthe potentials impacts if those secrets are disclosed.
§ Holder Collusion
Holders that collude by sharing theirlink secret could eachbe issued credentials to the samelink secret. Subsequently,suchholders could present any combination of the credentials together,including generating a proof that they were all issued to the samelink. Where such collusion is deemed a significant risk, such as with amobile wallet application, the agent software should protect thelink so as to prevent access or extraction.Issuers andVerifiers may choose to implement verifications that theholder isusing a mobile wallet that is known to prevent such extraction and subsequentcollusion.
§ Protection of data
The protection of data, both at rest and in motion, is outside the scope of thisspecification. Protection of data should be accomplished by the participantsexchanging AnonCreds verifiable data implementing best practices in dataprotection for mobile wallet and IT infrastructure, likeISO27001 andInformation Security Management systems (ISMS). See the section on theprotection of key material for more on thepotential impact of disclosed secrets.
When verifiable credentials are stored on a device and that device is lost orstolen, it might be possible for an attacker to use the victim’s verifiablecredentials. Mitigating the impacts of such a loss include:
- Enabling password, pin, pattern, or biometric screen unlock protection on thedevice.
- Enabling password, biometric, or multi-factor authentication for thecredential repository.
- Enabling password, biometric, or multi-factor authentication when accessingcryptographic keys.
- All or any combination of the above.
The potential risks in not adequately protecting data are covered in theeavesdropping,message insertion andmodification andreplaysubsection of the Security Considerations.
§ Protection of Key Material
The private keys associated with the public keys used by theissuermust be kept secret. Eachissuer is responsible for storing and usingtheir private keys and (for theholder) thelink secret in asufficiently secure manner.
Unintended disclosure ofissuer secret information could allow otherswith access to the secrets issue credentials as if from the originalissuer.
Unintended disclosure of theholder'slink secret could, ifaccompanied by the disclosure of the holder’s verifiable credentials, allowothers to present those credentials as their own. A malicious presenter couldnot present their own credentials issued to a differentlink secretalongside the compromised verifiable credentials.
§ Man-In-The-Middle
The prevention and detection of Man-In-The-Middle (MITM) attacks during theexchange of AnonCreds objects during issuance and verification is outside thescope of this specification. Best practices in preventing MITM attacks whileestablishing the communications channel between the parties through which thedata objects are exchanged should be followed by all of the participants.
As covered in the previous section onMessage Insertion andModification issuance and presentationsprocesses are not susceptible to alteration by a MITM. The primary risk of MITMattacks are the potential for collusion betweenholders interactingwith averifier. For example, a MITM interacts with a verifier torespond to a presentation request by colluding (in real-time) with a set of oneor moreholders to pass on each presentation request and get apresentation from the most suitableholder for each individualpresentation request. This attack can be mitigated by requesting presentationsthat are satisfied from multiple source credentials, which will be verified toshow all are bound to the samelink secret.
§ Deletion
The handling of the deletion of AnonCreds objects by the various participants isoutside the scope of this specification. Such objects may be deleted by theparticipants at any time, understanding that once done, the operations enabledby the possession of those objects cannot be performed. For example, an issuerlosing the issuance and revocation private keys can no longer issue or revokecredentials. Likewise, aholder can’t provide a presentation of adeleted source credential. Protection from inadvertent deletion of such datashall be protected by implementing best practices in data management by mobilewallet and IT infrastructure, likeISO27001 andInformation SecurityManagement systems (ISMS).
§ Denial of Service
Denial of Service attacks against the various participants in AnonCredsexchanges are outside the scope of this specification.
§ Storage or Network Amplification
Storage or network amplification attacks against the various participants inAnonCreds exchanges are outside the scope of this specification.
§ Residual Risks
The residual risks inherent in AnonCreds include:
- Compromise in the used cryptographic primitives used in AnonCreds v1, asdescribed in this specification.
- Bugs in the AnonCreds implementations used by participants exchangingAnonCreds verifiable data.
- External libraries upon which the AnonCreds implementations are dependent.
§ Privacy Considerations
The business expression of the AnonCreds privacy goal is to allow a verifiablecredential holder to minimize the amount of information they share with othersin presentations and to minimize the opportunities for holdercorrelation (also calledunlinkability) across issuers and verifierswhen using verifiable credentials and presentations. While it is understood thattheclaims that a holder shares in a verifiable presentation may becorrelatable, the act of providing an AnonCreds verifiable presentation must notprovidecorrelatable data.
AnonCreds accomplishes its privacy goals using the following techniques, all ofwhich are based on forms ofzero-knowledge proofs, as described in thisspecification.
- Holders use alink secret to enable the binding of the credentialsthey receive from issuers, such that:
- Issuers do not receive an identifier for the holder that can be correlatedwith other issuers during the credential issuance process.
- In a presentation, verifiers receive proof of the holder’s knowledge of thelink secret without receiving an identifier that can be correlated withother issuers.
- In a presentation, verifiers do not receive an identifier that can becorrelated with the issuers of the source credentials.
- In a presentation, holders prove all of the credentials they were issued arebound to the same link secret without revealing a correlatable identifier toverifiers.
- In a presentation, the holder provides proof of the issuers signatures withoutrevealing the signatures itself, which can be used as a correlatableidentifier.
- Holders can (verifiably) selectively discloseclaims fromsource credentials.
- Holders can (verifiably) provepredicate expressions aboutintegerclaims from source credentials.
- Holders can in some situations, producenon-revocation (NRPs) about the source credentials in a presentation withoutrevealing a correlatable identifier for themselves or the source credentials.
- If credentials are both revocable and not revoked, theHolder canproduce a valid NRP for presented source credentials.
- If credentials are both revocable and revoked, theHolder cannotproduce a valid NRP for presented source credentials.
- If credentials are not revocable, theHolder cannot produce a valid NRPfor presented source credentials.
The further privacy properties are stated according toSection 5 ofRFC6973.
§ Surveillance
In the strict scope of this specification, the activities of the parties are notsubject to surveillance due to the presentationdata minimization andunlinkability characteristics of the credential issuance and presentationactions. However, in any digital trust ecosystem, there are other componentsthat could lead to surveillance depending on how they are implemented. Theseinclude:
- The interactions of the various participants could be surveilled depending onhow the various objects (credentials, presentations, etc.) are exchanged. Forexample, HTTP traffic amongstIssuers,Holders andVerifiers could be correlated.
- Using a secure, encrypted, peer-to-peer communication channel such as[DIDComm] can be used to mitigate the surveillance risk.
- An implementation of AnonCreds based on this specification can not hide thetime to generate or size of a presentation.
- A deployment based on this implementation could mitigate this potentialleakage by artificially inflating both the time to generate and the size ofthe presentation.
- If theHolder must request credential revocation information directlyfrom anIssuer when creating a presentation, theIssuercould surveil the use of a credential by theHolder. Further, if theVerifier also must request revocation data from anissuer toverify a received presentation, theIssuer could correlate the use ofcredentials byHolders and with whatVerifiers thecredentials are being used. This is often called theCall Home problem.
- Distributed Ledgers are often used inDigital Trust ecosystems tomitigate such surveillance, where public data needed to generate and verify presentationsare read from public ledgers operated by a set of “uninterested” parties.
- Other techniques are possible to mitigate such surveillance when ledgers arenot used. For example,Verifiers requesting a presentation couldretrieve the necessary revocation data fromIssuers and providethat data to theHolder. The Issuer could still surveil theverifications occurring, but would not know whatHolders wereproviding the presentations.
§ Stored Data Compromise
The compromise of stored data held by the various agents in a digital trustecosystem must be mitigated by the respective agent software and hardware, andis out of scope of this specification. The stored data of an individual agentshall be protected by implementing best practices in securing mobile walletapplications and IT infrastructure, likeISO27001 andInformation SecurityManagement systems (ISMS).
§ Unsolicited Traffic
The issue of unsolicited traffic is out of scope of this specification. It is aconcern of the agents into which the AnonCreds library is embedded. Theprevention of unsolicited traffic shall be accomplished by implementing bestpractices in securing mobile wallet applications and IT infrastructure, likeISO27001 andInformation Security Management systems (ISMS).
§ Misattribution
The risk of misattribution when using AnonCreds is mitigated by the participantsfollowing the specification. However, as noted in thewarning found in thissection of thisspecification, a maliciousissuer could deliberately generate a weakprivate key for use in issuing AnonCreds credentials such that a uniqueidentifier for a holder can be determined via a brute force attack. In thatcase, anyone applying the brute force attack could issue credentials as it theywere from theIssuer, possibly with false information. This riskfurther incentivizeIssuers not to deliberately weaken their keys.
If a third party gains access to the secure storage of aHolder (or acopy thereof), they could present information as if they were theHolder. The stored data of an individual agent shall be protected byimplementing best practices in securing mobile wallet applications and ITinfrastructure, likeISO27001 andInformation Security Management systems(ISMS).
§ Correlation
As noted in the introduction to this section, AnonCreds v1 uses two importanttechniques to prevent correlation in the issuance and presentation of verifiabledata:
- The use ofzero knowledge proofs in eliminating an correlatable (linkable)data as part of the process of issuing AnonCreds verifiable credentials andpresenting AnonCreds verifiable presentations. While the credential dataissued and presented MAY include correlatable data elements, the issuing andpresenting processes do not provide correlatable data elements.
- The data minimization features supported in presenting data, such that theholder can selectively disclose only relevant information from thecredential based on the business purpose of the presentation, and the use ofpredicates that support proving an expression based on an integerclaim in a verifiable credential without revealing the claim itself.
§ Identification
AnonCreds v1 enables, but does not itself provide, identification. Theunlinkability anddata minimization capabilities inherent inAnonCreds enable theHolder to provide presentations anonymously.However, theclaims within the presentation are from verifiably issuedcredentials, and as such, may be used for identification.
§ Secondary Use
The disclosedclaims andpredicates presented by theHolder to theVerifier are necessarily visible to theverifier. The secondary use of that data is outside the scope of the AnonCredsspecification, and is a governance issue. Aholder that presents datato averifier using AnonCreds cannot “revoke” that the presentation wasmade as theverifier already possesses the disclosed data.
§ Disclosure
The disclosedclaims andpredicates presented by theHolder to theVerifier are necessarily visible to theverifier. The disclosure of that data by theverifier is outside thescope of the AnonCreds specification, and is a governance issue. Aholder that presents data to averifier using AnonCreds cannot“revoke” that the presentation was made as theverifier already possesses thedisclosed data.
§ Exclusion
The participants (issuers,holders,verifiers) usingAnonCreds may apply whatever policies (including refusal) they want in issuing,holding, requesting, presenting, and verifying AnonCreds verifiable credentialand presentations. Such policies are out outside thescope of the AnonCreds specification, and are governance issues.
§ References
§ Normative References
Add normative references
§ Informative References
Add informative references
§ Resources on cryptography
§ Sigma protocols
- Theoriginal work by Schnorr
- Cramer’s thesis that first defines the concept of Sigma protocol
- set oflecture notes on Sigma protocols
- book with a section on sigma protocols
- Blog post on Zero Knowledge Proofs with Sigma Protocols
§ Acknowledgements
AnonCreds was initially created as part of the Open Source HyperledgerIndy project.
This specification is the work of the AnonCreds Working Group, which includes dozensof active and dedicated participants. In particular, the following individualscontributed ideas, feedback, and wording that influenced this specification:
- Artur Philipp - Technische Universität Berlin, IDUnion
- Hakan Yildiz - Technische Universität Berlin
- Matt Raffel - Kiva Microfiance
§ Authors’ Addresses
Add authors’ addresses.