Skip to content

Commit

Permalink
Merge pull request #25 from OSGP/feature/FDP-2239-hash-obv-nieuwe-psk
Browse files Browse the repository at this point in the history
FDP-2239: use new psk for calculating hash
  • Loading branch information
loesimmens authored May 31, 2024
2 parents 5480652 + ac02879 commit f37ad90
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ class PskService(
logger.info { "Validating hash for identity: ${simulatorProperties.pskIdentity}" }

val secret = activePreSharedKey.secret
val oldKey = activePreSharedKey.preSharedKey
val expectedHash = DigestUtils.sha256Hex("$secret$oldKey")
val expectedHash = DigestUtils.sha256Hex("$secret$newPsk")

if (expectedHash != hash) {
throw InvalidPskHashException("PSK set Hash for Identity ${simulatorProperties.pskIdentity} did not match")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class PskServiceTest {

@Test
fun shouldSetNewPskInStoreWhenTheKeyIsValid() {
val expectedHash = DigestUtils.sha256Hex("$secret$oldKey")
val expectedHash = DigestUtils.sha256Hex("$secret$newKey")
val pskCommand = "!PSK:$newKey:${expectedHash};PSK:$newKey:${expectedHash}:SET"
val psk = PreSharedKey(
identity,
Expand Down

0 comments on commit f37ad90

Please sign in to comment.