Skip to content

Commit efa4304

Browse files
committed
Add test
1 parent 614ae0f commit efa4304

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/Confluent.SchemaRegistry.Encryption/KmsClientWrapper.cs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,12 @@ private IList<string> GetKmsKeyIds()
7373
IList<string> kmsKeyIds = new List<string>();
7474
kmsKeyIds.Add(Kek.KmsKeyId);
7575
string alternateKmsKeyIds = null;
76-
if (Kek.KmsProps != null && Kek.KmsProps.TryGetValue(EncryptionExecutor.EncryptAlternateKmsKeyIds, out alternateKmsKeyIds))
76+
if (Kek.KmsProps != null)
7777
{
78-
char[] separators = { ',' };
79-
string[] ids = alternateKmsKeyIds.Split(separators, StringSplitOptions.RemoveEmptyEntries);
80-
foreach (string id in ids) {
81-
if (!string.IsNullOrEmpty(id)) {
82-
kmsKeyIds.Add(id);
83-
}
84-
}
85-
} else
78+
Kek.KmsProps.TryGetValue(EncryptionExecutor.EncryptAlternateKmsKeyIds,
79+
out alternateKmsKeyIds);
80+
}
81+
if (string.IsNullOrEmpty(alternateKmsKeyIds))
8682
{
8783
var kvp = Configs.FirstOrDefault(x =>
8884
x.Key == EncryptionExecutor.EncryptAlternateKmsKeyIds);
@@ -91,12 +87,14 @@ private IList<string> GetKmsKeyIds()
9187
alternateKmsKeyIds = kvp.Value;
9288
}
9389
}
94-
if (alternateKmsKeyIds != null)
90+
if (!string.IsNullOrEmpty(alternateKmsKeyIds))
9591
{
9692
char[] separators = { ',' };
9793
string[] ids = alternateKmsKeyIds.Split(separators, StringSplitOptions.RemoveEmptyEntries);
98-
foreach (string id in ids) {
99-
if (!string.IsNullOrEmpty(id)) {
94+
foreach (string id in ids)
95+
{
96+
if (!string.IsNullOrEmpty(id))
97+
{
10098
kmsKeyIds.Add(id);
10199
}
102100
}

0 commit comments

Comments
 (0)