Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High avaibility scenario - Do net reset clearKeyStreamingKey on each run of tests #54

Open
ChoOo7 opened this issue Dec 7, 2021 · 0 comments

Comments

@ChoOo7
Copy link
Contributor

ChoOo7 commented Dec 7, 2021

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ X ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Launch test for hight avaibility
AES broadcast is working
Launch new tests on visual studio, the clear streaming key will me changed
Newly created assets won't be able to be played
Cleanup should clean more, or the secret have to be set only once if not already in the vault

For example

        bool shouldGenerateNewSecret = false;
        try
        {
            var valueFromStore = await keyVaultClient.GetSecretAsync($"https://{this.keyVaultName}.vault.azure.net/secrets/ClearKeyStreamingKey").ConfigureAwait(false);
            if (valueFromStore != null)
            {
                this.clearKeyStreamingKey = Convert.FromBase64String(valueFromStore.Value);
            }
        }
        catch(KeyVaultErrorException ex)
        {
            if(ex.Message.ToUpperInvariant().Contains("NOTFOUND"))
            {
                shouldGenerateNewSecret = true;
            }else
            {
                throw;
            }
        }

        if(shouldGenerateNewSecret)
        {
            using (var rng = new RNGCryptoServiceProvider())
            {
                this.clearKeyStreamingKey = new byte[40];
                // generate a random key and store it to the vault
                rng.GetBytes(this.clearKeyStreamingKey);
                await keyVaultClient.SetSecretAsync($"https://{this.keyVaultName}.vault.azure.net", "ClearKeyStreamingKey", Convert.ToBase64String(this.clearKeyStreamingKey)).ConfigureAwait(false);
            }
        }

Any log messages given by the failure

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant