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

Slightly off results in .net core #6

Closed
johnkwaters opened this issue Mar 15, 2017 · 1 comment
Closed

Slightly off results in .net core #6

johnkwaters opened this issue Mar 15, 2017 · 1 comment

Comments

@johnkwaters
Copy link

The .net core version works nicely, execept it doenst generate EXACTLY the same tokens as the online tool does when using Azure CDN. I wonder of it might be to do with the order of the parameters that get encoded?

@apollak
Copy link
Contributor

apollak commented Mar 17, 2017

The tokens need to look different every time you create them as the Initialization Vector is created randomly everytime.

        byte[] iv = new byte[NonceBitSize / 8];
        Random.NextBytes(iv, 0, iv.Length);
        var cipher = new GcmBlockCipher(new AesFastEngine());
        // var parameters = new AeadParameters(new KeyParameter(key), MacBitSize, nonce, nonSecretPayload);
        KeyParameter keyParam = new KeyParameter(key);
        ICipherParameters parameters = new ParametersWithIV(keyParam, iv);
        cipher.Init(true, parameters);

@jcline jcline closed this as completed May 30, 2017
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

3 participants