Exemple #1
0
 internal EncryptionKey(string keyVaultKeyName, string keyVaultKeyVersion, string keyVaultUri, AzureActiveDirectoryApplicationCredentials accessCredentials)
 {
     KeyVaultKeyName    = keyVaultKeyName;
     KeyVaultKeyVersion = keyVaultKeyVersion;
     KeyVaultUri        = keyVaultUri;
     AccessCredentials  = accessCredentials;
 }
Exemple #2
0
        internal static EncryptionKey DeserializeEncryptionKey(JsonElement element)
        {
            string keyVaultKeyName    = default;
            string keyVaultKeyVersion = default;
            string keyVaultUri        = default;
            AzureActiveDirectoryApplicationCredentials accessCredentials = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("keyVaultKeyName"))
                {
                    keyVaultKeyName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("keyVaultKeyVersion"))
                {
                    keyVaultKeyVersion = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("keyVaultUri"))
                {
                    keyVaultUri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("accessCredentials"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    accessCredentials = AzureActiveDirectoryApplicationCredentials.DeserializeAzureActiveDirectoryApplicationCredentials(property.Value);
                    continue;
                }
            }
            return(new EncryptionKey(keyVaultKeyName, keyVaultKeyVersion, keyVaultUri, accessCredentials));
        }