New to Claude Skills? Learn how to install them →

sickn33 on GitHub

Azure Key Vault Keys SDK for Rust

Free

Manage cryptographic keys securely with Rust.

Get this skill

Free · Opens the source repo

What Azure Key Vault Keys SDK for Rust does

The Azure Key Vault Keys SDK for Rust provides a robust client library for securely managing cryptographic keys within Azure Key Vault. This SDK allows developers to create, retrieve, delete, and list keys, as well as perform cryptographic operations without exposing the private keys. It supports various key types, including RSA and EC, with options for hardware security module (HSM) protection, making it suitable for sensitive workloads.

Installation is straightforward via Cargo, with the required libraries being azure_security_keyvault_keys and azure_identity. Authentication is facilitated through Azure's identity management, allowing developers to use either DeveloperToolsCredential for development or ManagedIdentityCredential for production environments. This flexibility ensures that the SDK can be integrated into a variety of Rust applications that require secure key management.

The SDK supports core operations such as creating keys of different types, backing up keys, and restoring them when necessary. Additionally, it allows for cryptographic operations like encryption, signing, and key wrapping, enhancing its utility in applications that require secure data handling. Best practices are included to guide users in utilizing HSM keys for sensitive data and implementing key rotation and soft delete features for enhanced security.

This skill is ideal for Rust developers working on applications that require secure key management and cryptographic operations, particularly in cloud environments leveraging Azure services.

When to use it

Use this SDK when developing Rust applications that need to create, manage, or utilize cryptographic keys securely.

When not to use it

Avoid this SDK if your application does not require cryptographic key management or if you are not using Azure Key Vault.

What you can build with it

Creating a New Key

Use the SDK to create a new RSA or EC key for your application, specifying the key type and size as needed.

Performing Cryptographic Operations

Leverage the SDK to encrypt data or sign messages using the keys stored in Azure Key Vault.

Backing Up Keys for Disaster Recovery

Utilize the backup and restore functionalities to ensure that your cryptographic keys are safe and can be recovered if needed.

How to install Azure Key Vault Keys SDK for Rust

View source

1. Install with the skills CLI

npx skills add sickn33/agentic-awesome-skills/azure-keyvault-keys-rust --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by sickn33

Azure Key Vault Keys SDK for Rust

Client library for Azure Key Vault Keys — secure storage and management of cryptographic keys.

Installation

cargo add azure_security_keyvault_keys azure_identity

Environment Variables

AZURE_KEYVAULT_URL=https://<vault-name>.vault.azure.net/

Authentication

use azure_identity::DeveloperToolsCredential;
use azure_security_keyvault_keys::KeyClient;

let credential = DeveloperToolsCredential::new(None)?;
let client = KeyClient::new(
    "https://<vault-name>.vault.azure.net/",
    credential.clone(),
    None,
)?;

Key Types

TypeDescription
RSARSA keys (2048, 3072, 4096 bits)
ECElliptic curve keys (P-256, P-384, P-521)
RSA-HSMHSM-protected RSA keys
EC-HSMHSM-protected EC keys

Core Operations

Get Key

let key = client
    .get_key("key-name", None)
    .await?
    .into_model()?;

println!("Key ID: {:?}", key.key.as_ref().map(|k| &k.kid));

Create Key

use azure_security_keyvault_keys::models::{CreateKeyParameters, KeyType};

let params = CreateKeyParameters {
    kty: KeyType::Rsa,
    key_size: Some(2048),
    ..Default::default()
};

let key = client
    .create_key("key-name", params.try_into()?, None)
    .await?
    .into_model()?;

Create EC Key

use azure_security_keyvault_keys::models::{CreateKeyParameters, KeyType, CurveName};

let params = CreateKeyParameters {
    kty: KeyType::Ec,
    curve: Some(CurveName::P256),
    ..Default::default()
};

let key = client
    .create_key("ec-key", params.try_into()?, None)
    .await?
    .into_model()?;

Delete Key

client.delete_key("key-name", None).await?;

List Keys

use azure_security_keyvault_keys::ResourceExt;
use futures::TryStreamExt;

let mut pager = client.list_key_properties(None)?.into_stream();
while let Some(key) = pager.try_next().await? {
    let name = key.resource_id()?.name;
    println!("Key: {}", name);
}

Backup Key

let backup = client.backup_key("key-name", None).await?;
// Store backup.value safely

Restore Key

use azure_security_keyvault_keys::models::RestoreKeyParameters;

let params = RestoreKeyParameters {
    key_bundle_backup: backup_bytes,
};

client.restore_key(params.try_into()?, None).await?;

Cryptographic Operations

Key Vault can perform crypto operations without exposing the private key:

// For cryptographic operations, use the key's operations
// Available operations depend on key type and permissions:
// - encrypt/decrypt (RSA)
// - sign/verify (RSA, EC)
// - wrapKey/unwrapKey (RSA)

Best Practices

  1. Use Entra ID authDeveloperToolsCredential for dev, ManagedIdentityCredential for production
  2. Use HSM keys for sensitive workloads — hardware-protected keys
  3. Use EC for signing — more efficient than RSA
  4. Use RSA for encryption — when encrypting data
  5. Backup keys — for disaster recovery
  6. Enable soft delete — required for production vaults
  7. Use key rotation — create new versions periodically

RBAC Permissions

Assign these Key Vault roles:

  • Key Vault Crypto User — use keys for crypto operations
  • Key Vault Crypto Officer — full CRUD on keys

Reference Links

ResourceLink
API Referencehttps://docs.rs/azure_security_keyvault_keys
Source Codehttps://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/keyvault/azure_security_keyvault_keys
crates.iohttps://crates.io/crates/azure_security_keyvault_keys

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

Frequently asked questions about Azure Key Vault Keys SDK for Rust

Similar skills