Skip to content

Commit 859f046

Browse files
authored
Implement secure key release (Azure#16794)
* Doc comment and scope name improvements * Implement secure key release Resolves Azure#14892 sans tests; see Azure#16789 and Azure#16792 * Update public APIs
1 parent 80420c2 commit 859f046

22 files changed

+484
-15
lines changed

sdk/keyvault/Azure.Security.KeyVault.Keys/api/Azure.Security.KeyVault.Keys.netstandard2.0.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ public partial class CreateKeyOptions
1313
public CreateKeyOptions() { }
1414
public bool? Enabled { get { throw null; } set { } }
1515
public System.DateTimeOffset? ExpiresOn { get { throw null; } set { } }
16+
public bool? Exportable { get { throw null; } set { } }
1617
public System.Collections.Generic.IList<Azure.Security.KeyVault.Keys.KeyOperation> KeyOperations { get { throw null; } }
1718
public System.DateTimeOffset? NotBefore { get { throw null; } set { } }
19+
public Azure.Security.KeyVault.Keys.KeyReleasePolicy ReleasePolicy { get { throw null; } set { } }
1820
public System.Collections.Generic.IDictionary<string, string> Tags { get { throw null; } }
1921
}
2022
public partial class CreateRsaKeyOptions : Azure.Security.KeyVault.Keys.CreateKeyOptions
@@ -24,6 +26,7 @@ public CreateRsaKeyOptions(string name, bool hardwareProtected = false) { }
2426
public int? KeySize { get { throw null; } set { } }
2527
public Azure.Security.KeyVault.Keys.KeyType KeyType { get { throw null; } }
2628
public string Name { get { throw null; } }
29+
public int? PublicExponent { get { throw null; } set { } }
2730
}
2831
public static partial class CryptographyModelFactory
2932
{
@@ -65,6 +68,7 @@ public ImportKeyOptions(string name, Azure.Security.KeyVault.Keys.JsonWebKey key
6568
public Azure.Security.KeyVault.Keys.JsonWebKey Key { get { throw null; } }
6669
public string Name { get { throw null; } }
6770
public Azure.Security.KeyVault.Keys.KeyProperties Properties { get { throw null; } }
71+
public Azure.Security.KeyVault.Keys.KeyReleasePolicy ReleasePolicy { get { throw null; } set { } }
6872
}
6973
public partial class JsonWebKey
7074
{
@@ -106,6 +110,10 @@ public KeyClient(System.Uri vaultUri, Azure.Core.TokenCredential credential, Azu
106110
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Security.KeyVault.Keys.KeyVaultKey>> CreateKeyAsync(string name, Azure.Security.KeyVault.Keys.KeyType keyType, Azure.Security.KeyVault.Keys.CreateKeyOptions keyOptions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
107111
public virtual Azure.Response<Azure.Security.KeyVault.Keys.KeyVaultKey> CreateRsaKey(Azure.Security.KeyVault.Keys.CreateRsaKeyOptions rsaKeyOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
108112
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Security.KeyVault.Keys.KeyVaultKey>> CreateRsaKeyAsync(Azure.Security.KeyVault.Keys.CreateRsaKeyOptions rsaKeyOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
113+
public virtual Azure.Response<Azure.Security.KeyVault.Keys.KeyVaultKey> ExportKey(string name, string version, string environment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
114+
public virtual Azure.Response<Azure.Security.KeyVault.Keys.KeyVaultKey> ExportKey(string name, string environment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
115+
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Security.KeyVault.Keys.KeyVaultKey>> ExportKeyAsync(string name, string version, string environment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
116+
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Security.KeyVault.Keys.KeyVaultKey>> ExportKeyAsync(string name, string environment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
109117
public virtual Azure.Response<Azure.Security.KeyVault.Keys.DeletedKey> GetDeletedKey(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
110118
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Security.KeyVault.Keys.DeletedKey>> GetDeletedKeyAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
111119
public virtual Azure.Pageable<Azure.Security.KeyVault.Keys.DeletedKey> GetDeletedKeys(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
@@ -178,6 +186,7 @@ public static partial class KeyModelFactory
178186
public KeyOperation(string value) { throw null; }
179187
public static Azure.Security.KeyVault.Keys.KeyOperation Decrypt { get { throw null; } }
180188
public static Azure.Security.KeyVault.Keys.KeyOperation Encrypt { get { throw null; } }
189+
public static Azure.Security.KeyVault.Keys.KeyOperation Export { get { throw null; } }
181190
public static Azure.Security.KeyVault.Keys.KeyOperation Import { get { throw null; } }
182191
public static Azure.Security.KeyVault.Keys.KeyOperation Sign { get { throw null; } }
183192
public static Azure.Security.KeyVault.Keys.KeyOperation UnwrapKey { get { throw null; } }
@@ -200,17 +209,25 @@ public KeyProperties(System.Uri id) { }
200209
public System.DateTimeOffset? CreatedOn { get { throw null; } }
201210
public bool? Enabled { get { throw null; } set { } }
202211
public System.DateTimeOffset? ExpiresOn { get { throw null; } set { } }
212+
public bool? Exportable { get { throw null; } set { } }
203213
public System.Uri Id { get { throw null; } }
204214
public bool Managed { get { throw null; } }
205215
public string Name { get { throw null; } }
206216
public System.DateTimeOffset? NotBefore { get { throw null; } set { } }
207217
public int? RecoverableDays { get { throw null; } }
208218
public string RecoveryLevel { get { throw null; } }
219+
public Azure.Security.KeyVault.Keys.KeyReleasePolicy ReleasePolicy { get { throw null; } set { } }
209220
public System.Collections.Generic.IDictionary<string, string> Tags { get { throw null; } }
210221
public System.DateTimeOffset? UpdatedOn { get { throw null; } }
211222
public System.Uri VaultUri { get { throw null; } }
212223
public string Version { get { throw null; } }
213224
}
225+
public partial class KeyReleasePolicy
226+
{
227+
public KeyReleasePolicy(byte[] data) { }
228+
public string ContentType { get { throw null; } set { } }
229+
public byte[] Data { get { throw null; } }
230+
}
214231
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
215232
public readonly partial struct KeyType : System.IEquatable<Azure.Security.KeyVault.Keys.KeyType>
216233
{

sdk/keyvault/Azure.Security.KeyVault.Keys/src/CreateKeyOptions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ public CreateKeyOptions()
3838
/// </summary>
3939
public bool? Enabled { get; set; }
4040

41+
/// <summary>
42+
/// Gets or sets a value indicating whether the private key can be exported.
43+
/// </summary>
44+
public bool? Exportable { get; set; }
45+
46+
/// <summary>
47+
/// Gets or sets the policy rules under which the key can be exported.
48+
/// </summary>
49+
public KeyReleasePolicy ReleasePolicy { get; set; }
50+
4151
/// <summary>
4252
/// Gets a dictionary of tags with specific metadata about the key. Although this collection cannot be set, it can be modified
4353
/// or initialized with a <see href="https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer">collection initializer</see>.

sdk/keyvault/Azure.Security.KeyVault.Keys/src/CreateRsaKeyOptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ public class CreateRsaKeyOptions : CreateKeyOptions
2626
/// </summary>
2727
public int? KeySize { get; set; }
2828

29+
/// <summary>
30+
/// Gets or sets the public exponent for a RSA key.
31+
/// </summary>
32+
public int? PublicExponent { get; set; }
33+
2934
/// <summary>
3035
/// Gets a value indicating whether to create a hardware-protected key in a hardware security module (HSM).
3136
/// </summary>

sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/CryptographyClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected CryptographyClient()
3434
/// Initializes a new instance of the <see cref="CryptographyClient"/> class.
3535
/// </summary>
3636
/// <param name="keyId">
37-
/// The <see cref="KeyProperties.Id"/> of the <see cref="KeyVaultKey"/> which will be used for cryptographic operations.
37+
/// The key identifier of the <see cref="KeyVaultKey"/> which will be used for cryptographic operations.
3838
/// If you have a key <see cref="Uri"/>, use <see cref="KeyVaultKeyIdentifier"/> to parse the <see cref="KeyVaultKeyIdentifier.VaultUri"/> and other information.
3939
/// </param>
4040
/// <param name="credential">A <see cref="TokenCredential"/> used to authenticate requests to the vault, like DefaultAzureCredential.</param>
@@ -48,7 +48,7 @@ public CryptographyClient(Uri keyId, TokenCredential credential)
4848
/// Initializes a new instance of the <see cref="CryptographyClient"/> class.
4949
/// </summary>
5050
/// <param name="keyId">
51-
/// The <see cref="KeyProperties.Id"/> of the <see cref="KeyVaultKey"/> which will be used for cryptographic operations.
51+
/// The key identifier of the <see cref="KeyVaultKey"/> which will be used for cryptographic operations.
5252
/// If you have a key <see cref="Uri"/>, use <see cref="KeyVaultKeyIdentifier"/> to parse the <see cref="KeyVaultKeyIdentifier.VaultUri"/> and other information.
5353
/// </param>
5454
/// <param name="credential">A <see cref="TokenCredential"/> used to authenticate requests to the vault, like DefaultAzureCredential.</param>

sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/DecryptResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal DecryptResult()
1919
}
2020

2121
/// <summary>
22-
/// Gets the <see cref="KeyProperties.Id"/> of the <see cref="KeyVaultKey"/> used to decrypt.
22+
/// Gets the key identifier of the <see cref="KeyVaultKey"/> used to decrypt.
2323
/// </summary>
2424
public string KeyId { get; internal set; }
2525

sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/EncryptResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ internal EncryptResult()
2121
}
2222

2323
/// <summary>
24-
/// Gets the <see cref="KeyProperties.Id"/> of the <see cref="KeyVaultKey"/> used to encrypt. This must be stored alongside the <see cref="Ciphertext"/> as the same key must be used to decrypt it.
24+
/// Gets the key identifier of the <see cref="KeyVaultKey"/> used to encrypt. This must be stored alongside the <see cref="Ciphertext"/> as the same key must be used to decrypt it.
2525
/// </summary>
2626
public string KeyId { get; internal set; }
2727

sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/SignResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal SignResult()
1818
}
1919

2020
/// <summary>
21-
/// Gets the <see cref="KeyProperties.Id"/> of the <see cref="KeyVaultKey"/> used to sign. This must be stored alongside the <see cref="Signature"/> as the same key must be used to verify it.
21+
/// Gets the key identifier of the <see cref="KeyVaultKey"/> used to sign. This must be stored alongside the <see cref="Signature"/> as the same key must be used to verify it.
2222
/// </summary>
2323
public string KeyId { get; internal set; }
2424

sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/UnwrapResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal UnwrapResult()
1818
}
1919

2020
/// <summary>
21-
/// Gets the <see cref="KeyProperties.Id"/> of the <see cref="Key"/> used to uwrap.
21+
/// Gets the key identifier of the <see cref="Key"/> used to uwrap.
2222
/// </summary>
2323
public string KeyId { get; internal set; }
2424

sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/VerifyResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal VerifyResult()
1818
}
1919

2020
/// <summary>
21-
/// Gets the <see cref="KeyProperties.Id"/> of the <see cref="KeyVaultKey"/> used to verify.
21+
/// Gets the key identifier of the <see cref="KeyVaultKey"/> used to verify.
2222
/// </summary>
2323
public string KeyId { get; internal set; }
2424

sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/WrapResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal WrapResult()
1818
}
1919

2020
/// <summary>
21-
/// Gets the <see cref="KeyProperties.Id"/> of the <see cref="KeyVaultKey"/> used to wrap the <see cref="EncryptedKey"/>. This must be stored alongside the <see cref="EncryptedKey"/> as the same key must be used to unwrap it.
21+
/// Gets the key identifier of the <see cref="KeyVaultKey"/> used to wrap the <see cref="EncryptedKey"/>. This must be stored alongside the <see cref="EncryptedKey"/> as the same key must be used to unwrap it.
2222
/// </summary>
2323
public string KeyId { get; internal set; }
2424

0 commit comments

Comments
 (0)