€•ÿŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ*/translations/zh_CN/crypto/asymmetric-keys”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/zh_TW/crypto/asymmetric-keys”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/it_IT/crypto/asymmetric-keys”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/ja_JP/crypto/asymmetric-keys”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/ko_KR/crypto/asymmetric-keys”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/pt_BR/crypto/asymmetric-keys”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/sp_SP/crypto/asymmetric-keys”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒD/var/lib/git/docbuild/linux/Documentation/crypto/asymmetric-keys.rst”h´KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ-Asymmetric / Public-key Cryptography Key Type”h]”hŒ-Asymmetric / Public-key Cryptography Key Type”…””}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´Kubh¶)”}”(hŒ»Contents: - Overview. - Key identification. - Accessing asymmetric keys. - Signature verification. - Asymmetric key subtypes. - Instantiation data parsers. - Keyring link restrictions.”h]”hŒ»Contents: - Overview. - Key identification. - Accessing asymmetric keys. - Signature verification. - Asymmetric key subtypes. - Instantiation data parsers. - Keyring link restrictions.”…””}”hhÝsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1hµhhÊh²hh³hÇh´KubhÉ)”}”(hhh]”(hÎ)”}”(hŒOverview”h]”hŒOverview”…””}”(hhîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhëh²hh³hÇh´KubhŒ paragraph”“”)”}”(hŒÓThe "asymmetric" key type is designed to be a container for the keys used in public-key cryptography, without imposing any particular restrictions on the form or mechanism of the cryptography or form of the key.”h]”hŒ×The “asymmetric†key type is designed to be a container for the keys used in public-key cryptography, without imposing any particular restrictions on the form or mechanism of the cryptography or form of the key.”…””}”(hhþh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Khhëh²hubhý)”}”(hŒäThe asymmetric key is given a subtype that defines what sort of data is associated with the key and provides operations to describe and destroy it. However, no requirement is made that the key data actually be stored in the key.”h]”hŒäThe asymmetric key is given a subtype that defines what sort of data is associated with the key and provides operations to describe and destroy it. However, no requirement is made that the key data actually be stored in the key.”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Khhëh²hubhý)”}”(hXWA completely in-kernel key retention and operation subtype can be defined, but it would also be possible to provide access to cryptographic hardware (such as a TPM) that might be used to both retain the relevant key and perform operations using that key. In such a case, the asymmetric key would then merely be an interface to the TPM driver.”h]”hXWA completely in-kernel key retention and operation subtype can be defined, but it would also be possible to provide access to cryptographic hardware (such as a TPM) that might be used to both retain the relevant key and perform operations using that key. In such a case, the asymmetric key would then merely be an interface to the TPM driver.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Khhëh²hubhý)”}”(hX/Also provided is the concept of a data parser. Data parsers are responsible for extracting information from the blobs of data passed to the instantiation function. The first data parser that recognises the blob gets to set the subtype of the key and define the operations that can be done on that key.”h]”hX/Also provided is the concept of a data parser. Data parsers are responsible for extracting information from the blobs of data passed to the instantiation function. The first data parser that recognises the blob gets to set the subtype of the key and define the operations that can be done on that key.”…””}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K$hhëh²hubhý)”}”(hŒ»A data parser may interpret the data blob as containing the bits representing a key, or it may interpret it as a reference to a key held somewhere else in the system (for example, a TPM).”h]”hŒ»A data parser may interpret the data blob as containing the bits representing a key, or it may interpret it as a reference to a key held somewhere else in the system (for example, a TPM).”…””}”(hj6h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K)hhëh²hubeh}”(h]”Œoverview”ah ]”h"]”Œoverview”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KubhÉ)”}”(hhh]”(hÎ)”}”(hŒKey Identification”h]”hŒKey Identification”…””}”(hjOh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjLh²hh³hÇh´K/ubhý)”}”(hŒÇIf a key is added with an empty name, the instantiation data parsers are given the opportunity to pre-parse a key and to determine the description the key should be given from the content of the key.”h]”hŒÇIf a key is added with an empty name, the instantiation data parsers are given the opportunity to pre-parse a key and to determine the description the key should be given from the content of the key.”…””}”(hj]h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K1hjLh²hubhý)”}”(hŒ•This can then be used to refer to the key, either by complete match or by partial match. The key type may also use other criteria to refer to a key.”h]”hŒ•This can then be used to refer to the key, either by complete match or by partial match. The key type may also use other criteria to refer to a key.”…””}”(hjkh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K5hjLh²hubhý)”}”(hŒ­The asymmetric key type's match function can then perform a wider range of comparisons than just the straightforward comparison of the description with the criterion string:”h]”hŒ¯The asymmetric key type’s match function can then perform a wider range of comparisons than just the straightforward comparison of the description with the criterion string:”…””}”(hjyh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K8hjLh²hubhŒ block_quote”“”)”}”(hXu1) If the criterion string is of the form "id:" then the match function will examine a key's fingerprint to see if the hex digits given after the "id:" match the tail. For instance:: keyctl search @s asymmetric id:5acc2142 will match a key with fingerprint:: 1A00 2040 7601 7889 DE11 882C 3823 04AD 5ACC 2142 2) If the criterion string is of the form ":" then the match will match the ID as in (1), but with the added restriction that only keys of the specified subtype (e.g. tpm) will be matched. For instance:: keyctl search @s asymmetric tpm:5acc2142 ”h]”hŒenumerated_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hXHIf the criterion string is of the form "id:" then the match function will examine a key's fingerprint to see if the hex digits given after the "id:" match the tail. For instance:: keyctl search @s asymmetric id:5acc2142 will match a key with fingerprint:: 1A00 2040 7601 7889 DE11 882C 3823 04AD 5ACC 2142 ”h]”(hý)”}”(hŒ¿If the criterion string is of the form "id:" then the match function will examine a key's fingerprint to see if the hex digits given after the "id:" match the tail. For instance::”h]”hŒÈIf the criterion string is of the form “id:†then the match function will examine a key’s fingerprint to see if the hex digits given after the “id:†match the tail. For instance:”…””}”(hj˜h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K:" then the match will match the ID as in (1), but with the added restriction that only keys of the specified subtype (e.g. tpm) will be matched. For instance:: keyctl search @s asymmetric tpm:5acc2142 ”h]”(hý)”}”(hŒÝIf the criterion string is of the form ":" then the match will match the ID as in (1), but with the added restriction that only keys of the specified subtype (e.g. tpm) will be matched. For instance::”h]”hŒàIf the criterion string is of the form “:†then the match will match the ID as in (1), but with the added restriction that only keys of the specified subtype (e.g. tpm) will be matched. For instance:”…””}”(hjÜh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KFhjØubj§)”}”(hŒ(keyctl search @s asymmetric tpm:5acc2142”h]”hŒ(keyctl search @s asymmetric tpm:5acc2142”…””}”hjêsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j¦h³hÇh´KKhjØubeh}”(h]”h ]”h"]”h$]”h&]”uh1j’hjubeh}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œarabic”Œprefix”hŒsuffix”Œ)”uh1jhj‰ubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡h³hÇh´K”h]”hŒ#include ”…””}”hjRsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j¦h³hÇh´KYhj3h²hubhý)”}”(hŒThis gives access to functions for dealing with asymmetric / public keys. Three enums are defined there for representing public-key cryptography algorithms::”h]”hŒœThis gives access to functions for dealing with asymmetric / public keys. Three enums are defined there for representing public-key cryptography algorithms:”…””}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K[hj3h²hubj§)”}”(hŒenum pkey_algo”h]”hŒenum pkey_algo”…””}”hjnsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j¦h³hÇh´K_hj3h²hubhý)”}”(hŒ!digest algorithms used by those::”h]”hŒ digest algorithms used by those:”…””}”(hj|h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kahj3h²hubj§)”}”(hŒenum pkey_hash_algo”h]”hŒenum pkey_hash_algo”…””}”hjŠsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j¦h³hÇh´Kchj3h²hubhý)”}”(hŒ$and key identifier representations::”h]”hŒ#and key identifier representations:”…””}”(hj˜h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kehj3h²hubj§)”}”(hŒenum pkey_id_type”h]”hŒenum pkey_id_type”…””}”hj¦sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j¦h³hÇh´Kghj3h²hubhý)”}”(hX#Note that the key type representation types are required because key identifiers from different standards aren't necessarily compatible. For instance, PGP generates key identifiers by hashing the key data plus some PGP-specific metadata, whereas X.509 has arbitrary certificate identifiers.”h]”hX%Note that the key type representation types are required because key identifiers from different standards aren’t necessarily compatible. For instance, PGP generates key identifiers by hashing the key data plus some PGP-specific metadata, whereas X.509 has arbitrary certificate identifiers.”…””}”(hj´h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kihj3h²hubhý)”}”(hŒ&The operations defined upon a key are:”h]”hŒ&The operations defined upon a key are:”…””}”(hjÂh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Knhj3h²hubjˆ)”}”(hŒ1) Signature verification. ”h]”jŽ)”}”(hhh]”j“)”}”(hŒSignature verification. ”h]”hý)”}”(hŒSignature verification.”h]”hŒSignature verification.”…””}”(hjÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kphj×ubah}”(h]”h ]”h"]”h$]”h&]”uh1j’hjÔubah}”(h]”h ]”h"]”h$]”h&]”jjjhjjuh1jhjÐubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡h³hÇh´Kphj3h²hubhý)”}”(hŒÎOther operations are possible (such as encryption) with the same key data required for verification, but not currently supported, and others (eg. decryption and signature generation) require extra key data.”h]”hŒÎOther operations are possible (such as encryption) with the same key data required for verification, but not currently supported, and others (eg. decryption and signature generation) require extra key data.”…””}”(hjûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Krhj3h²hubhÉ)”}”(hhh]”(hÎ)”}”(hŒSignature Verification”h]”hŒSignature Verification”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj h²hh³hÇh´Kxubhý)”}”(hŒ•An operation is provided to perform cryptographic signature verification, using an asymmetric key to provide or to provide access to the public key::”h]”hŒ”An operation is provided to perform cryptographic signature verification, using an asymmetric key to provide or to provide access to the public key:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kzhj h²hubj§)”}”(hŒiint verify_signature(const struct key *key, const struct public_key_signature *sig);”h]”hŒiint verify_signature(const struct key *key, const struct public_key_signature *sig);”…””}”hj(sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j¦h³hÇh´K}hj h²hubhý)”}”(hŒÜThe caller must have already obtained the key from some source and can then use it to check the signature. The caller must have parsed the signature and transferred the relevant bits to the structure pointed to by sig::”h]”hŒÛThe caller must have already obtained the key from some source and can then use it to check the signature. The caller must have parsed the signature and transferred the relevant bits to the structure pointed to by sig:”…””}”(hj6h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K€hj h²hubj§)”}”(hŒÚstruct public_key_signature { u8 *digest; u8 digest_size; enum pkey_hash_algo pkey_hash_algo : 8; u8 nr_mpi; union { MPI mpi[2]; ... }; };”h]”hŒÚstruct public_key_signature { u8 *digest; u8 digest_size; enum pkey_hash_algo pkey_hash_algo : 8; u8 nr_mpi; union { MPI mpi[2]; ... }; };”…””}”hjDsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j¦h³hÇh´K„hj h²hubhý)”}”(hŒµThe algorithm used must be noted in sig->pkey_hash_algo, and all the MPIs that make up the actual signature must be stored in sig->mpi[] and the count of MPIs placed in sig->nr_mpi.”h]”hŒµThe algorithm used must be noted in sig->pkey_hash_algo, and all the MPIs that make up the actual signature must be stored in sig->mpi[] and the count of MPIs placed in sig->nr_mpi.”…””}”(hjRh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Khj h²hubhý)”}”(hŒ¬In addition, the data must have been digested by the caller and the resulting hash must be pointed to by sig->digest and the size of the hash be placed in sig->digest_size.”h]”hŒ¬In addition, the data must have been digested by the caller and the resulting hash must be pointed to by sig->digest and the size of the hash be placed in sig->digest_size.”…””}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K“hj h²hubhý)”}”(hŒXThe function will return 0 upon success or -EKEYREJECTED if the signature doesn't match.”h]”hŒZThe function will return 0 upon success or -EKEYREJECTED if the signature doesn’t match.”…””}”(hjnh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K—hj h²hubhý)”}”(hXvThe function may also return -ENOTSUPP if an unsupported public-key algorithm or public-key/hash algorithm combination is specified or the key doesn't support the operation; -EBADMSG or -ERANGE if some of the parameters have weird data; or -ENOMEM if an allocation can't be performed. -EINVAL can be returned if the key argument is the wrong type or is incompletely set up.”h]”hXzThe function may also return -ENOTSUPP if an unsupported public-key algorithm or public-key/hash algorithm combination is specified or the key doesn’t support the operation; -EBADMSG or -ERANGE if some of the parameters have weird data; or -ENOMEM if an allocation can’t be performed. -EINVAL can be returned if the key argument is the wrong type or is incompletely set up.”…””}”(hj|h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kšhj h²hubeh}”(h]”Œsignature-verification”ah ]”h"]”Œsignature verification”ah$]”h&]”uh1hÈhj3h²hh³hÇh´Kxubeh}”(h]”Œaccessing-asymmetric-keys”ah ]”h"]”Œaccessing asymmetric keys”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KTubhÉ)”}”(hhh]”(hÎ)”}”(hŒAsymmetric Key Subtypes”h]”hŒAsymmetric Key Subtypes”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjšh²hh³hÇh´K¢ubhý)”}”(hŒÝAsymmetric keys have a subtype that defines the set of operations that can be performed on that key and that determines what data is attached as the key payload. The payload format is entirely at the whim of the subtype.”h]”hŒÝAsymmetric keys have a subtype that defines the set of operations that can be performed on that key and that determines what data is attached as the key payload. The payload format is entirely at the whim of the subtype.”…””}”(hj«h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K¤hjšh²hubhý)”}”(hŒ¦The subtype is selected by the key data parser and the parser must initialise the data required for it. The asymmetric key retains a reference on the subtype module.”h]”hŒ¦The subtype is selected by the key data parser and the parser must initialise the data required for it. The asymmetric key retains a reference on the subtype module.”…””}”(hj¹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K¨hjšh²hubhý)”}”(hŒ2The subtype definition structure can be found in::”h]”hŒ1The subtype definition structure can be found in:”…””}”(hjÇh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K¬hjšh²hubj§)”}”(hŒ$#include ”h]”hŒ$#include ”…””}”hjÕsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j¦h³hÇh´K®hjšh²hubhý)”}”(hŒand looks like the following::”h]”hŒand looks like the following:”…””}”(hjãh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K°hjšh²hubj§)”}”(hX>struct asymmetric_key_subtype { struct module *owner; const char *name; void (*describe)(const struct key *key, struct seq_file *m); void (*destroy)(void *payload); int (*query)(const struct kernel_pkey_params *params, struct kernel_pkey_query *info); int (*eds_op)(struct kernel_pkey_params *params, const void *in, void *out); int (*verify_signature)(const struct key *key, const struct public_key_signature *sig); };”h]”hX>struct asymmetric_key_subtype { struct module *owner; const char *name; void (*describe)(const struct key *key, struct seq_file *m); void (*destroy)(void *payload); int (*query)(const struct kernel_pkey_params *params, struct kernel_pkey_query *info); int (*eds_op)(struct kernel_pkey_params *params, const void *in, void *out); int (*verify_signature)(const struct key *key, const struct public_key_signature *sig); };”…””}”hjñsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j¦h³hÇh´K²hjšh²hubhý)”}”(hŒFAsymmetric keys point to this with their payload[asym_subtype] member.”h]”hŒFAsymmetric keys point to this with their payload[asym_subtype] member.”…””}”(hjÿh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KÀhjšh²hubhý)”}”(hŒ‘The owner and name fields should be set to the owning module and the name of the subtype. Currently, the name is only used for print statements.”h]”hŒ‘The owner and name fields should be set to the owning module and the name of the subtype. Currently, the name is only used for print statements.”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KÂhjšh²hubhý)”}”(hŒ8There are a number of operations defined by the subtype:”h]”hŒ8There are a number of operations defined by the subtype:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KÅhjšh²hubjˆ)”}”(hX1) describe(). Mandatory. This allows the subtype to display something in /proc/keys against the key. For instance the name of the public key algorithm type could be displayed. The key type will display the tail of the key identity string after this. 2) destroy(). Mandatory. This should free the memory associated with the key. The asymmetric key will look after freeing the fingerprint and releasing the reference on the subtype module. 3) query(). Mandatory. This is a function for querying the capabilities of a key. 4) eds_op(). Optional. This is the entry point for the encryption, decryption and signature creation operations (which are distinguished by the operation ID in the parameter struct). The subtype may do anything it likes to implement an operation, including offloading to hardware. 5) verify_signature(). Optional. This is the entry point for signature verification. The subtype may do anything it likes to implement an operation, including offloading to hardware. ”h]”jŽ)”}”(hhh]”(j“)”}”(hŒüdescribe(). Mandatory. This allows the subtype to display something in /proc/keys against the key. For instance the name of the public key algorithm type could be displayed. The key type will display the tail of the key identity string after this. ”h]”(hý)”}”(hŒ describe().”h]”hŒ describe().”…””}”(hj4h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KÇhj0ubhý)”}”(hŒîMandatory. This allows the subtype to display something in /proc/keys against the key. For instance the name of the public key algorithm type could be displayed. The key type will display the tail of the key identity string after this.”h]”hŒîMandatory. This allows the subtype to display something in /proc/keys against the key. For instance the name of the public key algorithm type could be displayed. The key type will display the tail of the key identity string after this.”…””}”(hjBh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KÉhj0ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j’hj-ubj“)”}”(hŒ¼destroy(). Mandatory. This should free the memory associated with the key. The asymmetric key will look after freeing the fingerprint and releasing the reference on the subtype module. ”h]”(hý)”}”(hŒ destroy().”h]”hŒ destroy().”…””}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KÎhjVubhý)”}”(hŒ¯Mandatory. This should free the memory associated with the key. The asymmetric key will look after freeing the fingerprint and releasing the reference on the subtype module.”h]”hŒ¯Mandatory. This should free the memory associated with the key. The asymmetric key will look after freeing the fingerprint and releasing the reference on the subtype module.”…””}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KÐhjVubeh}”(h]”h ]”h"]”h$]”h&]”uh1j’hj-ubj“)”}”(hŒQquery(). Mandatory. This is a function for querying the capabilities of a key. ”h]”(hý)”}”(hŒquery().”h]”hŒquery().”…””}”(hj€h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KÔhj|ubhý)”}”(hŒFMandatory. This is a function for querying the capabilities of a key.”h]”hŒFMandatory. This is a function for querying the capabilities of a key.”…””}”(hjŽh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KÖhj|ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j’hj-ubj“)”}”(hXeds_op(). Optional. This is the entry point for the encryption, decryption and signature creation operations (which are distinguished by the operation ID in the parameter struct). The subtype may do anything it likes to implement an operation, including offloading to hardware. ”h]”(hý)”}”(hŒ eds_op().”h]”hŒ eds_op().”…””}”(hj¦h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KØhj¢ubhý)”}”(hX Optional. This is the entry point for the encryption, decryption and signature creation operations (which are distinguished by the operation ID in the parameter struct). The subtype may do anything it likes to implement an operation, including offloading to hardware.”h]”hX Optional. This is the entry point for the encryption, decryption and signature creation operations (which are distinguished by the operation ID in the parameter struct). The subtype may do anything it likes to implement an operation, including offloading to hardware.”…””}”(hj´h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KÚhj¢ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j’hj-ubj“)”}”(hŒ·verify_signature(). Optional. This is the entry point for signature verification. The subtype may do anything it likes to implement an operation, including offloading to hardware. ”h]”(hý)”}”(hŒverify_signature().”h]”hŒverify_signature().”…””}”(hjÌh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KßhjÈubhý)”}”(hŒ¡Optional. This is the entry point for signature verification. The subtype may do anything it likes to implement an operation, including offloading to hardware.”h]”hŒ¡Optional. This is the entry point for signature verification. The subtype may do anything it likes to implement an operation, including offloading to hardware.”…””}”(hjÚh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KáhjÈubeh}”(h]”h ]”h"]”h$]”h&]”uh1j’hj-ubeh}”(h]”h ]”h"]”h$]”h&]”jjjhjjuh1jhj)ubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡h³hÇh´KÇhjšh²hubeh}”(h]”Œasymmetric-key-subtypes”ah ]”h"]”Œasymmetric key subtypes”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K¢ubhÉ)”}”(hhh]”(hÎ)”}”(hŒInstantiation Data Parsers”h]”hŒInstantiation Data Parsers”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´Kæubhý)”}”(hX„The asymmetric key type doesn't generally want to store or to deal with a raw blob of data that holds the key data. It would have to parse it and error check it each time it wanted to use it. Further, the contents of the blob may have various checks that can be performed on it (eg. self-signatures, validity dates) and may contain useful data about the key (identifiers, capabilities).”h]”hX†The asymmetric key type doesn’t generally want to store or to deal with a raw blob of data that holds the key data. It would have to parse it and error check it each time it wanted to use it. Further, the contents of the blob may have various checks that can be performed on it (eg. self-signatures, validity dates) and may contain useful data about the key (identifiers, capabilities).”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kèhjh²hubhý)”}”(hŒfAlso, the blob may represent a pointer to some hardware containing the key rather than the key itself.”h]”hŒfAlso, the blob may represent a pointer to some hardware containing the key rather than the key itself.”…””}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kîhjh²hubhý)”}”(hŒHExamples of blob formats for which parsers could be implemented include:”h]”hŒHExamples of blob formats for which parsers could be implemented include:”…””}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kñhjh²hubjˆ)”}”(hŒ³- OpenPGP packet stream [RFC 4880]. - X.509 ASN.1 stream. - Pointer to TPM key. - Pointer to UEFI key. - PKCS#8 private key [RFC 5208]. - PKCS#5 encrypted private key [RFC 2898]. ”h]”hŒ bullet_list”“”)”}”(hhh]”(j“)”}”(hŒ!OpenPGP packet stream [RFC 4880].”h]”hý)”}”(hjHh]”hŒ!OpenPGP packet stream [RFC 4880].”…””}”(hjJh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KóhjFubah}”(h]”h ]”h"]”h$]”h&]”uh1j’hjCubj“)”}”(hŒX.509 ASN.1 stream.”h]”hý)”}”(hj_h]”hŒX.509 ASN.1 stream.”…””}”(hjah²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kôhj]ubah}”(h]”h ]”h"]”h$]”h&]”uh1j’hjCubj“)”}”(hŒPointer to TPM key.”h]”hý)”}”(hjvh]”hŒPointer to TPM key.”…””}”(hjxh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kõhjtubah}”(h]”h ]”h"]”h$]”h&]”uh1j’hjCubj“)”}”(hŒPointer to UEFI key.”h]”hý)”}”(hjh]”hŒPointer to UEFI key.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Köhj‹ubah}”(h]”h ]”h"]”h$]”h&]”uh1j’hjCubj“)”}”(hŒPKCS#8 private key [RFC 5208].”h]”hý)”}”(hj¤h]”hŒPKCS#8 private key [RFC 5208].”…””}”(hj¦h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K÷hj¢ubah}”(h]”h ]”h"]”h$]”h&]”uh1j’hjCubj“)”}”(hŒ)PKCS#5 encrypted private key [RFC 2898]. ”h]”hý)”}”(hŒ(PKCS#5 encrypted private key [RFC 2898].”h]”hŒ(PKCS#5 encrypted private key [RFC 2898].”…””}”(hj½h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Køhj¹ubah}”(h]”h ]”h"]”h$]”h&]”uh1j’hjCubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1jAh³hÇh´Kóhj=ubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡h³hÇh´Kóhjh²hubhý)”}”(hŒ\During key instantiation each parser in the list is tried until one doesn't return -EBADMSG.”h]”hŒ^During key instantiation each parser in the list is tried until one doesn’t return -EBADMSG.”…””}”(hjßh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kúhjh²hubhý)”}”(hŒ1The parser definition structure can be found in::”h]”hŒ0The parser definition structure can be found in:”…””}”(hjíh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kýhjh²hubj§)”}”(hŒ##include ”h]”hŒ##include ”…””}”hjûsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j¦h³hÇh´Kÿhjh²hubhý)”}”(hŒand looks like the following::”h]”hŒand looks like the following:”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Mhjh²hubj§)”}”(hŒ›struct asymmetric_key_parser { struct module *owner; const char *name; int (*parse)(struct key_preparsed_payload *prep); };”h]”hŒ›struct asymmetric_key_parser { struct module *owner; const char *name; int (*parse)(struct key_preparsed_payload *prep); };”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j¦h³hÇh´Mhjh²hubhý)”}”(hŒXThe owner and name fields should be set to the owning module and the name of the parser.”h]”hŒXThe owner and name fields should be set to the owning module and the name of the parser.”…””}”(hj%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´M hjh²hubhý)”}”(hŒVThere is currently only a single operation defined by the parser, and it is mandatory:”h]”hŒVThere is currently only a single operation defined by the parser, and it is mandatory:”…””}”(hj3h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´M hjh²hubjˆ)”}”(hX°1) parse(). This is called to preparse the key from the key creation and update paths. In particular, it is called during the key creation _before_ a key is allocated, and as such, is permitted to provide the key's description in the case that the caller declines to do so. The caller passes a pointer to the following struct with all of the fields cleared, except for data, datalen and quotalen [see Documentation/security/keys/core.rst]:: struct key_preparsed_payload { char *description; void *payload[4]; const void *data; size_t datalen; size_t quotalen; }; The instantiation data is in a blob pointed to by data and is datalen in size. The parse() function is not permitted to change these two values at all, and shouldn't change any of the other values _unless_ they are recognise the blob format and will not return -EBADMSG to indicate it is not theirs. If the parser is happy with the blob, it should propose a description for the key and attach it to ->description, ->payload[asym_subtype] should be set to point to the subtype to be used, ->payload[asym_crypto] should be set to point to the initialised data for that subtype, ->payload[asym_key_ids] should point to one or more hex fingerprints and quotalen should be updated to indicate how much quota this key should account for. When clearing up, the data attached to ->payload[asym_key_ids] and ->description will be kfree()'d and the data attached to ->payload[asm_crypto] will be passed to the subtype's ->destroy() method to be disposed of. A module reference for the subtype pointed to by ->payload[asym_subtype] will be put. If the data format is not recognised, -EBADMSG should be returned. If it is recognised, but the key cannot for some reason be set up, some other negative error code should be returned. On success, 0 should be returned. The key's fingerprint string may be partially matched upon. For a public-key algorithm such as RSA and DSA this will likely be a printable hex version of the key's fingerprint. ”h]”jŽ)”}”(hhh]”j“)”}”(hX>parse(). This is called to preparse the key from the key creation and update paths. In particular, it is called during the key creation _before_ a key is allocated, and as such, is permitted to provide the key's description in the case that the caller declines to do so. The caller passes a pointer to the following struct with all of the fields cleared, except for data, datalen and quotalen [see Documentation/security/keys/core.rst]:: struct key_preparsed_payload { char *description; void *payload[4]; const void *data; size_t datalen; size_t quotalen; }; The instantiation data is in a blob pointed to by data and is datalen in size. The parse() function is not permitted to change these two values at all, and shouldn't change any of the other values _unless_ they are recognise the blob format and will not return -EBADMSG to indicate it is not theirs. If the parser is happy with the blob, it should propose a description for the key and attach it to ->description, ->payload[asym_subtype] should be set to point to the subtype to be used, ->payload[asym_crypto] should be set to point to the initialised data for that subtype, ->payload[asym_key_ids] should point to one or more hex fingerprints and quotalen should be updated to indicate how much quota this key should account for. When clearing up, the data attached to ->payload[asym_key_ids] and ->description will be kfree()'d and the data attached to ->payload[asm_crypto] will be passed to the subtype's ->destroy() method to be disposed of. A module reference for the subtype pointed to by ->payload[asym_subtype] will be put. If the data format is not recognised, -EBADMSG should be returned. If it is recognised, but the key cannot for some reason be set up, some other negative error code should be returned. On success, 0 should be returned. The key's fingerprint string may be partially matched upon. For a public-key algorithm such as RSA and DSA this will likely be a printable hex version of the key's fingerprint. ”h]”(hý)”}”(hŒparse().”h]”hŒparse().”…””}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´MhjHubhý)”}”(hXThis is called to preparse the key from the key creation and update paths. In particular, it is called during the key creation _before_ a key is allocated, and as such, is permitted to provide the key's description in the case that the caller declines to do so.”h]”hXThis is called to preparse the key from the key creation and update paths. In particular, it is called during the key creation _before_ a key is allocated, and as such, is permitted to provide the key’s description in the case that the caller declines to do so.”…””}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´MhjHubhý)”}”(hŒ¦The caller passes a pointer to the following struct with all of the fields cleared, except for data, datalen and quotalen [see Documentation/security/keys/core.rst]::”h]”hŒ¥The caller passes a pointer to the following struct with all of the fields cleared, except for data, datalen and quotalen [see Documentation/security/keys/core.rst]:”…””}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´MhjHubj§)”}”(hŒÎstruct key_preparsed_payload { char *description; void *payload[4]; const void *data; size_t datalen; size_t quotalen; };”h]”hŒÎstruct key_preparsed_payload { char *description; void *payload[4]; const void *data; size_t datalen; size_t quotalen; };”…””}”hjvsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j¦h³hÇh´MhjHubhý)”}”(hX,The instantiation data is in a blob pointed to by data and is datalen in size. The parse() function is not permitted to change these two values at all, and shouldn't change any of the other values _unless_ they are recognise the blob format and will not return -EBADMSG to indicate it is not theirs.”h]”hX.The instantiation data is in a blob pointed to by data and is datalen in size. The parse() function is not permitted to change these two values at all, and shouldn’t change any of the other values _unless_ they are recognise the blob format and will not return -EBADMSG to indicate it is not theirs.”…””}”(hj„h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´M#hjHubhý)”}”(hX¯If the parser is happy with the blob, it should propose a description for the key and attach it to ->description, ->payload[asym_subtype] should be set to point to the subtype to be used, ->payload[asym_crypto] should be set to point to the initialised data for that subtype, ->payload[asym_key_ids] should point to one or more hex fingerprints and quotalen should be updated to indicate how much quota this key should account for.”h]”hX¯If the parser is happy with the blob, it should propose a description for the key and attach it to ->description, ->payload[asym_subtype] should be set to point to the subtype to be used, ->payload[asym_crypto] should be set to point to the initialised data for that subtype, ->payload[asym_key_ids] should point to one or more hex fingerprints and quotalen should be updated to indicate how much quota this key should account for.”…””}”(hj’h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´M)hjHubhý)”}”(hX.When clearing up, the data attached to ->payload[asym_key_ids] and ->description will be kfree()'d and the data attached to ->payload[asm_crypto] will be passed to the subtype's ->destroy() method to be disposed of. A module reference for the subtype pointed to by ->payload[asym_subtype] will be put.”h]”hX2When clearing up, the data attached to ->payload[asym_key_ids] and ->description will be kfree()’d and the data attached to ->payload[asm_crypto] will be passed to the subtype’s ->destroy() method to be disposed of. A module reference for the subtype pointed to by ->payload[asym_subtype] will be put.”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´M1hjHubhý)”}”(hŒÜIf the data format is not recognised, -EBADMSG should be returned. If it is recognised, but the key cannot for some reason be set up, some other negative error code should be returned. On success, 0 should be returned.”h]”hŒÜIf the data format is not recognised, -EBADMSG should be returned. If it is recognised, but the key cannot for some reason be set up, some other negative error code should be returned. On success, 0 should be returned.”…””}”(hj®h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´M8hjHubhý)”}”(hŒ±The key's fingerprint string may be partially matched upon. For a public-key algorithm such as RSA and DSA this will likely be a printable hex version of the key's fingerprint.”h]”hŒµThe key’s fingerprint string may be partially matched upon. For a public-key algorithm such as RSA and DSA this will likely be a printable hex version of the key’s fingerprint.”…””}”(hj¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´M<hjHubeh}”(h]”h ]”h"]”h$]”h&]”uh1j’hjEubah}”(h]”h ]”h"]”h$]”h&]”jjjhjjuh1jhjAubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡h³hÇh´Mhjh²hubhý)”}”(hŒ;Functions are provided to register and unregister parsers::”h]”hŒ:Functions are provided to register and unregister parsers:”…””}”(hjÜh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´M@hjh²hubj§)”}”(hŒ—int register_asymmetric_key_parser(struct asymmetric_key_parser *parser); void unregister_asymmetric_key_parser(struct asymmetric_key_parser *subtype);”h]”hŒ—int register_asymmetric_key_parser(struct asymmetric_key_parser *parser); void unregister_asymmetric_key_parser(struct asymmetric_key_parser *subtype);”…””}”hjêsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j¦h³hÇh´MBhjh²hubhý)”}”(hŒlParsers may not have the same name. The names are otherwise only used for displaying in debugging messages.”h]”hŒlParsers may not have the same name. The names are otherwise only used for displaying in debugging messages.”…””}”(hjøh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´MEhjh²hubeh}”(h]”Œinstantiation-data-parsers”ah ]”h"]”Œinstantiation data parsers”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KæubhÉ)”}”(hhh]”(hÎ)”}”(hŒKeyring Link Restrictions”h]”hŒKeyring Link Restrictions”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´MJubhý)”}”(hŒ¨Keyrings created from userspace using add_key can be configured to check the signature of the key being linked. Keys without a valid signature are not allowed to link.”h]”hŒ¨Keyrings created from userspace using add_key can be configured to check the signature of the key being linked. Keys without a valid signature are not allowed to link.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´MLhjh²hubhý)”}”(hŒ*Several restriction methods are available:”h]”hŒ*Several restriction methods are available:”…””}”(hj-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´MPhjh²hubjˆ)”}”(hX¸1) Restrict using the kernel builtin trusted keyring - Option string used with KEYCTL_RESTRICT_KEYRING: - "builtin_trusted" The kernel builtin trusted keyring will be searched for the signing key. If the builtin trusted keyring is not configured, all links will be rejected. The ca_keys kernel parameter also affects which keys are used for signature verification. 2) Restrict using the kernel builtin and secondary trusted keyrings - Option string used with KEYCTL_RESTRICT_KEYRING: - "builtin_and_secondary_trusted" The kernel builtin and secondary trusted keyrings will be searched for the signing key. If the secondary trusted keyring is not configured, this restriction will behave like the "builtin_trusted" option. The ca_keys kernel parameter also affects which keys are used for signature verification. 3) Restrict using a separate key or keyring - Option string used with KEYCTL_RESTRICT_KEYRING: - "key_or_keyring:[:chain]" Whenever a key link is requested, the link will only succeed if the key being linked is signed by one of the designated keys. This key may be specified directly by providing a serial number for one asymmetric key, or a group of keys may be searched for the signing key by providing the serial number for a keyring. When the "chain" option is provided at the end of the string, the keys within the destination keyring will also be searched for signing keys. This allows for verification of certificate chains by adding each certificate in order (starting closest to the root) to a keyring. For instance, one keyring can be populated with links to a set of root certificates, with a separate, restricted keyring set up for each certificate chain to be validated:: # Create and populate a keyring for root certificates root_id=`keyctl add keyring root-certs "" @s` keyctl padd asymmetric "" $root_id < root1.cert keyctl padd asymmetric "" $root_id < root2.cert # Create and restrict a keyring for the certificate chain chain_id=`keyctl add keyring chain "" @s` keyctl restrict_keyring $chain_id asymmetric key_or_keyring:$root_id:chain # Attempt to add each certificate in the chain, starting with the # certificate closest to the root. keyctl padd asymmetric "" $chain_id < intermediateA.cert keyctl padd asymmetric "" $chain_id < intermediateB.cert keyctl padd asymmetric "" $chain_id < end-entity.cert If the final end-entity certificate is successfully added to the "chain" keyring, we can be certain that it has a valid signing chain going back to one of the root certificates. A single keyring can be used to verify a chain of signatures by restricting the keyring after linking the root certificate:: # Create a keyring for the certificate chain and add the root chain2_id=`keyctl add keyring chain2 "" @s` keyctl padd asymmetric "" $chain2_id < root1.cert # Restrict the keyring that already has root1.cert linked. The cert # will remain linked by the keyring. keyctl restrict_keyring $chain2_id asymmetric key_or_keyring:0:chain # Attempt to add each certificate in the chain, starting with the # certificate closest to the root. keyctl padd asymmetric "" $chain2_id < intermediateA.cert keyctl padd asymmetric "" $chain2_id < intermediateB.cert keyctl padd asymmetric "" $chain2_id < end-entity.cert If the final end-entity certificate is successfully added to the "chain2" keyring, we can be certain that there is a valid signing chain going back to the root certificate that was added before the keyring was restricted. ”h]”jŽ)”}”(hhh]”(j“)”}”(hXoRestrict using the kernel builtin trusted keyring - Option string used with KEYCTL_RESTRICT_KEYRING: - "builtin_trusted" The kernel builtin trusted keyring will be searched for the signing key. If the builtin trusted keyring is not configured, all links will be rejected. The ca_keys kernel parameter also affects which keys are used for signature verification. ”h]”(hý)”}”(hŒ1Restrict using the kernel builtin trusted keyring”h]”hŒ1Restrict using the kernel builtin trusted keyring”…””}”(hjFh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´MRhjBubjB)”}”(hhh]”j“)”}”(hŒEOption string used with KEYCTL_RESTRICT_KEYRING: - "builtin_trusted" ”h]”hý)”}”(hŒDOption string used with KEYCTL_RESTRICT_KEYRING: - "builtin_trusted"”h]”hŒHOption string used with KEYCTL_RESTRICT_KEYRING: - “builtin_trusted—…””}”(hj[h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´MThjWubah}”(h]”h ]”h"]”h$]”h&]”uh1j’hjTubah}”(h]”h ]”h"]”h$]”h&]”j×jØuh1jAh³hÇh´MThjBubhý)”}”(hŒñThe kernel builtin trusted keyring will be searched for the signing key. If the builtin trusted keyring is not configured, all links will be rejected. The ca_keys kernel parameter also affects which keys are used for signature verification.”h]”hŒñThe kernel builtin trusted keyring will be searched for the signing key. If the builtin trusted keyring is not configured, all links will be rejected. The ca_keys kernel parameter also affects which keys are used for signature verification.”…””}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´MWhjBubeh}”(h]”h ]”h"]”h$]”h&]”uh1j’hj?ubj“)”}”(hXÂRestrict using the kernel builtin and secondary trusted keyrings - Option string used with KEYCTL_RESTRICT_KEYRING: - "builtin_and_secondary_trusted" The kernel builtin and secondary trusted keyrings will be searched for the signing key. If the secondary trusted keyring is not configured, this restriction will behave like the "builtin_trusted" option. The ca_keys kernel parameter also affects which keys are used for signature verification. ”h]”(hý)”}”(hŒ@Restrict using the kernel builtin and secondary trusted keyrings”h]”hŒ@Restrict using the kernel builtin and secondary trusted keyrings”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´M\hj‰ubjB)”}”(hhh]”j“)”}”(hŒSOption string used with KEYCTL_RESTRICT_KEYRING: - "builtin_and_secondary_trusted" ”h]”hý)”}”(hŒROption string used with KEYCTL_RESTRICT_KEYRING: - "builtin_and_secondary_trusted"”h]”hŒVOption string used with KEYCTL_RESTRICT_KEYRING: - “builtin_and_secondary_trusted—…””}”(hj¢h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´M^hjžubah}”(h]”h ]”h"]”h$]”h&]”uh1j’hj›ubah}”(h]”h ]”h"]”h$]”h&]”j×jØuh1jAh³hÇh´M^hj‰ubhý)”}”(hX'The kernel builtin and secondary trusted keyrings will be searched for the signing key. If the secondary trusted keyring is not configured, this restriction will behave like the "builtin_trusted" option. The ca_keys kernel parameter also affects which keys are used for signature verification.”h]”hX+The kernel builtin and secondary trusted keyrings will be searched for the signing key. If the secondary trusted keyring is not configured, this restriction will behave like the “builtin_trusted†option. The ca_keys kernel parameter also affects which keys are used for signature verification.”…””}”(hj¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Mahj‰ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j’hj?ubj“)”}”(hXÎ Restrict using a separate key or keyring - Option string used with KEYCTL_RESTRICT_KEYRING: - "key_or_keyring:[:chain]" Whenever a key link is requested, the link will only succeed if the key being linked is signed by one of the designated keys. This key may be specified directly by providing a serial number for one asymmetric key, or a group of keys may be searched for the signing key by providing the serial number for a keyring. When the "chain" option is provided at the end of the string, the keys within the destination keyring will also be searched for signing keys. This allows for verification of certificate chains by adding each certificate in order (starting closest to the root) to a keyring. For instance, one keyring can be populated with links to a set of root certificates, with a separate, restricted keyring set up for each certificate chain to be validated:: # Create and populate a keyring for root certificates root_id=`keyctl add keyring root-certs "" @s` keyctl padd asymmetric "" $root_id < root1.cert keyctl padd asymmetric "" $root_id < root2.cert # Create and restrict a keyring for the certificate chain chain_id=`keyctl add keyring chain "" @s` keyctl restrict_keyring $chain_id asymmetric key_or_keyring:$root_id:chain # Attempt to add each certificate in the chain, starting with the # certificate closest to the root. keyctl padd asymmetric "" $chain_id < intermediateA.cert keyctl padd asymmetric "" $chain_id < intermediateB.cert keyctl padd asymmetric "" $chain_id < end-entity.cert If the final end-entity certificate is successfully added to the "chain" keyring, we can be certain that it has a valid signing chain going back to one of the root certificates. A single keyring can be used to verify a chain of signatures by restricting the keyring after linking the root certificate:: # Create a keyring for the certificate chain and add the root chain2_id=`keyctl add keyring chain2 "" @s` keyctl padd asymmetric "" $chain2_id < root1.cert # Restrict the keyring that already has root1.cert linked. The cert # will remain linked by the keyring. keyctl restrict_keyring $chain2_id asymmetric key_or_keyring:0:chain # Attempt to add each certificate in the chain, starting with the # certificate closest to the root. keyctl padd asymmetric "" $chain2_id < intermediateA.cert keyctl padd asymmetric "" $chain2_id < intermediateB.cert keyctl padd asymmetric "" $chain2_id < end-entity.cert If the final end-entity certificate is successfully added to the "chain2" keyring, we can be certain that there is a valid signing chain going back to the root certificate that was added before the keyring was restricted. ”h]”(hý)”}”(hŒ(Restrict using a separate key or keyring”h]”hŒ(Restrict using a separate key or keyring”…””}”(hjÔh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´MghjÐubjB)”}”(hhh]”j“)”}”(hŒkOption string used with KEYCTL_RESTRICT_KEYRING: - "key_or_keyring:[:chain]" ”h]”hý)”}”(hŒjOption string used with KEYCTL_RESTRICT_KEYRING: - "key_or_keyring:[:chain]"”h]”hŒnOption string used with KEYCTL_RESTRICT_KEYRING: - “key_or_keyring:[:chain]—…””}”(hjéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Mihjåubah}”(h]”h ]”h"]”h$]”h&]”uh1j’hjâubah}”(h]”h ]”h"]”h$]”h&]”j×jØuh1jAh³hÇh´MihjÐubhý)”}”(hX;Whenever a key link is requested, the link will only succeed if the key being linked is signed by one of the designated keys. This key may be specified directly by providing a serial number for one asymmetric key, or a group of keys may be searched for the signing key by providing the serial number for a keyring.”h]”hX;Whenever a key link is requested, the link will only succeed if the key being linked is signed by one of the designated keys. This key may be specified directly by providing a serial number for one asymmetric key, or a group of keys may be searched for the signing key by providing the serial number for a keyring.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´MlhjÐubhý)”}”(hX¿When the "chain" option is provided at the end of the string, the keys within the destination keyring will also be searched for signing keys. This allows for verification of certificate chains by adding each certificate in order (starting closest to the root) to a keyring. For instance, one keyring can be populated with links to a set of root certificates, with a separate, restricted keyring set up for each certificate chain to be validated::”h]”hXÂWhen the “chain†option is provided at the end of the string, the keys within the destination keyring will also be searched for signing keys. This allows for verification of certificate chains by adding each certificate in order (starting closest to the root) to a keyring. For instance, one keyring can be populated with links to a set of root certificates, with a separate, restricted keyring set up for each certificate chain to be validated:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´MrhjÐubj§)”}”(hX# Create and populate a keyring for root certificates root_id=`keyctl add keyring root-certs "" @s` keyctl padd asymmetric "" $root_id < root1.cert keyctl padd asymmetric "" $root_id < root2.cert # Create and restrict a keyring for the certificate chain chain_id=`keyctl add keyring chain "" @s` keyctl restrict_keyring $chain_id asymmetric key_or_keyring:$root_id:chain # Attempt to add each certificate in the chain, starting with the # certificate closest to the root. keyctl padd asymmetric "" $chain_id < intermediateA.cert keyctl padd asymmetric "" $chain_id < intermediateB.cert keyctl padd asymmetric "" $chain_id < end-entity.cert”h]”hX# Create and populate a keyring for root certificates root_id=`keyctl add keyring root-certs "" @s` keyctl padd asymmetric "" $root_id < root1.cert keyctl padd asymmetric "" $root_id < root2.cert # Create and restrict a keyring for the certificate chain chain_id=`keyctl add keyring chain "" @s` keyctl restrict_keyring $chain_id asymmetric key_or_keyring:$root_id:chain # Attempt to add each certificate in the chain, starting with the # certificate closest to the root. keyctl padd asymmetric "" $chain_id < intermediateA.cert keyctl padd asymmetric "" $chain_id < intermediateB.cert keyctl padd asymmetric "" $chain_id < end-entity.cert”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j¦h³hÇh´MzhjÐubhý)”}”(hŒ±If the final end-entity certificate is successfully added to the "chain" keyring, we can be certain that it has a valid signing chain going back to one of the root certificates.”h]”hŒµIf the final end-entity certificate is successfully added to the “chain†keyring, we can be certain that it has a valid signing chain going back to one of the root certificates.”…””}”(hj-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´M‰hjÐubhý)”}”(hŒ|A single keyring can be used to verify a chain of signatures by restricting the keyring after linking the root certificate::”h]”hŒ{A single keyring can be used to verify a chain of signatures by restricting the keyring after linking the root certificate:”…””}”(hj;h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´MhjÐubj§)”}”(hX\# Create a keyring for the certificate chain and add the root chain2_id=`keyctl add keyring chain2 "" @s` keyctl padd asymmetric "" $chain2_id < root1.cert # Restrict the keyring that already has root1.cert linked. The cert # will remain linked by the keyring. keyctl restrict_keyring $chain2_id asymmetric key_or_keyring:0:chain # Attempt to add each certificate in the chain, starting with the # certificate closest to the root. keyctl padd asymmetric "" $chain2_id < intermediateA.cert keyctl padd asymmetric "" $chain2_id < intermediateB.cert keyctl padd asymmetric "" $chain2_id < end-entity.cert”h]”hX\# Create a keyring for the certificate chain and add the root chain2_id=`keyctl add keyring chain2 "" @s` keyctl padd asymmetric "" $chain2_id < root1.cert # Restrict the keyring that already has root1.cert linked. The cert # will remain linked by the keyring. keyctl restrict_keyring $chain2_id asymmetric key_or_keyring:0:chain # Attempt to add each certificate in the chain, starting with the # certificate closest to the root. keyctl padd asymmetric "" $chain2_id < intermediateA.cert keyctl padd asymmetric "" $chain2_id < intermediateB.cert keyctl padd asymmetric "" $chain2_id < end-entity.cert”…””}”hjIsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j¦h³hÇh´MhjÐubhý)”}”(hŒÝIf the final end-entity certificate is successfully added to the "chain2" keyring, we can be certain that there is a valid signing chain going back to the root certificate that was added before the keyring was restricted.”h]”hŒáIf the final end-entity certificate is successfully added to the “chain2†keyring, we can be certain that there is a valid signing chain going back to the root certificate that was added before the keyring was restricted.”…””}”(hjWh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´MžhjÐubeh}”(h]”h ]”h"]”h$]”h&]”uh1j’hj?ubeh}”(h]”h ]”h"]”h$]”h&]”jjjhjjuh1jhj;ubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡h³hÇh´MRhjh²hubhý)”}”(hXÀIn all of these cases, if the signing key is found the signature of the key to be linked will be verified using the signing key. The requested key is added to the keyring only if the signature is successfully verified. -ENOKEY is returned if the parent certificate could not be found, or -EKEYREJECTED is returned if the signature check fails or the key is blacklisted. Other errors may be returned if the signature check could not be performed.”h]”hXÀIn all of these cases, if the signing key is found the signature of the key to be linked will be verified using the signing key. The requested key is added to the keyring only if the signature is successfully verified. -ENOKEY is returned if the parent certificate could not be found, or -EKEYREJECTED is returned if the signature check fails or the key is blacklisted. Other errors may be returned if the signature check could not be performed.”…””}”(hjwh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´M£hjh²hubeh}”(h]”Œkeyring-link-restrictions”ah ]”h"]”Œkeyring link restrictions”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´MJubeh}”(h]”Œ+asymmetric-public-key-cryptography-key-type”ah ]”h"]”Œ-asymmetric / public-key cryptography key type”ah$]”h&]”uh1hÈhhh²hh³hÇh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hÍNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”j¸Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(j’jjIjFj0j-j—j”jjŒjÿjüj jjŠj‡uŒ nametypes”}”(j’‰jI‰j0‰j—‰j‰jÿ‰j ‰jЉuh}”(jhÊjFhëj-jLj”j3jŒj jüjšjjj‡juŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.