public void SettingValue() { var keygen = new BinaryKeyAppConfig(); //<add key="JwtSecretKey" value="7U2DeVpuI+dGGic3np+z5w=="/> output.WriteLine(keygen.SettingValue); Assert.Equal("7U2DeVpuI+dGGic3np+z5w==", keygen.SettingValue); }
public void MakeNewString() { var keygen = new BinaryKeyAppConfig(); var key = keygen.MakeNewString(); output.WriteLine(key); Assert.IsType<byte[]>(Convert.FromBase64String(key)); }
public void MakeNewSetting() { var keygen = new BinaryKeyAppConfig(); var keySetting = keygen.MakeNewSetting(); output.WriteLine(keySetting); Assert.Matches("^<add key=\".+\" value=\".+\"/>$", keySetting); }
public void MakeNew1024bit() { var keygen = new BinaryKeyAppConfig(); var key = keygen.MakeNew(1024 / 8); output.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(key.Select(Q => (int)Q))); Assert.Equal(1024 / 8, key.Length); }
public void MakeNewDefault128bit() { var keygen = new BinaryKeyAppConfig(); var s = new StringBuilder(); var key = keygen.MakeNew(); foreach (var b in key) { s.Append(", " + b); } output.WriteLine(s.ToString().TrimStart(',', ' ')); Assert.Equal(128 / 8, key.Length); }
public void Value() { var keygen = new BinaryKeyAppConfig(); //<add key="JwtSecretKey" value="7U2DeVpuI+dGGic3np+z5w=="/> var binaryValue = (byte[])keygen.Value; var arrayValue = binaryValue.Select(Q => (int)Q); output.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(arrayValue)); Assert.Equal(new byte[] { 237, 77, 131, 121, 90, 110, 35, 231, 70, 26, 39, 55, 158, 159, 179, 231 }, keygen.Value); }