Langsung ke konten
Skillpedia
Keamanan48k Β· #3983

azure-security-keyvault-keys-dotnet

Fungsinya

Alat ini memungkinkan Anda mengelola kunci kriptografi di Azure secara aman. Anda bisa membuat, melindungi, menggunakan, dan menghapus kunci untuk mengenkripsi dan mendekripsi data, serta menandatangani dan memverifikasi informasi.

Kapan dipakai

  • βœ“Saat Anda perlu membuat kunci enkripsi baru untuk melindungi data.
  • βœ“Saat Anda ingin memakai kunci yang sudah ada untuk mengenkripsi atau mendekripsi informasi.
  • βœ“Saat Anda perlu menandatangani data secara digital untuk memastikan keasliannya.

Link skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-security-keyvault-keys-dotnet/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/azure-security-keyvault-keys-dotnet/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBuatkan kunci RSA bernama 'my-secure-key' dan jelaskan cara memakainya untuk mengenkripsi sebuah teks.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Di balik layar, alat ini terhubung ke Azure Key Vault, layanan aman untuk menyimpan secret. Alat ini memakai perintah khusus untuk meminta Azure melakukan operasi kunci yang diminta, misalnya membuat atau memakai kunci untuk enkripsi.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Azure.Security.KeyVault.Keys (.NET)

Client library for managing cryptographic keys in Azure Key Vault and Managed HSM.

Installation

dotnet add package Azure.Security.KeyVault.Keys
dotnet add package Azure.Identity

Current Version: 4.7.0 (stable)

Environment Variables

KEY_VAULT_NAME=<your-key-vault-name>
# Or full URI
AZURE_KEYVAULT_URL=https://<vault-name>.vault.azure.net

Client Hierarchy

KeyClient (key management)
β”œβ”€β”€ CreateKey / CreateRsaKey / CreateEcKey
β”œβ”€β”€ GetKey / GetKeys
β”œβ”€β”€ UpdateKeyProperties
β”œβ”€β”€ DeleteKey / PurgeDeletedKey
β”œβ”€β”€ BackupKey / RestoreKey
└── GetCryptographyClient() β†’ CryptographyClient

CryptographyClient (cryptographic operations)
β”œβ”€β”€ Encrypt / Decrypt
β”œβ”€β”€ WrapKey / UnwrapKey
β”œβ”€β”€ Sign / Verify
└── SignData / VerifyData

KeyResolver (key resolution)
└── Resolve(keyId) β†’ CryptographyClient

Authentication

DefaultAzureCredential (Recommended)

using Azure.Identity;
using Azure.Security.KeyVault.Keys;

var keyVaultName = Environment.GetEnvironmentVariable("KEY_VAULT_NAME");
var kvUri = $"https://{keyVaultName}.vault.azure.net";

var client = new KeyClient(new Uri(kvUri), new DefaultAzureCredential());

Service Principal

var credential = new ClientSecretCredential(
    tenantId: "<tenant-id>",
    clientId: "<client-id>",
    clientSecret: "<client-secret>");

var client = new KeyClient(new Uri(kvUri), credential);

Key Management

Create Keys

// Create RSA key
KeyVaultKey rsaKey = await client.CreateKeyAsync("my-rsa-key", KeyType.Rsa);
Console.WriteLine($"Created key: {rsaKey.Name}, Type: {rsaKey.KeyType}");

// Create RSA key with options
var rsaOptions = new CreateRsaKeyOptions("my-rsa-key-2048")
{
    KeySize = 2048,
    HardwareProtected = false, // true for HSM-backed
    ExpiresOn = DateTimeOffset.UtcNow.AddYears(1),
    NotBefore = DateTimeOffset.UtcNow,
    Enabled = true
};
rsaOptions.KeyOperations.Add(KeyOperation.Encrypt);
rsaOptions.KeyOperations.Add(KeyOperation.Decrypt);

KeyVaultKey rsaKey2 = await client.CreateRsaKeyAsync(rsaOptions);

