umbraco-authu icon indicating copy to clipboard operation
umbraco-authu copied to clipboard

Symmetric key creation

Open somoreingold opened this issue 4 years ago • 1 comments

Hi there,

Could you provide a bit more guidance on the required format of the symmetric key? The docs mention 32 characters long, then base64 encoded. I've tried generating it the way I'd expect via algorithms such as this:

System.Security.Cryptography.RandomNumberGenerator cryptoRandomDataGenerator = new System.Security.Cryptography.RNGCryptoServiceProvider();
byte[] buffer = new byte[32];
cryptoRandomDataGenerator.GetBytes(buffer);
string symmetricKey = Convert.ToBase64String(buffer);
Console.WriteLine(symmetricKey);

Which produces something that expectedly looks like a base64 encoded string, such as: r3b/mk4itk/yH8195i5abxLHFV/fK3FJMNGJgfrnORU=

However, that type of string doesn't work (nor does it quite appear to have a similar format of the one in your sample--which looks more like a 32 character hex string?). The one in your sample works, but of course we wouldn't want to use that. Do you happen to have a snippet or some advice?

Thank you!

somoreingold avatar Jul 24 '20 00:07 somoreingold

Hey, you can either slightly edit the existing one in the example (it's impossible to guess and even if you do, it might not be enough to achieve anything) or create one from scratch from this link https://www.allkeysgenerator.com/Random/Security-Encryption-Key-Generator.aspx

Just click security level 128 bit and check HEX.

grovolis avatar Sep 22 '20 22:09 grovolis