You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: descriptor.md
+19-19Lines changed: 19 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,10 +59,10 @@ Extended _Descriptor_ field additions proposed in other OCI specifications SHOUL
59
59
60
60
The _digest_ property of a Descriptor acts as a content identifier, enabling [content addressability](http://en.wikipedia.org/wiki/Content-addressable_storage).
61
61
It uniquely identifies content by taking a [collision-resistant hash](https://en.wikipedia.org/wiki/Cryptographic_hash_function) of the bytes.
62
-
If the identifier can be communicated in a secure manner, one can retrieve the content from an insecure source, calculate the digest independently, and be certain that the correct content was obtained.
62
+
If the digest can be communicated in a secure manner, one can retrieve the content from an insecure source, recalculate the digest independently, and be certain that the correct content was obtained.
63
63
64
-
The value of the digest property, the _digest string_, is a serialized hash result, consisting of an _algorithm_ portion and a _hex_ portion.
65
-
The algorithm identifies the methodology used to calculate the digest; the hex portion is the lowercase hex-encoded result of the hash.
64
+
The value of the digest propertyis a string consisting of an _algorithm_ portion (the "algorithm identifier") and a _hex_ portion.
65
+
The algorithm identifier specifies the cryptographic hash function used to calculate the digest; the hex portion is the lowercase hex-encoded result of the hash.
66
66
67
67
The digest string MUST match the following grammar:
68
68
@@ -74,20 +74,17 @@ hex := /[a-f0-9]+/
74
74
75
75
Some example digest strings include the following:
* Before consuming content targeted by a descriptor from untrusted sources, the byte content SHOULD be verified against the digest.
81
+
* Before consuming content targeted by a descriptor from untrusted sources, the byte content SHOULD be verified against the digest string.
82
82
* Before calculating the digest, the size of the content SHOULD be verified to reduce hash collision space.
83
83
* Heavy processing before calculating a hash SHOULD be avoided.
84
-
* Implementations MAY employ some canonicalization of the underlying content to ensure stable content identifiers.
84
+
* Implementations MAY employ [canonicalization](canonicalization.md) of the underlying content to ensure stable content identifiers.
85
85
86
-
### Algorithms
86
+
### Digest calculations
87
87
88
-
While the _algorithm_ component of the digest does allow one to utilize a wide variety of algorithms, compliant implementations SHOULD use [SHA-256](#sha-256).
89
-
90
-
Let's use a simple example in pseudo-code to demonstrate a digest calculation:
91
88
A _digest_ is calculated by the following pseudo-code, where `H` is the selected hash algorithm, identified by string `<alg>`:
92
89
```
93
90
let ID(C) = Descriptor.digest
@@ -97,7 +94,7 @@ let verified = ID(C) == D
97
94
```
98
95
Above, we define the content identifier as `ID(C)`, extracted from the `Descriptor.digest` field.
99
96
Content `C` is a string of bytes.
100
-
Function `H` returns the hash of `C` in bytes and is passed to function `EncodeHex` to obtain the _digest_.
97
+
Function `H` returns the hash of `C` in bytes and is passed to function `EncodeHex`and prefixed with the algorithm to obtain the digest.
101
98
The result `verified` is true if `ID(C)` is equal to `D`, confirming that `C` is the content identified by `D`.
The _digest_ is confirmed as the content identifier by independently calculating the _digest_.
109
106
110
-
#### Registered identifiers
107
+
### Registered algorithms
108
+
109
+
While the _algorithm_ portion (the "algorithm identifier") of the digest string allows the use of a variety of cryptographic algorithms, compliant implementations SHOULD use [SHA-256](#sha-256).
111
110
112
-
The following algorithm identifiers are defined by this specification:
111
+
The following algorithm identifiers are currently defined by this specification:
113
112
114
-
| identifier | algorithm |
115
-
|------------|---------------------|
116
-
|`sha256`|[SHA-256](#sha-256)|
117
-
|`sha512`|[SHA-512](#sha-512)|
113
+
|algorithm identifier | algorithm |
114
+
|----------------------|---------------------|
115
+
|`sha256`|[SHA-256](#sha-256)|
116
+
|`sha512`|[SHA-512](#sha-512)|
118
117
119
-
If a useful algorithm is not included in the above table, it SHOULD be submitted to this specification for standardization.
118
+
If a useful algorithm is not included in the above table, it SHOULD be submitted to this specification for registration.
120
119
121
120
#### SHA-256
122
121
123
-
[SHA-256](https://tools.ietf.org/html/rfc4634#page-7) is a collision-resistant hash function, chosen for ubiquity, reasonable size and secure characteristics.
122
+
[SHA-256][rfc4634-s4.1] is a collision-resistant hash function, chosen for ubiquity, reasonable size and secure characteristics.
124
123
Implementations MUST implement SHA-256 digest verification for use in descriptors.
125
124
126
125
#### SHA-512
@@ -154,6 +153,7 @@ In the following example, the descriptor indicates that the referenced manifest
0 commit comments