Skip to content

Commit 1bc1a15

Browse files
authored
Merge pull request hyperledger-indy#707 from dhh1128/master
Document credential revocation at conceptual level
2 parents e3c046a + 6c53453 commit 1bc1a15

File tree

3 files changed

+184
-0
lines changed

3 files changed

+184
-0
lines changed

doc/before-and-after.png

52.5 KB
Loading

doc/cred-revocation.md

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# How Credential Revocation Works
2+
3+
This doc aims to explain credential revocation at a conceptual level.
4+
If this doc still feels too low-level, you might consider watching [this
5+
introductory video](https://drive.google.com/open?id=1FxdgkYwwLfpln6MnsZJAwnYjM6LpCoP0) from time offset 0:30 to 4:30.
6+
7+
## Background: Cryptographic Accumulators
8+
9+
Before explaining the mechanism in detail, it's necessary to understand
10+
<font color="blue">cryptographic accumulators</font> at a very high level.
11+
We will try to avoid daunting math in our explanation.
12+
13+
You can think of an accumulator as the product of multiplying many numbers
14+
together. In the equation `a * b * c * d = ` <font color="blue">`e`</font>,
15+
the accumulator would be <font color="blue">`e`</font>;
16+
it _accumulates_ a value as each new factor is multiplied in. We could
17+
plug in numbers; if `a`=2 and `b`=3 and `c`=5 and `d`=7, then our accumulator
18+
<font color="blue">`e`</font> has a value of 210. If `e` has this value, we
19+
say that 3 is "in" `e` because it is a factor. If we want to take 3 out
20+
of the accumulator, we divide 210 by 3 and get 70 (=2*5*7); 3 has now been
21+
"removed".
22+
23+
Notice that you can also produce <font color="blue">`e`</font> by multiplying any single
24+
factor such as `a` by the product of all the other factors (`b * c * d`).
25+
This is a useful characteristic; it means you can tell someone else
26+
the value of `a` and _the product of all the other inputs to the accumulator,
27+
but not the other inputs themselves_, and they can produce the output.
28+
29+
## Background: Tails Files
30+
31+
In our simple example above, we only have 4 factors, and we are using small
32+
numbers. We are also using standard arithmetic, where you can reverse
33+
multiplication by dividing. In such a system, the contents of an accumulator
34+
can be reverse-engineered by simple prime factorization.
35+
36+
To be useful for revocation, Indy's accumulators can't be reversible; that is,
37+
it must be the case that the only way to derive the accumulator
38+
value is to know the factors.
39+
We accomplish this by using modular arithmetic (where division is undefined),
40+
and by using massive numbers for the factors and accumulators.
41+
42+
A <font color="blue">tails file</font> is a binary file that contains an
43+
array of randomly generated factors for an accumulator. Instead of small
44+
numbers like 2 and 3 and 7, these factors are massive numbers, far too
45+
big to display conveniently on a screen. Typically the quantity of these
46+
numeric factors in a tails file is large--hundreds of thousands to tens of
47+
millions.
48+
49+
The tails file is not secret; it is published as plain text to the world
50+
and freely downloadable by anyone. The contents of this file never change.
51+
52+
Each potential or actual credential issued by a particular issuer is
53+
assigned an index to an accumulator factor in a tails file. However,
54+
only credentials that have not revoked contribute to the value of the
55+
accumulator. We will see how this works, below.
56+
57+
![tails file and accumulator](tails.png)
58+
59+
## Setup
60+
61+
Before revocable credentials can be issued, a number of things must be
62+
true about the ecosystem:
63+
64+
1. A <font color="blue">schema</font> for each credential type
65+
must be written to the ledger.
66+
For example, if companies wish to issue proof of employment, then
67+
a "Employee Credential" schema would need to be published. Similarly,
68+
before birth certificate credentials can be issued, a "Birth Certificate"
69+
schema would need to be defined and made available to the public. Any number
70+
of issuers can reference the same schema. Schemas can be versioned and
71+
evolved over time. Any individual or institution can write a schema
72+
to the ledger; it does not require special privileges.
73+
74+
2. Each issuer must publish on the ledger one <font color="blue">
75+
credential definition</font> for each credential type they intend
76+
to create. The definition announces the issuer's intention to
77+
create credentials that match a particular schema, and specifies the
78+
keys that the issuer will use to sign such credentials. (The verkey+
79+
signing key pair used to authenticate the issuer's DID should be kept
80+
separate from the keys used to sign credentials, so that each key
81+
pair can be rotated independently; it would be bad if a sysadmin
82+
rotated a DID keypair and accidentally invalidated all credentials
83+
issued by an institution...)
84+
85+
3. Each issuer must also publish on the ledger a <font color="blue">
86+
revocation registry</font>. This metadata references a credential definition and
87+
specifies how revocation for that credential type will be handled.
88+
The revocation registry tells which cryptographic <font color="blue">
89+
accumulator</font> can be used to test revocation, and gives the URI and
90+
hash of the associated <font color="blue">tails file</font>.
91+
92+
4. Each issuer must publish on the ledger an accumulator value that
93+
describes the revocation status for all associated credentials. This
94+
accumulator must be updated on a periodic or as-needed basis. For
95+
example, if a driver's license division revokes 3 licenses during a
96+
given work day, then when they close their doors at 5 pm, they might
97+
issue a ledger transaction that updates the accumulator value for
98+
their driver's license credentials, removing the 3 revoked credentials
99+
from the accumulator. What we mean by "removing" is as described above--
100+
the factors listed in the tails file for the indexes associated with
101+
the 3 revoked credentials are no longer multiplied into the accumulator.
102+
103+
![before and after revocation](before-and-after.png)
104+
105+
## How Revocation Will Be Tested
106+
107+
Let us now skip ahead to think about what needs to happen much later.
108+
When a prover gives proof to a verifier, we normally think about the proof
109+
as focusing on core information demands: _What is your birthdate?_ _Please
110+
disclose your address_. This is <font color="blue">primary proof</font>.
111+
112+
But there is another dimension of proof that's also necessary: _The prover
113+
must demonstrate that the credentials behind the primary proof have not
114+
been revoked._ This is called <font color="blue">proof of non-revocation</font>.
115+
116+
In Indy, proof of non-revocation is accomplished by having provers show
117+
that they can derive the value of the accumulator for their credential
118+
using a factor for the accumulator that they know, plus the product of
119+
all other factors.
120+
The verifier can see that the prover produces the right answer (because
121+
the answer is on the ledger), but does not know certain details of how the
122+
prover derived it. The issuer can revoke by changing the answer to the
123+
math problem in a way that defeats the prover.
124+
125+
## Preparing for Revocation at Issuance
126+
127+
When a credential is issued, the actual credential file is transmitted
128+
to the holder (who will later become a prover). In addition, the issuer
129+
communicates two other pieces of vital information:
130+
131+
* The index corresponding to this credential, in the tails file. This
132+
lets the holder look up their private factor, which we could map to
133+
`a` in the simple equation from the accumulator background section
134+
at the top of the doc.
135+
* The product of the _other_ factors contributing to the accumulator (all
136+
factors except the private one for this credential).
137+
This value is like `b * c * d` from the simple equation above, and
138+
is called a <font color="blue">witness</font>.
139+
140+
## Presenting Proof of Non-Revocation
141+
142+
When the prover needs to demonstrate that her credential is not revoked,
143+
she shows that she can provide math that derives the accumulator value
144+
on the ledger using her private factor times the witness. She does this
145+
without actually disclosing what her private value is; this is important
146+
to avoid correlation.
147+
148+
But there is a complication: what if the accumulator has changed value
149+
since the time the credential was issued? In this case, the private
150+
factor times the witness will not equal the accumulator...
151+
152+
This is handled by requiring accumulator updates to also publish a
153+
<font color="blue">witness delta</font> as part of the same transaction.
154+
This tells provers how to adjust their witness (referencing other indexes
155+
in the public tails file) to bring it back into
156+
harmony with the current value of the accumulator. Updating witnesses
157+
requires the prover (but not the verifier) to download the tails file.
158+
159+
## Putting It All Together
160+
161+
This discussion has suppressed some details. The math has been simplified,
162+
and we haven't discussed how an issuer copes with multiple tails files
163+
and revocation registries, or why that might be desirable. However, the
164+
broad flow of the mechanism should be apparent, and its features are
165+
now easy to summarize:
166+
167+
* Issuers revoke by changing a number on the ledger. They can revoke
168+
as many credentials as they want in a single transaction, since
169+
they are just changing the answer to a math problem that either does
170+
or doesn't include the factors they choose. Issuers do not have to
171+
contact anybody--provers or verifiers--to revoke. Changes take place
172+
globally, the instant the accumulator update transaction appears
173+
on the ledger.
174+
* Revocation is reversible.
175+
* Provers demonstrate proof of non-revocation in a privacy-preserving
176+
way. They cannot be correlated by something like a credential ID or
177+
a tails index. This is radically different from a revocation list
178+
approach, which requires correlation to test.
179+
* Verification of proof of non-revocation is extremely easy and cheap.
180+
No tails files are needed by verifiers, and computation is trivial.
181+
Proving non-revocation is somewhat more expensive for provers, but
182+
is also not overly complex.
183+
* Verifiers do not need to contact issuers or consult a revocation list
184+
to test revocation.

doc/tails.png

32.3 KB
Loading

0 commit comments

Comments
 (0)