Function psa_crypto::operations::key_management::copy[][src]

pub fn copy(
    key_id_to_copy: Id,
    attributes: Attributes,
    id: Option<u32>
) -> Result<Id>
Expand description

Copy key material from one location to another The function returns the key ID of the newly created key Id can be set to None when creating a volatile key. When generating a persistent key with a specific ID, the Id structure can be created after reset with the from_persistent_key_id constructor on Id.

The originating key must have the usage flag copy set.

Example

use psa_crypto::operations::key_management;
use psa_crypto::types::key::{Attributes, Type, Lifetime, Policy, UsageFlags};
use psa_crypto::types::algorithm::{AsymmetricSignature, Hash, Algorithm};
psa_crypto::init().unwrap();
let my_key = key_management::import(attributes, None, &key_data).unwrap();
let my_key_copy = key_management::copy(my_key, attributes, None).unwrap();