Gilles Peskine | 6c723a2 | 2020-04-17 16:57:52 +0200 | [diff] [blame^] | 1 | |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| 3 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 4 | |
| 5 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 6 | <head> |
| 7 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 8 | <title>Key policies — PSA Crypto API 1.0.0 documentation</title> |
| 9 | <link rel="stylesheet" href="../../_static/alabaster.css" type="text/css" /> |
| 10 | <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> |
| 11 | <script type="text/javascript"> |
| 12 | var DOCUMENTATION_OPTIONS = { |
| 13 | URL_ROOT: '../../', |
| 14 | VERSION: '1.0.0', |
| 15 | COLLAPSE_INDEX: false, |
| 16 | FILE_SUFFIX: '.html', |
| 17 | HAS_SOURCE: true, |
| 18 | SOURCELINK_SUFFIX: '.txt' |
| 19 | }; |
| 20 | </script> |
| 21 | <script type="text/javascript" src="../../_static/jquery.js"></script> |
| 22 | <script type="text/javascript" src="../../_static/underscore.js"></script> |
| 23 | <script type="text/javascript" src="../../_static/doctools.js"></script> |
| 24 | <link rel="index" title="Index" href="../../genindex.html" /> |
| 25 | <link rel="search" title="Search" href="../../search.html" /> |
| 26 | <link rel="next" title="Algorithms" href="algorithms.html" /> |
| 27 | <link rel="prev" title="Key types" href="types.html" /> |
| 28 | |
| 29 | <link rel="stylesheet" href="../../_static/custom.css" type="text/css" /> |
| 30 | |
| 31 | <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" /> |
| 32 | |
| 33 | </head> |
| 34 | <body> |
| 35 | |
| 36 | |
| 37 | <div class="document"> |
| 38 | <div class="documentwrapper"> |
| 39 | <div class="bodywrapper"> |
| 40 | <div class="body" role="main"> |
| 41 | |
| 42 | <div class="section" id="key-policies"> |
| 43 | <span id="key-usage"></span><h1>Key policies</h1> |
| 44 | <div class="section" id="key-usage-flags"> |
| 45 | <h2>Key usage flags</h2> |
| 46 | <div class="section" id="PSA_KEY_USAGE_EXPORT"> |
| 47 | <span id="c.PSA_KEY_USAGE_EXPORT"></span><h3><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_EXPORT</span></code> (macro)</h3> |
| 48 | <p>Permission to export the key.</p> |
| 49 | <pre class="literal-block"> |
| 50 | #define <a class="reference internal" href="#c.PSA_KEY_USAGE_EXPORT" title="PSA_KEY_USAGE_EXPORT">PSA_KEY_USAGE_EXPORT</a> ((<a class="reference internal" href="attributes.html#c.psa_key_usage_t" title="psa_key_usage_t">psa_key_usage_t</a>)0x00000001) |
| 51 | </pre> |
| 52 | <p>This flag allows the use of <a class="reference internal" href="management.html#c.psa_export_key" title="psa_export_key"><code class="xref any c c-func docutils literal"><span class="pre">psa_export_key()</span></code></a> to export a key from the cryptoprocessor. A public key or the public part of a key pair can always be exported regardless of the value of this permission flag.</p> |
| 53 | <p>This flag can also be required to copy a key using <a class="reference internal" href="management.html#c.psa_copy_key" title="psa_copy_key"><code class="xref any c c-func docutils literal"><span class="pre">psa_copy_key()</span></code></a> outside of a secure element. See also <a class="reference internal" href="#c.PSA_KEY_USAGE_COPY" title="PSA_KEY_USAGE_COPY"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_KEY_USAGE_COPY</span></code></a>.</p> |
| 54 | <p>If a key does not have export permission, implementations must not allow the key to be exported in plain form from the cryptoprocessor, whether through <a class="reference internal" href="management.html#c.psa_export_key" title="psa_export_key"><code class="xref any c c-func docutils literal"><span class="pre">psa_export_key()</span></code></a> or through a proprietary interface. The key might still be exportable in a wrapped form, i.e. in a form where it is encrypted by another key.</p> |
| 55 | </div> |
| 56 | <div class="section" id="PSA_KEY_USAGE_COPY"> |
| 57 | <span id="c.PSA_KEY_USAGE_COPY"></span><h3><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_COPY</span></code> (macro)</h3> |
| 58 | <p>Permission to copy the key.</p> |
| 59 | <pre class="literal-block"> |
| 60 | #define <a class="reference internal" href="#c.PSA_KEY_USAGE_COPY" title="PSA_KEY_USAGE_COPY">PSA_KEY_USAGE_COPY</a> ((<a class="reference internal" href="attributes.html#c.psa_key_usage_t" title="psa_key_usage_t">psa_key_usage_t</a>)0x00000002) |
| 61 | </pre> |
| 62 | <p>This flag allows the use of <a class="reference internal" href="management.html#c.psa_copy_key" title="psa_copy_key"><code class="xref any c c-func docutils literal"><span class="pre">psa_copy_key()</span></code></a> to make a copy of the key with the same policy or a more restrictive policy.</p> |
| 63 | <p>For lifetimes for which the key is located in a secure element which enforce the non-exportability of keys, copying a key outside the secure element also requires the usage flag <a class="reference internal" href="#c.PSA_KEY_USAGE_EXPORT" title="PSA_KEY_USAGE_EXPORT"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_KEY_USAGE_EXPORT</span></code></a>. Copying the key inside the secure element is permitted with just <a class="reference internal" href="#c.PSA_KEY_USAGE_COPY" title="PSA_KEY_USAGE_COPY"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_KEY_USAGE_COPY</span></code></a> if the secure element supports it. For keys with the lifetime <a class="reference internal" href="locations.html#c.PSA_KEY_LIFETIME_VOLATILE" title="PSA_KEY_LIFETIME_VOLATILE"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_KEY_LIFETIME_VOLATILE</span></code></a> or <a class="reference internal" href="locations.html#c.PSA_KEY_LIFETIME_PERSISTENT" title="PSA_KEY_LIFETIME_PERSISTENT"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_KEY_LIFETIME_PERSISTENT</span></code></a>, the usage flag <a class="reference internal" href="#c.PSA_KEY_USAGE_COPY" title="PSA_KEY_USAGE_COPY"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_KEY_USAGE_COPY</span></code></a> is sufficient to permit the copy.</p> |
| 64 | </div> |
| 65 | <div class="section" id="PSA_KEY_USAGE_CACHE"> |
| 66 | <span id="c.PSA_KEY_USAGE_CACHE"></span><h3><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_CACHE</span></code> (macro)</h3> |
| 67 | <p>Permission for the implementation to cache the key.</p> |
| 68 | <pre class="literal-block"> |
| 69 | #define <a class="reference internal" href="#c.PSA_KEY_USAGE_CACHE" title="PSA_KEY_USAGE_CACHE">PSA_KEY_USAGE_CACHE</a> ((<a class="reference internal" href="attributes.html#c.psa_key_usage_t" title="psa_key_usage_t">psa_key_usage_t</a>)0x00000004) |
| 70 | </pre> |
| 71 | <p>This flag allows the implementation to make additional copies of the key material that are not in storage and not for the purpose of an ongoing operation. Applications can use it as a hint to keep the key around for repeated access.</p> |
| 72 | <p>An application can request that cached key material is removed from memory by calling <a class="reference internal" href="management.html#c.psa_purge_key" title="psa_purge_key"><code class="xref any c c-func docutils literal"><span class="pre">psa_purge_key()</span></code></a>.</p> |
| 73 | <p>The presence of this key policy when creating a key is a hint:</p> |
| 74 | <ul class="simple"> |
| 75 | <li>An implementation is not required to cache keys that have this policy.</li> |
| 76 | <li>An implementation must not report an error if it does not cache keys.</li> |
| 77 | </ul> |
| 78 | <p>If this key policy is not present, the implementation must ensure key material is removed from memory as soon as it is not required for an operation or for maintenance of a volatile key.</p> |
| 79 | <p>This flag must be preserved when reading back the attributes for all keys, regardless of key type or implementation behavior.</p> |
| 80 | <p>See also <em><a class="reference internal" href="../../overview/implementation.html#key-material"><span class="std std-ref">Managing key material</span></a></em>.</p> |
| 81 | </div> |
| 82 | <div class="section" id="PSA_KEY_USAGE_ENCRYPT"> |
| 83 | <span id="c.PSA_KEY_USAGE_ENCRYPT"></span><h3><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_ENCRYPT</span></code> (macro)</h3> |
| 84 | <p>Permission to encrypt a message with the key.</p> |
| 85 | <pre class="literal-block"> |
| 86 | #define <a class="reference internal" href="#c.PSA_KEY_USAGE_ENCRYPT" title="PSA_KEY_USAGE_ENCRYPT">PSA_KEY_USAGE_ENCRYPT</a> ((<a class="reference internal" href="attributes.html#c.psa_key_usage_t" title="psa_key_usage_t">psa_key_usage_t</a>)0x00000100) |
| 87 | </pre> |
| 88 | <p>This flag allows the key to be used for a symmetric encryption operation, for an AEAD encryption-and-authentication operation, or for an asymmetric encryption operation, if otherwise permitted by the key’s type and policy. The flag must be present on keys used with the following APIs:</p> |
| 89 | <ul class="simple"> |
| 90 | <li><a class="reference internal" href="../ops/ciphers.html#c.psa_cipher_encrypt" title="psa_cipher_encrypt"><code class="xref any c c-func docutils literal"><span class="pre">psa_cipher_encrypt()</span></code></a></li> |
| 91 | <li><a class="reference internal" href="../ops/ciphers.html#c.psa_cipher_encrypt_setup" title="psa_cipher_encrypt_setup"><code class="xref any c c-func docutils literal"><span class="pre">psa_cipher_encrypt_setup()</span></code></a></li> |
| 92 | <li><a class="reference internal" href="../ops/aead.html#c.psa_aead_encrypt" title="psa_aead_encrypt"><code class="xref any c c-func docutils literal"><span class="pre">psa_aead_encrypt()</span></code></a></li> |
| 93 | <li><a class="reference internal" href="../ops/aead.html#c.psa_aead_encrypt_setup" title="psa_aead_encrypt_setup"><code class="xref any c c-func docutils literal"><span class="pre">psa_aead_encrypt_setup()</span></code></a></li> |
| 94 | <li><a class="reference internal" href="../ops/pke.html#c.psa_asymmetric_encrypt" title="psa_asymmetric_encrypt"><code class="xref any c c-func docutils literal"><span class="pre">psa_asymmetric_encrypt()</span></code></a></li> |
| 95 | </ul> |
| 96 | <p>For a key pair, this concerns the public key.</p> |
| 97 | </div> |
| 98 | <div class="section" id="PSA_KEY_USAGE_DECRYPT"> |
| 99 | <span id="c.PSA_KEY_USAGE_DECRYPT"></span><h3><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_DECRYPT</span></code> (macro)</h3> |
| 100 | <p>Permission to decrypt a message with the key.</p> |
| 101 | <pre class="literal-block"> |
| 102 | #define <a class="reference internal" href="#c.PSA_KEY_USAGE_DECRYPT" title="PSA_KEY_USAGE_DECRYPT">PSA_KEY_USAGE_DECRYPT</a> ((<a class="reference internal" href="attributes.html#c.psa_key_usage_t" title="psa_key_usage_t">psa_key_usage_t</a>)0x00000200) |
| 103 | </pre> |
| 104 | <p>This flag allows the key to be used for a symmetric decryption operation, for an AEAD decryption-and-verification operation, or for an asymmetric decryption operation, if otherwise permitted by the key’s type and policy. The flag must be present on keys used with the following APIs:</p> |
| 105 | <ul class="simple"> |
| 106 | <li><a class="reference internal" href="../ops/ciphers.html#c.psa_cipher_decrypt" title="psa_cipher_decrypt"><code class="xref any c c-func docutils literal"><span class="pre">psa_cipher_decrypt()</span></code></a></li> |
| 107 | <li><a class="reference internal" href="../ops/ciphers.html#c.psa_cipher_decrypt_setup" title="psa_cipher_decrypt_setup"><code class="xref any c c-func docutils literal"><span class="pre">psa_cipher_decrypt_setup()</span></code></a></li> |
| 108 | <li><a class="reference internal" href="../ops/aead.html#c.psa_aead_decrypt" title="psa_aead_decrypt"><code class="xref any c c-func docutils literal"><span class="pre">psa_aead_decrypt()</span></code></a></li> |
| 109 | <li><a class="reference internal" href="../ops/aead.html#c.psa_aead_decrypt_setup" title="psa_aead_decrypt_setup"><code class="xref any c c-func docutils literal"><span class="pre">psa_aead_decrypt_setup()</span></code></a></li> |
| 110 | <li><a class="reference internal" href="../ops/pke.html#c.psa_asymmetric_decrypt" title="psa_asymmetric_decrypt"><code class="xref any c c-func docutils literal"><span class="pre">psa_asymmetric_decrypt()</span></code></a></li> |
| 111 | </ul> |
| 112 | <p>For a key pair, this concerns the private key.</p> |
| 113 | </div> |
| 114 | <div class="section" id="PSA_KEY_USAGE_SIGN_MESSAGE"> |
| 115 | <span id="c.PSA_KEY_USAGE_SIGN_MESSAGE"></span><h3><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_SIGN_MESSAGE</span></code> (macro)</h3> |
| 116 | <p>Permission to sign a message with the key.</p> |
| 117 | <pre class="literal-block"> |
| 118 | #define <a class="reference internal" href="#c.PSA_KEY_USAGE_SIGN_MESSAGE" title="PSA_KEY_USAGE_SIGN_MESSAGE">PSA_KEY_USAGE_SIGN_MESSAGE</a> ((<a class="reference internal" href="attributes.html#c.psa_key_usage_t" title="psa_key_usage_t">psa_key_usage_t</a>)0x00000400) |
| 119 | </pre> |
| 120 | <p>This flag allows the key to be used for a MAC calculation operation or for an asymmetric message signature operation, if otherwise permitted by the key’s type and policy. The flag must be present on keys used with the following APIs:</p> |
| 121 | <ul class="simple"> |
| 122 | <li><a class="reference internal" href="../ops/macs.html#c.psa_mac_compute" title="psa_mac_compute"><code class="xref any c c-func docutils literal"><span class="pre">psa_mac_compute()</span></code></a></li> |
| 123 | <li><a class="reference internal" href="../ops/macs.html#c.psa_mac_sign_setup" title="psa_mac_sign_setup"><code class="xref any c c-func docutils literal"><span class="pre">psa_mac_sign_setup()</span></code></a></li> |
| 124 | <li><a class="reference internal" href="../ops/sign.html#c.psa_sign_message" title="psa_sign_message"><code class="xref any c c-func docutils literal"><span class="pre">psa_sign_message()</span></code></a></li> |
| 125 | </ul> |
| 126 | <p>For a key pair, this concerns the private key.</p> |
| 127 | </div> |
| 128 | <div class="section" id="PSA_KEY_USAGE_VERIFY_MESSAGE"> |
| 129 | <span id="c.PSA_KEY_USAGE_VERIFY_MESSAGE"></span><h3><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_VERIFY_MESSAGE</span></code> (macro)</h3> |
| 130 | <p>Permission to verify a message signature with the key.</p> |
| 131 | <pre class="literal-block"> |
| 132 | #define <a class="reference internal" href="#c.PSA_KEY_USAGE_VERIFY_MESSAGE" title="PSA_KEY_USAGE_VERIFY_MESSAGE">PSA_KEY_USAGE_VERIFY_MESSAGE</a> ((<a class="reference internal" href="attributes.html#c.psa_key_usage_t" title="psa_key_usage_t">psa_key_usage_t</a>)0x00000800) |
| 133 | </pre> |
| 134 | <p>This flag allows the key to be used for a MAC verification operation or for an asymmetric message signature verification operation, if otherwise permitted by the key’s type and policy. The flag must be present on keys used with the following APIs:</p> |
| 135 | <ul class="simple"> |
| 136 | <li><a class="reference internal" href="../ops/macs.html#c.psa_mac_verify" title="psa_mac_verify"><code class="xref any c c-func docutils literal"><span class="pre">psa_mac_verify()</span></code></a></li> |
| 137 | <li><a class="reference internal" href="../ops/macs.html#c.psa_mac_verify_setup" title="psa_mac_verify_setup"><code class="xref any c c-func docutils literal"><span class="pre">psa_mac_verify_setup()</span></code></a></li> |
| 138 | <li><a class="reference internal" href="../ops/sign.html#c.psa_verify_message" title="psa_verify_message"><code class="xref any c c-func docutils literal"><span class="pre">psa_verify_message()</span></code></a></li> |
| 139 | </ul> |
| 140 | <p>For a key pair, this concerns the public key.</p> |
| 141 | </div> |
| 142 | <div class="section" id="PSA_KEY_USAGE_SIGN_HASH"> |
| 143 | <span id="c.PSA_KEY_USAGE_SIGN_HASH"></span><h3><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_SIGN_HASH</span></code> (macro)</h3> |
| 144 | <p>Permission to sign a message hash with the key.</p> |
| 145 | <pre class="literal-block"> |
| 146 | #define <a class="reference internal" href="#c.PSA_KEY_USAGE_SIGN_HASH" title="PSA_KEY_USAGE_SIGN_HASH">PSA_KEY_USAGE_SIGN_HASH</a> ((<a class="reference internal" href="attributes.html#c.psa_key_usage_t" title="psa_key_usage_t">psa_key_usage_t</a>)0x00001000) |
| 147 | </pre> |
| 148 | <p>This flag allows the key to be used to sign a message hash as part of an asymmetric signature operation, if otherwise permitted by the key’s type and policy. The flag must be present on keys used when calling <a class="reference internal" href="../ops/sign.html#c.psa_sign_hash" title="psa_sign_hash"><code class="xref any c c-func docutils literal"><span class="pre">psa_sign_hash()</span></code></a>.</p> |
| 149 | <p>This flag automatically sets <a class="reference internal" href="#c.PSA_KEY_USAGE_SIGN_MESSAGE" title="PSA_KEY_USAGE_SIGN_MESSAGE"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_KEY_USAGE_SIGN_MESSAGE</span></code></a>: if an application sets the flag <a class="reference internal" href="#c.PSA_KEY_USAGE_SIGN_HASH" title="PSA_KEY_USAGE_SIGN_HASH"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_KEY_USAGE_SIGN_HASH</span></code></a> when creating a key, then the key always has the permissions conveyed by <a class="reference internal" href="#c.PSA_KEY_USAGE_SIGN_MESSAGE" title="PSA_KEY_USAGE_SIGN_MESSAGE"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_KEY_USAGE_SIGN_MESSAGE</span></code></a>, and the flag <a class="reference internal" href="#c.PSA_KEY_USAGE_SIGN_MESSAGE" title="PSA_KEY_USAGE_SIGN_MESSAGE"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_KEY_USAGE_SIGN_MESSAGE</span></code></a> will also be present when the application queries the usage policy of the key.</p> |
| 150 | <p>For a key pair, this concerns the private key.</p> |
| 151 | </div> |
| 152 | <div class="section" id="PSA_KEY_USAGE_VERIFY_HASH"> |
| 153 | <span id="c.PSA_KEY_USAGE_VERIFY_HASH"></span><h3><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_VERIFY_HASH</span></code> (macro)</h3> |
| 154 | <p>Permission to verify a message hash with the key.</p> |
| 155 | <pre class="literal-block"> |
| 156 | #define <a class="reference internal" href="#c.PSA_KEY_USAGE_VERIFY_HASH" title="PSA_KEY_USAGE_VERIFY_HASH">PSA_KEY_USAGE_VERIFY_HASH</a> ((<a class="reference internal" href="attributes.html#c.psa_key_usage_t" title="psa_key_usage_t">psa_key_usage_t</a>)0x00002000) |
| 157 | </pre> |
| 158 | <p>This flag allows the key to be used to verify a message hash as part of an asymmetric signature verification operation, if otherwise permitted by the key’s type and policy. The flag must be present on keys used when calling <a class="reference internal" href="../ops/sign.html#c.psa_verify_hash" title="psa_verify_hash"><code class="xref any c c-func docutils literal"><span class="pre">psa_verify_hash()</span></code></a>.</p> |
| 159 | <p>This flag automatically sets <a class="reference internal" href="#c.PSA_KEY_USAGE_VERIFY_MESSAGE" title="PSA_KEY_USAGE_VERIFY_MESSAGE"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_KEY_USAGE_VERIFY_MESSAGE</span></code></a>: if an application sets the flag <a class="reference internal" href="#c.PSA_KEY_USAGE_VERIFY_HASH" title="PSA_KEY_USAGE_VERIFY_HASH"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_KEY_USAGE_VERIFY_HASH</span></code></a> when creating a key, then the key always has the permissions conveyed by <a class="reference internal" href="#c.PSA_KEY_USAGE_VERIFY_MESSAGE" title="PSA_KEY_USAGE_VERIFY_MESSAGE"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_KEY_USAGE_VERIFY_MESSAGE</span></code></a>, and the flag <a class="reference internal" href="#c.PSA_KEY_USAGE_VERIFY_MESSAGE" title="PSA_KEY_USAGE_VERIFY_MESSAGE"><code class="xref any c c-macro docutils literal"><span class="pre">PSA_KEY_USAGE_VERIFY_MESSAGE</span></code></a> will also be present when the application queries the usage policy of the key.</p> |
| 160 | <p>For a key pair, this concerns the public key.</p> |
| 161 | </div> |
| 162 | <div class="section" id="PSA_KEY_USAGE_DERIVE"> |
| 163 | <span id="c.PSA_KEY_USAGE_DERIVE"></span><h3><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_DERIVE</span></code> (macro)</h3> |
| 164 | <p>Permission to derive other keys from this key.</p> |
| 165 | <pre class="literal-block"> |
| 166 | #define <a class="reference internal" href="#c.PSA_KEY_USAGE_DERIVE" title="PSA_KEY_USAGE_DERIVE">PSA_KEY_USAGE_DERIVE</a> ((<a class="reference internal" href="attributes.html#c.psa_key_usage_t" title="psa_key_usage_t">psa_key_usage_t</a>)0x00004000) |
| 167 | </pre> |
| 168 | <p>This flag allows the key to be used for a key derivation operation or for a key agreement operation, if otherwise permitted by by the key’s type and policy. The flag must be present on keys used with the following APIs:</p> |
| 169 | <ul class="simple"> |
| 170 | <li><a class="reference internal" href="../ops/kdf.html#c.psa_key_derivation_input_key" title="psa_key_derivation_input_key"><code class="xref any c c-func docutils literal"><span class="pre">psa_key_derivation_input_key()</span></code></a></li> |
| 171 | <li><a class="reference internal" href="../ops/ka.html#c.psa_key_derivation_key_agreement" title="psa_key_derivation_key_agreement"><code class="xref any c c-func docutils literal"><span class="pre">psa_key_derivation_key_agreement()</span></code></a></li> |
| 172 | <li><a class="reference internal" href="../ops/ka.html#c.psa_raw_key_agreement" title="psa_raw_key_agreement"><code class="xref any c c-func docutils literal"><span class="pre">psa_raw_key_agreement()</span></code></a></li> |
| 173 | </ul> |
| 174 | </div> |
| 175 | </div> |
| 176 | <div class="section" id="attribute-accessors"> |
| 177 | <h2>Attribute accessors</h2> |
| 178 | <div class="section" id="psa_set_key_usage_flags"> |
| 179 | <span id="c.psa_set_key_usage_flags"></span><h3><code class="docutils literal"><span class="pre">psa_set_key_usage_flags</span></code> (function)</h3> |
| 180 | <p>Declare usage flags for a key.</p> |
| 181 | <pre class="literal-block"> |
| 182 | void <a class="reference internal" href="#c.psa_set_key_usage_flags" title="psa_set_key_usage_flags">psa_set_key_usage_flags</a>(<a class="reference internal" href="attributes.html#c.psa_key_attributes_t" title="psa_key_attributes_t">psa_key_attributes_t</a> * attributes, |
| 183 | <a class="reference internal" href="attributes.html#c.psa_key_usage_t" title="psa_key_usage_t">psa_key_usage_t</a> usage_flags); |
| 184 | </pre> |
| 185 | <p class="rubric">Parameters</p> |
| 186 | <dl class="docutils"> |
| 187 | <dt> <code class="docutils literal"><span class="pre">attributes</span></code></dt> |
| 188 | <dd>The attribute object to write to.</dd> |
| 189 | <dt> <code class="docutils literal"><span class="pre">usage_flags</span></code></dt> |
| 190 | <dd>The usage flags to write.</dd> |
| 191 | </dl> |
| 192 | <p class="rubric">Returns: <code class="docutils literal"><span class="pre">void</span></code></p> |
| 193 | <p class="rubric">Description</p> |
| 194 | <p>Usage flags are part of a key’s usage policy. They encode what kind of operations are permitted on the key. For more details, refer to the documentation of the type <a class="reference internal" href="attributes.html#c.psa_key_usage_t" title="psa_key_usage_t"><code class="xref any c c-type docutils literal"><span class="pre">psa_key_usage_t</span></code></a>.</p> |
| 195 | <p>This function overwrites any usage flags previously set in <code class="docutils literal"><span class="pre">attributes</span></code>.</p> |
| 196 | <div class="admonition-implementation-note admonition"> |
| 197 | <p class="first admonition-title">Implementation note</p> |
| 198 | <p>This is a simple accessor function that is not required to validate its inputs. The following approaches can be used to provide an efficient implementation:</p> |
| 199 | <ul class="last simple"> |
| 200 | <li>This function can be declared as <code class="docutils literal"><span class="pre">static</span></code> or <code class="docutils literal"><span class="pre">inline</span></code>, instead of using the default external linkage.</li> |
| 201 | <li>This function can be provided as a function-like macro. In this form, the macro must evaluate each of its arguments exactly once, as if it was a function call.</li> |
| 202 | </ul> |
| 203 | </div> |
| 204 | </div> |
| 205 | <div class="section" id="psa_get_key_usage_flags"> |
| 206 | <span id="c.psa_get_key_usage_flags"></span><h3><code class="docutils literal"><span class="pre">psa_get_key_usage_flags</span></code> (function)</h3> |
| 207 | <p>Retrieve the usage flags from key attributes.</p> |
| 208 | <pre class="literal-block"> |
| 209 | <a class="reference internal" href="attributes.html#c.psa_key_usage_t" title="psa_key_usage_t">psa_key_usage_t</a> <a class="reference internal" href="#c.psa_get_key_usage_flags" title="psa_get_key_usage_flags">psa_get_key_usage_flags</a>(const <a class="reference internal" href="attributes.html#c.psa_key_attributes_t" title="psa_key_attributes_t">psa_key_attributes_t</a> * attributes); |
| 210 | </pre> |
| 211 | <p class="rubric">Parameters</p> |
| 212 | <dl class="docutils"> |
| 213 | <dt> <code class="docutils literal"><span class="pre">attributes</span></code></dt> |
| 214 | <dd>The key attribute object to query.</dd> |
| 215 | </dl> |
| 216 | <p class="rubric">Returns: <a class="reference internal" href="attributes.html#c.psa_key_usage_t" title="psa_key_usage_t"><code class="docutils literal"><span class="pre">psa_key_usage_t</span></code></a></p> |
| 217 | <p>The usage flags stored in the attribute object.</p> |
| 218 | <p class="rubric">Description</p> |
| 219 | <div class="admonition-implementation-note admonition"> |
| 220 | <p class="first admonition-title">Implementation note</p> |
| 221 | <p>This is a simple accessor function that is not required to validate its inputs. The following approaches can be used to provide an efficient implementation:</p> |
| 222 | <ul class="last simple"> |
| 223 | <li>This function can be declared as <code class="docutils literal"><span class="pre">static</span></code> or <code class="docutils literal"><span class="pre">inline</span></code>, instead of using the default external linkage.</li> |
| 224 | <li>This function can be provided as a function-like macro. In this form, the macro must evaluate each of its arguments exactly once, as if it was a function call.</li> |
| 225 | </ul> |
| 226 | </div> |
| 227 | </div> |
| 228 | </div> |
| 229 | </div> |
| 230 | |
| 231 | |
| 232 | </div> |
| 233 | </div> |
| 234 | </div> |
| 235 | <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> |
| 236 | <div class="sphinxsidebarwrapper"> |
| 237 | <h3><a href="../../index.html">Table Of Contents</a></h3> |
| 238 | <ul> |
| 239 | <li><a class="reference internal" href="#">Key policies</a><ul> |
| 240 | <li><a class="reference internal" href="#key-usage-flags">Key usage flags</a><ul> |
| 241 | <li><a class="reference internal" href="#PSA_KEY_USAGE_EXPORT"><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_EXPORT</span></code> (macro)</a></li> |
| 242 | <li><a class="reference internal" href="#PSA_KEY_USAGE_COPY"><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_COPY</span></code> (macro)</a></li> |
| 243 | <li><a class="reference internal" href="#PSA_KEY_USAGE_CACHE"><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_CACHE</span></code> (macro)</a></li> |
| 244 | <li><a class="reference internal" href="#PSA_KEY_USAGE_ENCRYPT"><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_ENCRYPT</span></code> (macro)</a></li> |
| 245 | <li><a class="reference internal" href="#PSA_KEY_USAGE_DECRYPT"><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_DECRYPT</span></code> (macro)</a></li> |
| 246 | <li><a class="reference internal" href="#PSA_KEY_USAGE_SIGN_MESSAGE"><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_SIGN_MESSAGE</span></code> (macro)</a></li> |
| 247 | <li><a class="reference internal" href="#PSA_KEY_USAGE_VERIFY_MESSAGE"><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_VERIFY_MESSAGE</span></code> (macro)</a></li> |
| 248 | <li><a class="reference internal" href="#PSA_KEY_USAGE_SIGN_HASH"><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_SIGN_HASH</span></code> (macro)</a></li> |
| 249 | <li><a class="reference internal" href="#PSA_KEY_USAGE_VERIFY_HASH"><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_VERIFY_HASH</span></code> (macro)</a></li> |
| 250 | <li><a class="reference internal" href="#PSA_KEY_USAGE_DERIVE"><code class="docutils literal"><span class="pre">PSA_KEY_USAGE_DERIVE</span></code> (macro)</a></li> |
| 251 | </ul> |
| 252 | </li> |
| 253 | <li><a class="reference internal" href="#attribute-accessors">Attribute accessors</a><ul> |
| 254 | <li><a class="reference internal" href="#psa_set_key_usage_flags"><code class="docutils literal"><span class="pre">psa_set_key_usage_flags</span></code> (function)</a></li> |
| 255 | <li><a class="reference internal" href="#psa_get_key_usage_flags"><code class="docutils literal"><span class="pre">psa_get_key_usage_flags</span></code> (function)</a></li> |
| 256 | </ul> |
| 257 | </li> |
| 258 | </ul> |
| 259 | </li> |
| 260 | </ul> |
| 261 | <div class="relations"> |
| 262 | <h3>Related Topics</h3> |
| 263 | <ul> |
| 264 | <li><a href="../../index.html">Documentation overview</a><ul> |
| 265 | <li><a href="index.html">Key management reference</a><ul> |
| 266 | <li>Previous: <a href="types.html" title="previous chapter">Key types</a></li> |
| 267 | <li>Next: <a href="algorithms.html" title="next chapter">Algorithms</a></li> |
| 268 | </ul></li> |
| 269 | </ul></li> |
| 270 | </ul> |
| 271 | </div> |
| 272 | <div role="note" aria-label="source link"> |
| 273 | <h3>This Page</h3> |
| 274 | <ul class="this-page-menu"> |
| 275 | <li><a href="../../_sources/api/keys/usage.rst.txt" |
| 276 | rel="nofollow">Show Source</a></li> |
| 277 | </ul> |
| 278 | </div> |
| 279 | <div id="searchbox" style="display: none" role="search"> |
| 280 | <h3>Quick search</h3> |
| 281 | <form class="search" action="../../search.html" method="get"> |
| 282 | <div><input type="text" name="q" /></div> |
| 283 | <div><input type="submit" value="Go" /></div> |
| 284 | <input type="hidden" name="check_keywords" value="yes" /> |
| 285 | <input type="hidden" name="area" value="default" /> |
| 286 | </form> |
| 287 | </div> |
| 288 | <script type="text/javascript">$('#searchbox').show(0);</script> |
| 289 | </div> |
| 290 | </div> |
| 291 | <div class="clearer"></div> |
| 292 | </div> |
| 293 | <div class="footer"> |
| 294 | © 2019-2020, Arm Limited or its affiliates. All rights reserved. |
| 295 | |
| 296 | | |
| 297 | Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.7</a> |
| 298 | & <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a> |
| 299 | |
| 300 | | |
| 301 | <a href="../../_sources/api/keys/usage.rst.txt" |
| 302 | rel="nofollow">Page source</a> |
| 303 | </div> |
| 304 | |
| 305 | |
| 306 | |
| 307 | |
| 308 | </body> |
| 309 | </html> |