Lines Matching refs:a
5 Mbed Crypto is an open source cryptographic library that supports a wide range of cryptographic ope…
14 The Mbed Crypto library is a reference implementation of the cryptography interface of the Arm Plat…
20 Arm's Platform Security Architecture (PSA) is a holistic set of threat models,
21 …a recipe, based on industry best practice, that enables you to design security into both hardware …
28 * [Importing a key](#importing-a-key)
29 * [Signing a message using RSA](#signing-a-message-using-RSA)
31 * [Hashing a message](#hashing-a-message)
32 * [Deriving a new key from an existing key](#deriving-a-new-key-from-an-existing-key)
33 * [Generating a random value](#generating-a-random-value)
34 * [Authenticating and encrypting or decrypting a message](#authenticating-and-encrypting-or-decrypt…
50 If you have a C compiler such as GCC or Clang, just run `make` in the top-level directory to build …
52 To select a different compiler, set the `CC` variable to the name or path of the compiler and linke…
56 …ided makefiles pass options to the compiler that assume a GCC-like command line syntax. To use a d…
64 ### Importing a key
66 To use a key for cryptography operations in Mbed Crypto, you need to first
71 * Initialize the library with a successful call to `psa_crypto_init()`.
73 This example shows how to import a key:
103 printf("Imported a key\n");
115 ### Signing a message using RSA
120 * Initialize the library with a successful call to `psa_crypto_init()`.
121 * Have a valid key with appropriate attributes set:
126 This example shows how to sign a hash that has already been calculated:
140 printf("Sign a message...\t");
173 printf("Signed a message\n");
190 * Initialize the library with a successful call to `psa_crypto_init()`.
191 * Have a symmetric key. This key's usage flags must include `PSA_KEY_USAGE_ENCRYPT` to allow encryp…
193 **To encrypt a message with a symmetric cipher:**
197 …ctor (IV). We recommend calling `psa_cipher_generate_iv()`, unless you require a specific IV value.
230 /* Import a key */
237 printf("Failed to import a key\n");
277 **To decrypt a message with a symmetric cipher:**
314 /* Import a key */
321 printf("Failed to import a key\n");
363 After you've initialized the operation structure with a successful call to `psa_cipher_encrypt_setu…
371 …for the same operation. You can, however, reuse the operation structure for a different operation …
373 …ort()` at some point for any operation that is initialized successfully (by a successful call to `…
377 ### Hashing a message
383 * Initialize the library with a successful call to `psa_crypto_init()`.
385 **To calculate a hash:**
392 This example shows how to calculate the SHA-256 hash of a message:
397 unsigned char input[] = { 'a', 'b', 'c' };
401 printf("Hash a message...\t");
429 printf("Hashed a message\n");
437 This example shows how to verify the SHA-256 hash of a message:
442 unsigned char input[] = { 'a', 'b', 'c' };
450 printf("Verify a hash...\t");
477 printf("Verified a hash\n");
489 After a successful call to `psa_hash_setup()`, you can terminate the operation at any time by calli…
496 …for the same operation. You can, however, reuse the operation structure for a different operation …
498 …ort()` at some point for any operation that is initialized successfully (by a successful call to `…
502 ### Generating a random value
507 * Initialize the library with a successful call to `psa_crypto_init()`.
509 <span class="notes">**Note:** To generate a random key, use `psa_generate_key()` instead of `psa_ge…
528 printf("Failed to generate a random value\n");
538 ### Deriving a new key from an existing key
540 Mbed Crypto provides a key derivation API that lets you derive new keys from
545 You must first initialize and set up a key derivation context,
546 …th a key and, optionally, other data. Then, use the key derivation context to either read derived …
552 * Initialize the library with a successful call to `psa_crypto_init()`.
553 * Use a key with the appropriate attributes set:
556 * Algorithm set to a key derivation algorithm
559 **To derive a new AES-CTR 128-bit encryption key into a given key slot using HKDF
560 with a given key, salt and info:**
566 1. Provide a secret with `psa_key_derivation_input_key()`, referencing a key that
574 At this point, the derived key slot holds a new 128-bit AES-CTR encryption key
598 printf("Derive a key (HKDF)...\t");
608 /* Import a key for use in key derivation. If such a key has already been
615 printf("Failed to import a key\n");
620 /* Derive a key */
676 ### Authenticating and encrypting or decrypting a message
678 Mbed Crypto provides a simple way to authenticate and encrypt with associated data (AEAD), supporti…
681 * Initialize the library with a successful call to `psa_crypto_init()`.
684 This example shows how to authenticate and encrypt a message:
724 /* Import a key */
755 This example shows how to authenticate and decrypt a message:
795 /* Import a key */
802 printf("Failed to import a key\n");
832 Mbed Crypto provides a simple way to generate a key or key pair.
835 * Initialize the library with a successful call to `psa_crypto_init()`.
841 1. Generate a key by calling `psa_generate_key()`.
853 printf("Generate a key pair...\t");
863 /* Generate a key */
884 printf("Exported a public key\n");