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
| Mechanism | Hash function | Digest length in bits | Digest length in bytes |
@@ -112,9 +113,12 @@ table 138: Digest: Data Length
112
113
113
114
### Truncated Digest
114
115
115
-
The truncated digest mechanism, denoted **CKM_SHA512_\<t\>**, is a mechanism for message
116
-
digesting, following the Secure Hash Algorithm
117
-
defined in [FIPS PUB 180-4] section 5.3.6. It is based on a 512-bit message digest with a distinct initial hash value and truncated to \<t\> bits as per table 139. **CKM_SHA512_\<t\>** is the same as **CKM_SHA512_T** with a parameter value of \<t\>.
116
+
The truncated digest mechanism, denoted **CKM_SHA512_\<t\>**, is a mechanism for
117
+
message digesting, following the Secure Hash Algorithm defined in [FIPS PUB
118
+
180-4] section 5.3.6. It is based on a 512-bit message digest with a distinct
119
+
initial hash value and truncated to \<t\> bits as per table 139.
120
+
**CKM_SHA512_\<t\>** is the same as **CKM_SHA512_T** with a parameter value of
**CKM_SHA512_224** and **CKM_SHA512_256** do not have a parameter.
132
136
133
-
**CKM_SHA512_T** has a parameter, a **CK_MAC_GENERAL_PARAMS**, which holds the value of t in bits. The length in bytes of the desired output should be in the range of 0-⌈t/8⌉, where 0 < t < 512, and t <> 384.
137
+
**CKM_SHA512_T** has a parameter, a **CK_MAC_GENERAL_PARAMS**, which holds the
138
+
value of t in bits. The length in bytes of the desired output should be in the
139
+
range of 0-⌈t/8⌉, where 0 < t < 512, and t <> 384.
134
140
135
141
Constraints on the length of input and output data are summarized in the
136
142
following table. For single-part digesting, the data and the digest may begin at
Copy file name to clipboardExpand all lines: working/doc/spec/hash_based_key_derivations.md
+37-12Lines changed: 37 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,12 @@ Mechanisms:
70
70
71
71
### Hash-based key derivation
72
72
73
-
The hash-based key derivation mechanism, denoted **CKM_**\<hash\>**\_KEY_DERIVATION** or **CKM_**\<hash\>**\_KEY_DERIVE** where \<hash\> identifies a hash function or expansion function as per table 142 and as defined in [FIPS PUB 180-4]^1^, [FIPS PUB 202]^2^ or [RFC 7693]^3^ respectively, is a mechanism which provides the capability of deriving a secret key by digesting the value of another secret key with function \<hash\>.
73
+
The hash-based key derivation mechanism, denoted
74
+
**CKM_**\<hash\>**\_KEY_DERIVATION** or **CKM_**\<hash\>**\_KEY_DERIVE** where
75
+
\<hash\> identifies a hash function or expansion function as per table 142 and
76
+
as defined in [FIPS PUB 180-4]^1^, [FIPS PUB 202]^2^ or [RFC 7693]^3^
77
+
respectively, is a mechanism which provides the capability of deriving a secret
78
+
key by digesting the value of another secret key with function \<hash\>.
The value of the base key is digested once, and the result is used to make the value of the derived secret key.
121
+
The value of the base key is digested once, and the result is used to make the
122
+
value of the derived secret key.
117
123
118
-
* If no length or key type is provided in the template, then the key produced by this mechanism will be a generic secret key. Its length will be the digest length in bytes as per table 142.
119
-
* If no key type is provided in the template, but a length is, then the key produced by this mechanism will be a generic secret key of the specified length.
120
-
* If no length was provided in the template, but a key type is, then that key type must have a well-defined length. If it does, then the key produced by this mechanism will be of the type specified in the template. If it doesn’t, an error will be returned.
121
-
* If both a key type and a length are provided in the template, the length must be compatible with that key type. The key produced by this mechanism will be of the specified type and length.
124
+
* If no length or key type is provided in the template, then the key produced by
125
+
this mechanism will be a generic secret key. Its length will be the digest
126
+
length in bytes as per table 142.
127
+
* If no key type is provided in the template, but a length is, then the key
128
+
produced by this mechanism will be a generic secret key of the specified
129
+
length.
130
+
* If no length was provided in the template, but a key type is, then that key
131
+
type must have a well-defined length. If it does, then the key produced by
132
+
this mechanism will be of the type specified in the template. If it doesn’t, an
133
+
error will be returned.
134
+
* If both a key type and a length are provided in the template, the length must
135
+
be compatible with that key type. The key produced by this mechanism will be
136
+
of the specified type and length.
122
137
123
-
If a DES, DES2, or CDMF key is derived with this mechanism, the parity bits of the key will be set properly.
124
-
If the requested type of key requires more than the digest length in bytes, an error is generated.
138
+
If a DES, DES2, or CDMF key is derived with this mechanism, the parity bits of
139
+
the key will be set properly. If the requested type of key requires more than
140
+
the digest length in bytes, an error is generated.
125
141
126
142
This mechanism has the following rules about key sensitivity and extractability:
127
143
128
-
* The **CKA_SENSITIVE** and **CKA_EXTRACTABLE** attributes in the template for the new key can both be specified to be either CK_TRUE or CK_FALSE. If omitted, these attributes each take on some default value.
129
-
* If the base key has its **CKA_ALWAYS_SENSITIVE** attribute set to CK_FALSE, then the derived key will as well. If the base key has its **CKA_ALWAYS_SENSITIVE** attribute set to CK_TRUE, then the derived key has its **CKA_ALWAYS_SENSITIVE** attribute set to the same value as its **CKA_SENSITIVE attribute**.
130
-
* Similarly, if the base key has its **CKA_NEVER_EXTRACTABLE** attribute set to CK_FALSE, then the derived key will, too.
144
+
* The **CKA_SENSITIVE** and **CKA_EXTRACTABLE** attributes in the template for
145
+
the new key can both be specified to be either CK_TRUE or CK_FALSE. If
146
+
omitted, these attributes each take on some default value.
147
+
* If the base key has its **CKA_ALWAYS_SENSITIVE** attribute set to CK_FALSE,
148
+
then the derived key will as well. If the base key has its
149
+
**CKA_ALWAYS_SENSITIVE** attribute set to CK_TRUE, then the derived key has
150
+
its **CKA_ALWAYS_SENSITIVE** attribute set to the same value as its
151
+
**CKA_SENSITIVE** attribute.
152
+
* Similarly, if the base key has its **CKA_NEVER_EXTRACTABLE** attribute set to
153
+
CK_FALSE, then the derived key will, too.
131
154
132
-
If the base key has its **CKA_NEVER_EXTRACTABLE** attribute set to CK_TRUE, then the derived key has its **CKA_NEVER_EXTRACTABLE** attribute set to the opposite value from its **CKA_EXTRACTABLE** attribute.
155
+
If the base key has its **CKA_NEVER_EXTRACTABLE** attribute set to CK_TRUE, then
156
+
the derived key has its **CKA_NEVER_EXTRACTABLE** attribute set to the opposite
Copy file name to clipboardExpand all lines: working/doc/spec/hash_based_message_authentication_codes.md
+25-11Lines changed: 25 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,14 @@
1
1
## Hash-Based Message Authentication Codes (HMAC)
2
2
3
-
HMAC mechanisms are mechanisms for signatures and verification, and for generation of HMAC keys.
4
-
Refer to [RFC 2104] and [FIPS 198] for HMAC algorithm description. The HMAC secret key shall correspond to the PKCS #11 generic secret key type or the mechanism specific key types (see mechanism definition). Such keys for use with HMAC operations can be created using **C_CreateObject**, **C_GenerateKey**, or **C_UnwrapKey**.
5
-
The RFC also specifies test vectors for the various hash function based HMAC mechanisms described in the respective hash mechanism descriptions. The RFC should be consulted to obtain these test vectors.
3
+
HMAC mechanisms are mechanisms for signatures and verification, and for
4
+
generation of HMAC keys. Refer to [RFC 2104] and [FIPS 198] for HMAC algorithm
5
+
description. The HMAC secret key shall correspond to the PKCS #11 generic secret
6
+
key type or the mechanism specific key types (see mechanism definition). Such
7
+
keys for use with HMAC operations can be created using **C_CreateObject**,
8
+
**C_GenerateKey**, or **C_UnwrapKey**. The RFC also specifies test vectors for
9
+
the various hash function based HMAC mechanisms described in the respective hash
10
+
mechanism descriptions. The RFC should be consulted to obtain these test
The general-length HMAC mechanism, denoted **CKM_**\<hash>**\_HMAC_GENERAL**, where \<hash\> identifies a hash function or truncated hash function as per table 144 and as defined in [FIPS PUB 180-4]^1^, [FIPS PUB 202]^2^ or [RFC 7693]^3^ respectively, is a mechanism for signatures and verification. It uses the HMAC construction, based on the \<hash\> hash function. The keys it uses are generic secret keys and **CKK_**\<hash>**\_HMAC** keys.
193
+
The general-length HMAC mechanism, denoted **CKM_**\<hash>**\_HMAC_GENERAL**,
194
+
where \<hash\> identifies a hash function or truncated hash function as per
195
+
table 144 and as defined in [FIPS PUB 180-4]^1^, [FIPS PUB 202]^2^ or [RFC
196
+
7693]^3^ respectively, is a mechanism for signatures and verification. It uses
197
+
the HMAC construction, based on the \<hash\> hash function. The keys it uses are
198
+
generic secret keys and **CKK_**\<hash>**\_HMAC** keys.
188
199
189
200
It has a parameter, a **CK_MAC_GENERAL_PARAMS**, which holds the length in bytes
190
-
of the desired output. This length should be in the range 1-n, where len is the output size of the hash function in bytes as per table 144. Signatures (MACs)
191
-
produced by this mechanism will be taken from the start of the full len-byte HMAC
192
-
output.
201
+
of the desired output. This length should be in the range 1-n, where len is the
202
+
output size of the hash function in bytes as per table 144. Signatures (MACs)
203
+
produced by this mechanism will be taken from the start of the full len-byte
0 commit comments