// Create EC key
var ecOptions = new CreateEcKeyOptions("my-ec-key")
{
    CurveName = KeyCurveName.P256,
    HardwareProtected = true // HSM-backed
};
KeyVaultKey ecKey = await client.CreateEcKeyAsync(ecOptions);

// Create Oct (symmetric) key for wrap/unwrap
var octOptions = new CreateOctKeyOptions("my-oct-key")
{
    KeySize = 256,
    HardwareProtected = true
};
KeyVaultKey octKey = await client.CreateOctKeyAsync(octOptions);

Retrieve Keys

// Get specific key (latest version)
KeyVaultKey key = await client.GetKeyAsync("my-rsa-key");
Console.WriteLine($"Key ID: {key.Id}");
Console.WriteLine($"Key Type: {key.KeyType}");
Console.WriteLine($"Version: {key.Properties.Version}");

// Get specific version
KeyVaultKey keyVersion = await client.GetKeyAsync("my-rsa-key", "version-id");

// List all keys
await foreach (KeyProperties keyProps in client.GetPropertiesOfKeysAsync())
{
    Console.WriteLine($"Key: {keyProps.Name}, Enabled: {keyProps.Enabled}");
}

// List key versions
await foreach (KeyProperties version in client.GetPropertiesOfKeyVersionsAsync("my-rsa-key"))
{
    Console.WriteLine($"Version: {version.Version}, Created: {version.CreatedOn}");
}

Update Key Properties

KeyVaultKey key = await client.GetKeyAsync("my-rsa-key");

key.Properties.ExpiresOn = DateTimeOffset.UtcNow.AddYears(2);
key.Properties.Tags["environment"] = "production";

KeyVaultKey updatedKey = await client.UpdateKeyPropertiesAsync(key.Properties);

Delete and Purge Keys

// Start delete operation
DeleteKeyOperation operation = await client.StartDeleteKeyAsync("my-rsa-key");

// Wait for deletion to complete (required before purge)
await operation.WaitForCompletionAsync();
Console.WriteLine($"Deleted key scheduled purge date: {operation.Value.ScheduledPurgeDate}");

// Purge immediately (if soft-delete is enabled)
await client.PurgeDeletedKeyAsync("my-rsa-key");

// Or recover deleted key
KeyVaultKey recoveredKey = await client.StartRecoverDeletedKeyAsync("my-rsa-key");

Backup and Restore

// Backup key
byte[] backup = await client.BackupKeyAsync("my-rsa-key");
await File.WriteAllBytesAsync("key-backup.bin", backup);

// Restore key
byte[] backupData = await File.ReadAllBytesAsync("key-backup.bin");
KeyVaultKey restoredKey = await client.RestoreKeyBackupAsync(backupData);

…

Pertanyaan umum

Apa itu Azure Key Vault?

Azure Key Vault adalah layanan cloud yang aman dari Microsoft untuk menyimpan dan mengelola kunci kriptografi, kata sandi, dan sertifikat.

Apa itu kunci kriptografi?

Kunci kriptografi adalah seperti kata sandi rahasia yang dipakai untuk mengenkode (mengenkripsi) dan membuka kode (mendekripsi) informasi, sehingga hanya pihak yang berwenang yang bisa mengaksesnya.

Apa perbedaan antara KeyClient dan CryptographyClient?

KeyClient dipakai untuk mengelola kunci (membuat, menghapus, dan lainnya), sedangkan CryptographyClient dipakai untuk menggunakan kunci dalam operasi seperti mengenkripsi, mendekripsi, atau menandatangani data.

Detail

Deskripsi asli dari pembuat

Azure Key Vault Keys SDK for .NET. Client library for managing cryptographic keys in Azure Key Vault and Managed HSM. Use for key creation, rotation, encryption, decryption, signing, and verification.

repo: sickn33/agentic-awesome-skills

Popularitas

Bintang GitHub
48k
Peringkat
#3983
Lisensi
MIT
Diperbarui
15/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa