[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BZ1RTAA49THWNQXK1HBEH2":3,"skill-same:01M7BZ1RTAA49THWNQXK1HBEH2":50},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":32,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M7BZ1RTAA49THWNQXK1HBEH2","azure-security-keyvault-keys-dotnet",null,"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.","YYC-Cube\u002FYYC3-Knowledge-Base","YYC-Cube","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F235006543?v=4","01M79J2PH4SWD2X0825X6PN748","yyc3","01M79J2PHVK3F6ZBYT8K2SCZCW",1,"MIT","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Skills-技能包\u002FYYC3-Skills-技能包-antigravity-awesome-skills\u002Fplugins\u002Fantigravity-awesome-skills-claude\u002Fskills\u002Fazure-security-keyvault-keys-dotnet\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: azure-security-keyvault-keys-dotnet\ndescription: 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.\nrisk: unknown\nsource: community\ndate_added: '2026-02-27'\n---\n\n# Azure.Security.KeyVault.Keys (.NET)\n\nClient library for managing cryptographic keys in Azure Key Vault and Managed HSM.\n\n## Installation\n\n```bash\ndotnet add package Azure.Security.KeyVault.Keys\ndotnet add package Azure.Identity\n```\n\n**Current Version**: 4.7.0 (stable)\n\n## Environment Variables\n\n```bash\nKEY_VAULT_NAME=\u003Cyour-key-vault-name>\n# Or full URI\nAZURE_KEYVAULT_URL=https:\u002F\u002F\u003Cvault-name>.vault.azure.net\n```\n\n## Client Hierarchy\n\n```\nKeyClient (key management)\n├── CreateKey \u002F CreateRsaKey \u002F CreateEcKey\n├── GetKey \u002F GetKeys\n├── UpdateKeyProperties\n├── DeleteKey \u002F PurgeDeletedKey\n├── BackupKey \u002F RestoreKey\n└── GetCryptographyClient() → CryptographyClient\n\nCryptographyClient (cryptographic operations)\n├── Encrypt \u002F Decrypt\n├── WrapKey \u002F UnwrapKey\n├── Sign \u002F Verify\n└── SignData \u002F VerifyData\n\nKeyResolver (key resolution)\n└── Resolve(keyId) → CryptographyClient\n```\n\n## Authentication\n\n### DefaultAzureCredential (Recommended)\n\n```csharp\nusing Azure.Identity;\nusing Azure.Security.KeyVault.Keys;\n\nvar keyVaultName = Environment.GetEnvironmentVariable(\"KEY_VAULT_NAME\");\nvar kvUri = $\"https:\u002F\u002F{keyVaultName}.vault.azure.net\";\n\nvar client = new KeyClient(new Uri(kvUri), new DefaultAzureCredential());\n```\n\n### Service Principal\n\n```csharp\nvar credential = new ClientSecretCredential(\n    tenantId: \"\u003Ctenant-id>\",\n    clientId: \"\u003Cclient-id>\",\n    clientSecret: \"\u003Cclient-secret>\");\n\nvar client = new KeyClient(new Uri(kvUri), credential);\n```\n\n## Key Management\n\n### Create Keys\n\n```csharp\n\u002F\u002F Create RSA key\nKeyVaultKey rsaKey = await client.CreateKeyAsync(\"my-rsa-key\", KeyType.Rsa);\nConsole.WriteLine($\"Created key: {rsaKey.Name}, Type: {rsaKey.KeyType}\");\n\n\u002F\u002F Create RSA key with options\nvar rsaOptions = new CreateRsaKeyOptions(\"my-rsa-key-2048\")\n{\n    KeySize = 2048,\n    HardwareProtected = false, \u002F\u002F true for HSM-backed\n    ExpiresOn = DateTimeOffset.UtcNow.AddYears(1),\n    NotBefore = DateTimeOffset.UtcNow,\n    Enabled = true\n};\nrsaOptions.KeyOperations.Add(KeyOperation.Encrypt);\nrsaOptions.KeyOperations.Add(KeyOperation.Decrypt);\n\nKeyVaultKey rsaKey2 = await client.CreateRsaKeyAsync(rsaOptions);\n\n\u002F\u002F Create EC key\nvar ecOptions = new CreateEcKeyOptions(\"my-ec-key\")\n{\n    CurveName = KeyCurveName.P256,\n    HardwareProtected = true \u002F\u002F HSM-backed\n};\nKeyVaultKey ecKey = await client.CreateEcKeyAsync(ecOptions);\n\n\u002F\u002F Create Oct (symmetric) key for wrap\u002Funwrap\nvar octOptions = new CreateOctKeyOptions(\"my-oct-key\")\n{\n    KeySize = 256,\n    HardwareProtected = true\n};\nKeyVaultKey octKey = await client.CreateOctKeyAsync(octOptions);\n```\n\n### Retrieve Keys\n\n```csharp\n\u002F\u002F Get specific key (latest version)\nKeyVaultKey key = await client.GetKeyAsync(\"my-rsa-key\");\nConsole.WriteLine($\"Key ID: {key.Id}\");\nConsole.WriteLine($\"Key Type: {key.KeyType}\");\nConsole.WriteLine($\"Version: {key.Properties.Version}\");\n\n\u002F\u002F Get specific version\nKeyVaultKey keyVersion = await client.GetKeyAsync(\"my-rsa-key\", \"version-id\");\n\n\u002F\u002F List all keys\nawait foreach (KeyProperties keyProps in client.GetPropertiesOfKeysAsync())\n{\n    Console.WriteLine($\"Key: {keyProps.Name}, Enabled: {keyProps.Enabled}\");\n}\n\n\u002F\u002F List key versions\nawait foreach (KeyProperties version in client.GetPropertiesOfKeyVersionsAsync(\"my-rsa-key\"))\n{\n    Console.WriteLine($\"Version: {version.Version}, Created: {version.CreatedOn}\");\n}\n```\n\n### Update Key Properties\n\n```csharp\nKeyVaultKey key = await client.GetKeyAsync(\"my-rsa-key\");\n\nkey.Properties.ExpiresOn = DateTimeOffset.UtcNow.AddYears(2);\nkey.Properties.Tags[\"environment\"] = \"production\";\n\nKeyVaultKey updatedKey = await client.UpdateKeyPropertiesAsync(key.Properties);\n```\n\n### Delete and Purge Keys\n\n```csharp\n\u002F\u002F Start delete operation\nDeleteKeyOperation operation = await client.StartDeleteKeyAsync(\"my-rsa-key\");\n\n\u002F\u002F Wait for deletion to complete (required before purge)\nawait operation.WaitForCompletionAsync();\nConsole.WriteLine($\"Deleted key scheduled purge date: {operation.Value.ScheduledPurgeDate}\");\n\n\u002F\u002F Purge immediately (if soft-delete is enabled)\nawait client.PurgeDeletedKeyAsync(\"my-rsa-key\");\n\n\u002F\u002F Or recover deleted key\nKeyVaultKey recoveredKey = await client.StartRecoverDeletedKeyAsync(\"my-rsa-key\");\n```\n\n### Backup and Restore\n\n```csharp\n\u002F\u002F Backup key\nbyte[] backup = await client.BackupKeyAsync(\"my-rsa-key\");\nawait File.WriteAllBytesAsync(\"key-backup.bin\", backup);\n\n\u002F\u002F Restore key\nbyte[] backupData = await File.ReadAllBytesAsync(\"key-backup.bin\");\nKeyVaultKey restoredKey = await client.RestoreKeyBackupAsync(backupData);\n```\n\n## Cryptographic Operations\n\n### Get CryptographyClient\n\n```csharp\n\u002F\u002F From KeyClient\nKeyVaultKey key = await client.GetKeyAsync(\"my-rsa-key\");\nCryptographyClient cryptoClient = client.GetCryptographyClient(\n    key.Name, \n    key.Properties.Version);\n\n\u002F\u002F Or create directly with key ID\nCryptographyClient cryptoClient = new CryptographyClient(\n    new Uri(\"https:\u002F\u002Fmyvault.vault.azure.net\u002Fkeys\u002Fmy-rsa-key\u002Fversion\"),\n    new DefaultAzureCredential());\n```\n\n### Encrypt and Decrypt\n\n```csharp\nbyte[] plaintext = Encoding.UTF8.GetBytes(\"Secret message to encrypt\");\n\n\u002F\u002F Encrypt\nEncryptResult encryptResult = await cryptoClient.EncryptAsync(\n    EncryptionAlgorithm.RsaOaep256, \n    plaintext);\nConsole.WriteLine($\"Encrypted: {Convert.ToBase64String(encryptResult.Ciphertext)}\");\n\n\u002F\u002F Decrypt\nDecryptResult decryptResult = await cryptoClient.DecryptAsync(\n    EncryptionAlgorithm.RsaOaep256, \n    encryptResult.Ciphertext);\nstring decrypted = Encoding.UTF8.GetString(decryptResult.Plaintext);\nConsole.WriteLine($\"Decrypted: {decrypted}\");\n```\n\n### Wrap and Unwrap Keys\n\n```csharp\n\u002F\u002F Key to wrap (e.g., AES key)\nbyte[] keyToWrap = new byte[32]; \u002F\u002F 256-bit key\nRandomNumberGenerator.Fill(keyToWrap);\n\n\u002F\u002F Wrap key\nWrapResult wrapResult = await cryptoClient.WrapKeyAsync(\n    KeyWrapAlgorithm.RsaOaep256, \n    keyToWrap);\n\n\u002F\u002F Unwrap key\nUnwrapResult unwrapResult = await cryptoClient.UnwrapKeyAsync(\n    KeyWrapAlgorithm.RsaOaep256, \n    wrapResult.EncryptedKey);\n```\n\n### Sign and Verify\n\n```csharp\n\u002F\u002F Data to sign\nbyte[] data = Encoding.UTF8.GetBytes(\"Data to sign\");\n\n\u002F\u002F Sign data (computes hash internally)\nSignResult signResult = await cryptoClient.SignDataAsync(\n    SignatureAlgorithm.RS256, \n    data);\n\n\u002F\u002F Verify signature\nVerifyResult verifyResult = await cryptoClient.VerifyDataAsync(\n    SignatureAlgorithm.RS256, \n    data, \n    signResult.Signature);\nConsole.WriteLine($\"Signature valid: {verifyResult.IsValid}\");\n\n\u002F\u002F Or sign pre-computed hash\nusing var sha256 = SHA256.Create();\nbyte[] hash = sha256.ComputeHash(data);\n\nSignResult signHashResult = await cryptoClient.SignAsync(\n    SignatureAlgorithm.RS256, \n    hash);\n```\n\n## Key Resolver\n\n```csharp\nusing Azure.Security.KeyVault.Keys.Cryptography;\n\nvar resolver = new KeyResolver(new DefaultAzureCredential());\n\n\u002F\u002F Resolve key by ID to get CryptographyClient\nCryptographyClient cryptoClient = await resolver.ResolveAsync(\n    new Uri(\"https:\u002F\u002Fmyvault.vault.azure.net\u002Fkeys\u002Fmy-key\u002Fversion\"));\n\n\u002F\u002F Use for encryption\nEncryptResult result = await cryptoClient.EncryptAsync(\n    EncryptionAlgorithm.RsaOaep256, \n    plaintext);\n```\n\n## Key Rotation\n\n```csharp\n\u002F\u002F Rotate key (creates new version)\nKeyVaultKey rotatedKey = await client.RotateKeyAsync(\"my-rsa-key\");\nConsole.WriteLine($\"New version: {rotatedKey.Properties.Version}\");\n\n\u002F\u002F Get rotation policy\nKeyRotationPolicy policy = await client.GetKeyRotationPolicyAsync(\"my-rsa-key\");\n\n\u002F\u002F Update rotation policy\npolicy.ExpiresIn = \"P90D\"; \u002F\u002F 90 days\npolicy.LifetimeActions.Add(new KeyRotationLifetimeAction\n{\n    Action = KeyRotationPolicyAction.Rotate,\n    TimeBeforeExpiry = \"P30D\" \u002F\u002F Rotate 30 days before expiry\n});\n\nawait client.UpdateKeyRotationPolicyAsync(\"my-rsa-key\", policy);\n```\n\n## Key Types Reference\n\n| Type | Purpose |\n|------|---------|\n| `KeyClient` | Key management operations |\n| `CryptographyClient` | Cryptographic operations |\n| `KeyResolver` | Resolve key ID to CryptographyClient |\n| `KeyVaultKey` | Key with cryptographic material |\n| `KeyProperties` | Key metadata (no crypto material) |\n| `CreateRsaKeyOptions` | RSA key creation options |\n| `CreateEcKeyOptions` | EC key creation options |\n| `CreateOctKeyOptions` | Symmetric key options |\n| `EncryptResult` | Encryption result |\n| `DecryptResult` | Decryption result |\n| `SignResult` | Signing result |\n| `VerifyResult` | Verification result |\n| `WrapResult` | Key wrap result |\n| `UnwrapResult` | Key unwrap result |\n\n## Algorithms Reference\n\n### Encryption Algorithms\n| Algorithm | Key Type | Description |\n|-----------|----------|-------------|\n| `RsaOaep` | RSA | RSA-OAEP |\n| `RsaOaep256` | RSA | RSA-OAEP-256 |\n| `Rsa15` | RSA | RSA 1.5 (legacy) |\n| `A128Gcm` | Oct | AES-128-GCM |\n| `A256Gcm` | Oct | AES-256-GCM |\n\n### Signature Algorithms\n| Algorithm | Key Type | Description |\n|-----------|----------|-------------|\n| `RS256` | RSA | RSASSA-PKCS1-v1_5 SHA-256 |\n| `RS384` | RSA | RSASSA-PKCS1-v1_5 SHA-384 |\n| `RS512` | RSA | RSASSA-PKCS1-v1_5 SHA-512 |\n| `PS256` | RSA | RSASSA-PSS SHA-256 |\n| `ES256` | EC | ECDSA P-256 SHA-256 |\n| `ES384` | EC | ECDSA P-384 SHA-384 |\n| `ES512` | EC | ECDSA P-521 SHA-512 |\n\n### Key Wrap Algorithms\n| Algorithm | Key Type | Description |\n|-----------|----------|-------------|\n| `RsaOaep` | RSA | RSA-OAEP |\n| `RsaOaep256` | RSA | RSA-OAEP-256 |\n| `A128KW` | Oct | AES-128 Key Wrap |\n| `A256KW` | Oct | AES-256 Key Wrap |\n\n## Best Practices\n\n1. **Use Managed Identity** — Prefer `DefaultAzureCredential` over secrets\n2. **Enable soft-delete** — Protect against accidental deletion\n3. **Use HSM-backed keys** — Set `HardwareProtected = true` for sensitive keys\n4. **Implement key rotation** — Use automatic rotation policies\n5. **Limit key operations** — Only enable required `KeyOperations`\n6. **Set expiration dates** — Always set `ExpiresOn` for keys\n7. **Use specific versions** — Pin to versions in production\n8. **Cache CryptographyClient** — Reuse for multiple operations\n\n## Error Handling\n\n```csharp\nusing Azure;\n\ntry\n{\n    KeyVaultKey key = await client.GetKeyAsync(\"my-key\");\n}\ncatch (RequestFailedException ex) when (ex.Status == 404)\n{\n    Console.WriteLine(\"Key not found\");\n}\ncatch (RequestFailedException ex) when (ex.Status == 403)\n{\n    Console.WriteLine(\"Access denied - check RBAC permissions\");\n}\ncatch (RequestFailedException ex)\n{\n    Console.WriteLine($\"Key Vault error: {ex.Status} - {ex.Message}\");\n}\n```\n\n## Required RBAC Roles\n\n| Role | Permissions |\n|------|-------------|\n| Key Vault Crypto Officer | Full key management |\n| Key Vault Crypto User | Use keys for crypto operations |\n| Key Vault Reader | Read key metadata |\n\n## Related SDKs\n\n| SDK | Purpose | Install |\n|-----|---------|---------|\n| `Azure.Security.KeyVault.Keys` | Keys (this SDK) | `dotnet add package Azure.Security.KeyVault.Keys` |\n| `Azure.Security.KeyVault.Secrets` | Secrets | `dotnet add package Azure.Security.KeyVault.Secrets` |\n| `Azure.Security.KeyVault.Certificates` | Certificates | `dotnet add package Azure.Security.KeyVault.Certificates` |\n| `Azure.Identity` | Authentication | `dotnet add package Azure.Identity` |\n\n## Reference Links\n\n| Resource | URL |\n|----------|-----|\n| NuGet Package | https:\u002F\u002Fwww.nuget.org\u002Fpackages\u002FAzure.Security.KeyVault.Keys |\n| API Reference | https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fapi\u002Fazure.security.keyvault.keys |\n| Quickstart | https:\u002F\u002Flearn.microsoft.com\u002Fazure\u002Fkey-vault\u002Fkeys\u002Fquick-create-net |\n| GitHub Source | https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Ftree\u002Fmain\u002Fsdk\u002Fkeyvault\u002FAzure.Security.KeyVault.Keys |\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","# Azure.Security.KeyVault.Keys (.NET)\n\nClient library for managing cryptographic keys in Azure Key Vault and Managed HSM.\n\n## Installation\n\n```bash\ndotnet add package Azure.Security.KeyVault.Keys\ndotnet add package Azure.Identity\n```\n\n**Current Version**: 4.7.0 (stable)\n\n## Environment Variables\n\n```bash\nKEY_VAULT_NAME=\u003Cyour-key-vault-name>\n# Or full URI\nAZURE_KEYVAULT_URL=https:\u002F\u002F\u003Cvault-name>.vault.azure.net\n```\n\n## Client Hierarchy\n\n```\nKeyClient (key management)\n├── CreateKey \u002F CreateRsaKey \u002F CreateEcKey\n├── GetKey \u002F GetKeys\n├── UpdateKeyProperties\n├── DeleteKey \u002F PurgeDeletedKey\n├── BackupKey \u002F RestoreKey\n└── GetCryptographyClient() → CryptographyClient\n\nCryptographyClient (cryptographic operations)\n├── Encrypt \u002F Decrypt\n├── WrapKey \u002F UnwrapKey\n├── Sign \u002F Verify\n└── SignData \u002F VerifyData\n\nKeyResolver (key resolution)\n└── Resolve(keyId) → CryptographyClient\n```\n\n## Authentication\n\n### DefaultAzureCredential (Recommended)\n\n```csharp\nusing Azure.Identity;\nusing Azure.Security.KeyVault.Keys;\n\nvar keyVaultName = Environment.GetEnvironmentVariable(\"KEY_VAULT_NAME\");\nvar kvUri = $\"https:\u002F\u002F{keyVaultName}.vault.azure.net\";\n\nvar client = new KeyClient(new Uri(kvUri), new DefaultAzureCredential());\n```\n\n### Service Principal\n\n```csharp\nvar credential = new ClientSecretCredential(\n    tenantId: \"\u003Ctenant-id>\",\n    clientId: \"\u003Cclient-id>\",\n    clientSecret: \"\u003Cclient-secret>\");\n\nvar client = new KeyClient(new Uri(kvUri), credential);\n```\n\n## Key Management\n\n### Create Keys\n\n```csharp\n\u002F\u002F Create RSA key\nKeyVaultKey rsaKey = await client.CreateKeyAsync(\"my-rsa-key\", KeyType.Rsa);\nConsole.WriteLine($\"Created key: {rsaKey.Name}, Type: {rsaKey.KeyType}\");\n\n\u002F\u002F Create RSA key with options\nvar rsaOptions = new CreateRsaKeyOptions(\"my-rsa-key-2048\")\n{\n    KeySize = 2048,\n    HardwareProtected = false, \u002F\u002F true for HSM-backed\n    ExpiresOn = DateTimeOffset.UtcNow.AddYears(1),\n    NotBefore = DateTimeOffset.UtcNow,\n    Enabled = true\n};\nrsaOptions.KeyOperations.Add(KeyOperation.Encrypt);\nrsaOptions.KeyOperations.Add(KeyOperation.Decrypt);\n\nKeyVaultKey rsaKey2 = await client.CreateRsaKeyAsync(rsaOptions);\n\n\u002F\u002F Create EC key\nvar ecOptions = new CreateEcKeyOptions(\"my-ec-key\")\n{\n    CurveName = KeyCurveName.P256,\n    HardwareProtected = true \u002F\u002F HSM-backed\n};\nKeyVaultKey ecKey = await client.CreateEcKeyAsync(ecOptions);\n\n\u002F\u002F Create Oct (symmetric) key for wrap\u002Funwrap\nvar octOptions = new CreateOctKeyOptions(\"my-oct-key\")\n{\n    KeySize = 256,\n    HardwareProtected = true\n};\nKeyVaultKey octKey = await client.CreateOctKeyAsync(octOptions);\n```\n\n### Retrieve Keys\n\n```csharp\n\u002F\u002F Get specific key (latest version)\nKeyVaultKey key = await client.GetKeyAsync(\"my-rsa-key\");\nConsole.WriteLine($\"Key ID: {key.Id}\");\nConsole.WriteLine($\"Key Type: {key.KeyType}\");\nConsole.WriteLine($\"Version: {key.Properties.Version}\");\n\n\u002F\u002F Get specific version\nKeyVaultKey keyVersion = await client.GetKeyAsync(\"my-rsa-key\", \"version-id\");\n\n\u002F\u002F List all keys\nawait foreach (KeyProperties keyProps in client.GetPropertiesOfKeysAsync())\n{\n    Console.WriteLine($\"Key: {keyProps.Name}, Enabled: {keyProps.Enabled}\");\n}\n\n\u002F\u002F List key versions\nawait foreach (KeyProperties version in client.GetPropertiesOfKeyVersionsAsync(\"my-rsa-key\"))\n{\n    Console.WriteLine($\"Version: {version.Version}, Created: {version.CreatedOn}\");\n}\n```\n\n### Update Key Properties\n\n```csharp\nKeyVaultKey key = await client.GetKeyAsync(\"my-rsa-key\");\n\nkey.Properties.ExpiresOn = DateTimeOffset.UtcNow.AddYears(2);\nkey.Properties.Tags[\"environment\"] = \"production\";\n\nKeyVaultKey updatedKey = await client.UpdateKeyPropertiesAsync(key.Properties);\n```\n\n### Delete and Purge Keys\n\n```csharp\n\u002F\u002F Start delete operation\nDeleteKeyOperation operation = await client.StartDeleteKeyAsync(\"my-rsa-key\");\n\n\u002F\u002F Wait for deletion to complete (required before purge)\nawait operation.WaitForCompletionAsync();\nConsole.WriteLine($\"Deleted key scheduled purge date: {operation.Value.ScheduledPurgeDate}\");\n\n\u002F\u002F Purge immediately (if soft-delete is enabled)\nawait client.PurgeDeletedKeyAsync(\"my-rsa-key\");\n\n\u002F\u002F Or recover deleted key\nKeyVaultKey recoveredKey = await client.StartRecoverDeletedKeyAsync(\"my-rsa-key\");\n```\n\n### Backup and Restore\n\n```csharp\n\u002F\u002F Backup key\nbyte[] backup = await client.BackupKeyAsync(\"my-rsa-key\");\nawait File.WriteAllBytesAsync(\"key-backup.bin\", backup);\n\n\u002F\u002F Restore key\nbyte[] backupData = await File.ReadAllBytesAsync(\"key-backup.bin\");\nKeyVaultKey restoredKey = await client.RestoreKeyBackupAsync(backupData);\n```\n\n## Cryptographic Operations\n\n### Get CryptographyClient\n\n```csharp\n\u002F\u002F From KeyClient\nKeyVaultKey key = await client.GetKeyAsync(\"my-rsa-key\");\nCryptographyClient cryptoClient = client.GetCryptographyClient(\n    key.Name, \n    key.Properties.Version);\n\n\u002F\u002F Or create directly with key ID\nCryptographyClient cryptoClient = new CryptographyClient(\n    new Uri(\"https:\u002F\u002Fmyvault.vault.azure.net\u002Fkeys\u002Fmy-rsa-key\u002Fversion\"),\n    new DefaultAzureCredential());\n```\n\n### Encrypt and Decrypt\n\n```csharp\nbyte[] plaintext = Encoding.UTF8.GetBytes(\"Secret message to encrypt\");\n\n\u002F\u002F Encrypt\nEncryptResult encryptResult = await cryptoClient.EncryptAsync(\n    EncryptionAlgorithm.RsaOaep256, \n    plaintext);\nConsole.WriteLine($\"Encrypted: {Convert.ToBase64String(encryptResult.Ciphertext)}\");\n\n\u002F\u002F Decrypt\nDecryptResult decryptResult = await cryptoClient.DecryptAsync(\n    EncryptionAlgorithm.RsaOaep256, \n    encryptResult.Ciphertext);\nstring decrypted = Encoding.UTF8.GetString(decryptResult.Plaintext);\nConsole.WriteLine($\"Decrypted: {decrypted}\");\n```\n\n### Wrap and Unwrap Keys\n\n```csharp\n\u002F\u002F Key to wrap (e.g., AES key)\nbyte[] keyToWrap = new byte[32]; \u002F\u002F 256-bit key\nRandomNumberGenerator.Fill(keyToWrap);\n\n\u002F\u002F Wrap key\nWrapResult wrapResult = await cryptoClient.WrapKeyAsync(\n    KeyWrapAlgorithm.RsaOaep256, \n    keyToWrap);\n\n\u002F\u002F Unwrap key\nUnwrapResult unwrapResult = await cryptoClient.UnwrapKeyAsync(\n    KeyWrapAlgorithm.RsaOaep256, \n    wrapResult.EncryptedKey);\n```\n\n### Sign and Verify\n\n```csharp\n\u002F\u002F Data to sign\nbyte[] data = Encoding.UTF8.GetBytes(\"Data to sign\");\n\n\u002F\u002F Sign data (computes hash internally)\nSignResult signResult = await cryptoClient.SignDataAsync(\n    SignatureAlgorithm.RS256, \n    data);\n\n\u002F\u002F Verify signature\nVerifyResult verifyResult = await cryptoClient.VerifyDataAsync(\n    SignatureAlgorithm.RS256, \n    data, \n    signResult.Signature);\nConsole.WriteLine($\"Signature valid: {verifyResult.IsValid}\");\n\n\u002F\u002F Or sign pre-computed hash\nusing var sha256 = SHA256.Create();\nbyte[] hash = sha256.ComputeHash(data);\n\nSignResult signHashResult = await cryptoClient.SignAsync(\n    SignatureAlgorithm.RS256, \n    hash);\n```\n\n## Key Resolver\n\n```csharp\nusing Azure.Security.KeyVault.Keys.Cryptography;\n\nvar resolver = new KeyResolver(new DefaultAzureCredential());\n\n\u002F\u002F Resolve key by ID to get CryptographyClient\nCryptographyClient cryptoClient = await resolver.ResolveAsync(\n    new Uri(\"https:\u002F\u002Fmyvault.vault.azure.net\u002Fkeys\u002Fmy-key\u002Fversion\"));\n\n\u002F\u002F Use for encryption\nEncryptResult result = await cryptoClient.EncryptAsync(\n    EncryptionAlgorithm.RsaOaep256, \n    plaintext);\n```\n\n## Key Rotation\n\n```csharp\n\u002F\u002F Rotate key (creates new version)\nKeyVaultKey rotatedKey = await client.RotateKeyAsync(\"my-rsa-key\");\nConsole.WriteLine($\"New version: {rotatedKey.Properties.Version}\");\n\n\u002F\u002F Get rotation policy\nKeyRotationPolicy policy = await client.GetKeyRotationPolicyAsync(\"my-rsa-key\");\n\n\u002F\u002F Update rotation policy\npolicy.ExpiresIn = \"P90D\"; \u002F\u002F 90 days\npolicy.LifetimeActions.Add(new KeyRotationLifetimeAction\n{\n    Action = KeyRotationPolicyAction.Rotate,\n    TimeBeforeExpiry = \"P30D\" \u002F\u002F Rotate 30 days before expiry\n});\n\nawait client.UpdateKeyRotationPolicyAsync(\"my-rsa-key\", policy);\n```\n\n## Key Types Reference\n\n| Type | Purpose |\n|------|---------|\n| `KeyClient` | Key management operations |\n| `CryptographyClient` | Cryptographic operations |\n| `KeyResolver` | Resolve key ID to CryptographyClient |\n| `KeyVaultKey` | Key with cryptographic material |\n| `KeyProperties` | Key metadata (no crypto material) |\n| `CreateRsaKeyOptions` | RSA key creation options |\n| `CreateEcKeyOptions` | EC key creation options |\n| `CreateOctKeyOptions` | Symmetric key options |\n| `EncryptResult` | Encryption result |\n| `DecryptResult` | Decryption result |\n| `SignResult` | Signing result |\n| `VerifyResult` | Verification result |\n| `WrapResult` | Key wrap result |\n| `UnwrapResult` | Key unwrap result |\n\n## Algorithms Reference\n\n### Encryption Algorithms\n| Algorithm | Key Type | Description |\n|-----------|----------|-------------|\n| `RsaOaep` | RSA | RSA-OAEP |\n| `RsaOaep256` | RSA | RSA-OAEP-256 |\n| `Rsa15` | RSA | RSA 1.5 (legacy) |\n| `A128Gcm` | Oct | AES-128-GCM |\n| `A256Gcm` | Oct | AES-256-GCM |\n\n### Signature Algorithms\n| Algorithm | Key Type | Description |\n|-----------|----------|-------------|\n| `RS256` | RSA | RSASSA-PKCS1-v1_5 SHA-256 |\n| `RS384` | RSA | RSASSA-PKCS1-v1_5 SHA-384 |\n| `RS512` | RSA | RSASSA-PKCS1-v1_5 SHA-512 |\n| `PS256` | RSA | RSASSA-PSS SHA-256 |\n| `ES256` | EC | ECDSA P-256 SHA-256 |\n| `ES384` | EC | ECDSA P-384 SHA-384 |\n| `ES512` | EC | ECDSA P-521 SHA-512 |\n\n### Key Wrap Algorithms\n| Algorithm | Key Type | Description |\n|-----------|----------|-------------|\n| `RsaOaep` | RSA | RSA-OAEP |\n| `RsaOaep256` | RSA | RSA-OAEP-256 |\n| `A128KW` | Oct | AES-128 Key Wrap |\n| `A256KW` | Oct | AES-256 Key Wrap |\n\n## Best Practices\n\n1. **Use Managed Identity** — Prefer `DefaultAzureCredential` over secrets\n2. **Enable soft-delete** — Protect against accidental deletion\n3. **Use HSM-backed keys** — Set `HardwareProtected = true` for sensitive keys\n4. **Implement key rotation** — Use automatic rotation policies\n5. **Limit key operations** — Only enable required `KeyOperations`\n6. **Set expiration dates** — Always set `ExpiresOn` for keys\n7. **Use specific versions** — Pin to versions in production\n8. **Cache CryptographyClient** — Reuse for multiple operations\n\n## Error Handling\n\n```csharp\nusing Azure;\n\ntry\n{\n    KeyVaultKey key = await client.GetKeyAsync(\"my-key\");\n}\ncatch (RequestFailedException ex) when (ex.Status == 404)\n{\n    Console.WriteLine(\"Key not found\");\n}\ncatch (RequestFailedException ex) when (ex.Status == 403)\n{\n    Console.WriteLine(\"Access denied - check RBAC permissions\");\n}\ncatch (RequestFailedException ex)\n{\n    Console.WriteLine($\"Key Vault error: {ex.Status} - {ex.Message}\");\n}\n```\n\n## Required RBAC Roles\n\n| Role | Permissions |\n|------|-------------|\n| Key Vault Crypto Officer | Full key management |\n| Key Vault Crypto User | Use keys for crypto operations |\n| Key Vault Reader | Read key metadata |\n\n## Related SDKs\n\n| SDK | Purpose | Install |\n|-----|---------|---------|\n| `Azure.Security.KeyVault.Keys` | Keys (this SDK) | `dotnet add package Azure.Security.KeyVault.Keys` |\n| `Azure.Security.KeyVault.Secrets` | Secrets | `dotnet add package Azure.Security.KeyVault.Secrets` |\n| `Azure.Security.KeyVault.Certificates` | Certificates | `dotnet add package Azure.Security.KeyVault.Certificates` |\n| `Azure.Identity` | Authentication | `dotnet add package Azure.Identity` |\n\n## Reference Links\n\n| Resource | URL |\n|----------|-----|\n| NuGet Package | https:\u002F\u002Fwww.nuget.org\u002Fpackages\u002FAzure.Security.KeyVault.Keys |\n| API Reference | https:\u002F\u002Flearn.microsoft.com\u002Fdotnet\u002Fapi\u002Fazure.security.keyvault.keys |\n| Quickstart | https:\u002F\u002Flearn.microsoft.com\u002Fazure\u002Fkey-vault\u002Fkeys\u002Fquick-create-net |\n| GitHub Source | https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Ftree\u002Fmain\u002Fsdk\u002Fkeyvault\u002FAzure.Security.KeyVault.Keys |\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n",{"name":5,"risk":24,"source":25,"date_added":26,"description":7},"unknown","community","2026-02-27","main","87afe6ce96220accf50a345dea46784c8c9f210e","YYC3-Skills-技能包\u002FYYC3-Skills-技能包-antigravity-awesome-skills\u002Fplugins\u002Fantigravity-awesome-skills-claude\u002Fskills\u002Fazure-security-keyvault-keys-dotnet",0,"https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base","https:\u002F\u002Fkb.yyc3.top\u002F","https:\u002F\u002Fgithub.com\u002FYYC-Cube","万象归元于云枢 | 深栈智启新纪元","2026-11-10 10:37:32",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill azure-security-keyvault-keys-dotnet",{"tool":42,"command":43},"bunx","bunx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill azure-security-keyvault-keys-dotnet",{"tool":45,"command":46},"pnpm","pnpm dlx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill azure-security-keyvault-keys-dotnet","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Skills-技能包\u002FYYC3-Skills-技能包-antigravity-awesome-skills\u002Fplugins\u002Fantigravity-awesome-skills-claude\u002Fskills\u002Fazure-security-keyvault-keys-dotnet\u002FSKILL.md",true,[],[51,58,65,72,79,86],{"skillNo":52,"name":53,"nameZh":6,"description":54,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M7CTDWHERCXPQCP0K03A86AS","vercel-sandbox","Run agent-browser + Chrome inside Vercel Sandbox microVMs for browser automation from any Vercel-deployed app. Use when the user needs browser automation in a Vercel app (Next.js, SvelteKit, Nuxt, Remix, Astro, etc.), wants to run headless Chrome without binary size limits, needs persistent browser sessions across commands, or wants ephemeral isolated browser environments. Triggers include \"Vercel Sandbox browser\", \"microVM Chrome\", \"agent-browser in sandbox\", \"browser automation on Vercel\", or any task requiring Chrome in a Vercel Sandbox.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fvercel-sandbox\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M7CTD8D2BNJY54S65M47HEJA","slack","Interact with Slack workspaces using browser automation. Use when the user needs to check unread channels, navigate Slack, send messages, extract data, find information, search conversations, or automate any Slack task. Triggers include \"check my Slack\", \"what channels have unreads\", \"send a message to\", \"search Slack for\", \"extract from Slack\", \"find who said\", or any task requiring programmatic Slack interaction.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fslack\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7CTCSSB8ZP3Q58C3YZDZK1W","electron","Automate Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify, etc.) using agent-browser via Chrome DevTools Protocol. Use when the user needs to interact with an Electron app, automate a desktop app, connect to a running app, control a native app, or test an Electron application. Triggers include \"automate Slack app\", \"control VS Code\", \"interact with Discord app\", \"test this Electron app\", \"connect to desktop app\", or any task requiring automation of a native Electron application.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Felectron\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M7CTCBJY76688V4DCZGWFHGQ","dogfood","Systematically explore and test a web application to find bugs, UX issues, and other problems. Use when asked to \"dogfood\", \"QA\", \"exploratory test\", \"find issues\", \"bug hunt\", \"test this app\u002Fsite\u002Fplatform\", or review the quality of a web application. Produces a structured report with full reproduction evidence -- step-by-step screenshots, repro videos, and detailed repro steps for every issue -- so findings can be handed directly to the responsible teams.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fdogfood\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M7CTC4H0FFGVEAQR9PA4GA1A","agent-browser","Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to \"open a website\", \"fill out a form\", \"click a button\", \"take a screenshot\", \"scrape data from a page\", \"test this web app\", \"login to a site\", \"automate browser actions\", or any task requiring programmatic web interaction.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fagent-browser\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M7CTBKVFYBG78FDSABSDJTTQ","shadcn","Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI, including chat interfaces. Provides project context, component docs, and usage examples. Applies when working with shadcn\u002Fui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for \"shadcn init\", \"create an app with --preset\", \"switch to --preset\", and for building a design system or applying a DESIGN.md or brand spec to shadcn\u002Fui.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-UI-界面组件\u002FYYC3-UI-界面组件-ui\u002Fskills\u002Fshadcn\u002FSKILL.md",[],[]]