Skill

Manage Azure Key Vault Keys with Rust SDK

Rust client for Azure Key Vault Keys - create, back up, and use RSA/EC/HSM cryptographic keys without exposing private key material.

Works with azure

73
Spark score
out of 100
Updated last month
Version 13.1.0

Add to Favorites

Why it matters

Securely manage cryptographic keys in Azure Key Vault using a Rust client library. Automate key creation, retrieval, deletion, backup, and restore operations within your Rust applications.

Outcomes

What it gets done

01

Create and manage RSA and EC keys in Azure Key Vault.

02

Perform cryptographic operations like signing and encryption using managed keys.

03

Integrate Azure Key Vault key management into Rust applications.

04

Securely back up and restore keys for disaster recovery.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-azure-keyvault-keys-rust | bash

Overview

Azure Key Vault Keys SDK for Rust

A Rust client library for Azure Key Vault's key management API, covering RSA/EC/HSM key creation, retrieval, backup/restore, and server-side crypto operations. Use when a Rust app needs centrally-managed cryptographic keys for encryption, signing, or key wrapping without handling raw private key material.

What it does

The azure_security_keyvault_keys Rust crate is the client library for Azure Key Vault's key storage and management, covering RSA (2048/3072/4096-bit), elliptic curve (P-256, P-384, P-521), and hardware-protected RSA-HSM/EC-HSM keys. A KeyClient, authenticated via DeveloperToolsCredential (or ManagedIdentityCredential in production) against a vault URL, exposes get_key, create_key (with CreateKeyParameters specifying kty/key_size for RSA or kty/curve for EC), delete_key, a paged list_key_properties stream, and backup_key/restore_key for disaster recovery - backup_key returns opaque bytes meant to be stored safely and fed back into restore_key later.

When to use - and when NOT to

Use this skill when a Rust application needs centrally-managed cryptographic keys - for encryption, signing, or key wrapping - without ever handling raw private key material in application code, since Key Vault performs the actual crypto operations (encrypt/decrypt, sign/verify, wrapKey/unwrapKey) server-side depending on key type and the caller's assigned permissions. It is the keys API specifically; secrets and certificates are separate Key Vault APIs not covered here.

Inputs and outputs

Inputs are a vault URL (AZURE_KEYVAULT_URL) and, per operation, a key name plus type-specific parameters - KeyType::Rsa with a key_size, or KeyType::Ec with a CurveName like P256. Outputs are key model objects exposing the key's ID (kid) and metadata; list_key_properties returns an async pager whose items expose a resource_id() with the key's name, and backup_key returns raw backup bytes rather than a key object.

cargo add azure_security_keyvault_keys azure_identity

Integrations

Built on azure_identity for Entra ID authentication and futures' TryStreamExt for paging through list_key_properties. Access is governed by Key Vault RBAC roles: Key Vault Crypto User for using keys in crypto operations, and Key Vault Crypto Officer for full CRUD on key objects themselves.

Who it's for

Rust developers building applications that need centrally-managed, auditable cryptographic keys - encrypting sensitive data, signing tokens or documents, or wrapping other keys - rather than embedding key material directly. The skill's own best practices recommend EC keys for signing (more efficient than RSA), RSA for encryption, HSM-backed keys for the most sensitive workloads, regular backups for disaster recovery, enabling soft delete (required for production vaults), and periodic key rotation by creating new key versions rather than reusing one indefinitely. Because the vault performs cryptographic operations itself, the same key can back both a signing workflow and an encryption workflow across multiple services without any of them ever needing direct access to the underlying key bytes, which keeps the blast radius of a compromised service limited to what that service's RBAC role permits.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.