SEBWIN-309, SEBWIN-358: Fixed crash happening when a configuration does not contain a salt value for the browser exam key.
This commit is contained in:
parent
6865798fb5
commit
9d0c005b35
1 changed files with 9 additions and 1 deletions
|
@ -130,7 +130,15 @@ namespace SafeExamBrowser.Browser.Handlers
|
||||||
|
|
||||||
private string ComputeBrowserExamKey()
|
private string ComputeBrowserExamKey()
|
||||||
{
|
{
|
||||||
using (var algorithm = new HMACSHA256(settings.ExamKeySalt))
|
var salt = settings.ExamKeySalt;
|
||||||
|
|
||||||
|
if (salt == default(byte[]))
|
||||||
|
{
|
||||||
|
salt = new byte[0];
|
||||||
|
logger.Warn("The current configuration does not contain a salt value for the browser exam key!");
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var algorithm = new HMACSHA256(salt))
|
||||||
{
|
{
|
||||||
var hash = algorithm.ComputeHash(Encoding.UTF8.GetBytes(appConfig.CodeSignatureHash + appConfig.ProgramBuildVersion + settings.ConfigurationKey));
|
var hash = algorithm.ComputeHash(Encoding.UTF8.GetBytes(appConfig.CodeSignatureHash + appConfig.ProgramBuildVersion + settings.ConfigurationKey));
|
||||||
var key = BitConverter.ToString(hash).ToLower().Replace("-", string.Empty);
|
var key = BitConverter.ToString(hash).ToLower().Replace("-", string.Empty);
|
||||||
|
|
Loading…
Reference in a new issue