Skip to content

Commit 16367a7

Browse files
authored
Ensure different key ids use different client instances (#2374)
* Ensure different key ids use different client instances * Minor cleanup * Minor cleanup
1 parent 1a33645 commit 16367a7

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/Confluent.SchemaRegistry.Encryption.Aws/AwsKmsClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class AwsKmsClient : IKmsClient
1212
{
1313
private AmazonKeyManagementServiceClient kmsClient;
1414
private string keyId;
15-
15+
1616
public string KekId { get; }
1717

1818
public AwsKmsClient(string kekId, AWSCredentials credentials)
@@ -36,7 +36,7 @@ public AwsKmsClient(string kekId, AWSCredentials credentials)
3636

3737
public bool DoesSupport(string uri)
3838
{
39-
return uri.StartsWith(AwsKmsDriver.Prefix);
39+
return KekId == uri;
4040
}
4141

4242
public async Task<byte[]> Encrypt(byte[] plaintext)

src/Confluent.SchemaRegistry.Encryption.Azure/AzureKmsClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public AzureKmsClient(string kekId, TokenCredential tokenCredential)
2525

2626
public bool DoesSupport(string uri)
2727
{
28-
return uri.StartsWith(AzureKmsDriver.Prefix);
28+
return KekId == uri;
2929
}
3030

3131
public async Task<byte[]> Encrypt(byte[] plaintext)

src/Confluent.SchemaRegistry.Encryption.Gcp/GcpKmsClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public GcpKmsClient(string kekId, GoogleCredential credential)
3636

3737
public bool DoesSupport(string uri)
3838
{
39-
return uri.StartsWith(GcpKmsDriver.Prefix);
39+
return KekId == uri;
4040
}
4141

4242
public async Task<byte[]> Encrypt(byte[] plaintext)

src/Confluent.SchemaRegistry.Encryption.HcVault/HcVaultKmsClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public HcVaultKmsClient(string kekId, string ns, string tokenId)
4848

4949
public bool DoesSupport(string uri)
5050
{
51-
return uri.StartsWith(HcVaultKmsDriver.Prefix);
51+
return KekId == uri;
5252
}
5353

5454
public async Task<byte[]> Encrypt(byte[] plaintext)

0 commit comments

Comments
 (0)