コード例 #1
0
 internal SearchResourceEncryptionKey(string keyName, string keyVersion, string VaultUri, AzureActiveDirectoryApplicationCredentials accessCredentialsInternal)
 {
     KeyName    = keyName;
     KeyVersion = keyVersion;
     _vaultUri  = VaultUri;
     AccessCredentialsInternal = accessCredentialsInternal;
 }
コード例 #2
0
 internal EncryptionKey(string keyVaultKeyName, string keyVaultKeyVersion, string keyVaultUri, AzureActiveDirectoryApplicationCredentials accessCredentials)
 {
     KeyVaultKeyName    = keyVaultKeyName;
     KeyVaultKeyVersion = keyVaultKeyVersion;
     KeyVaultUri        = keyVaultUri;
     AccessCredentials  = accessCredentials;
 }
コード例 #3
0
        internal static EncryptionKey DeserializeEncryptionKey(JsonElement element)
        {
            EncryptionKey result = new EncryptionKey();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("keyVaultKeyName"))
                {
                    result.KeyVaultKeyName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("keyVaultKeyVersion"))
                {
                    result.KeyVaultKeyVersion = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("keyVaultUri"))
                {
                    result.KeyVaultUri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("accessCredentials"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.AccessCredentials = AzureActiveDirectoryApplicationCredentials.DeserializeAzureActiveDirectoryApplicationCredentials(property.Value);
                    continue;
                }
            }
            return(result);
        }
        internal static SearchResourceEncryptionKey DeserializeSearchResourceEncryptionKey(JsonElement element)
        {
            string keyVaultKeyName    = default;
            string keyVaultKeyVersion = default;
            string keyVaultUri        = default;
            AzureActiveDirectoryApplicationCredentials accessCredentials = default;

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

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("applicationId"))
                {
                    result.ApplicationId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("applicationSecret"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.ApplicationSecret = property.Value.GetString();
                    continue;
                }
            }
            return(result);
        }