Skip to content

Commit 2e71183

Browse files
committed
Follow the inbound blocks' established-key argument
The blocks replaced fromEstablishedKeys() with useEstablishedKey, and reading the exchange's keys now follows that argument, so a config passing only a trust store no longer verifies a MAC the request's own key produced.
1 parent 374abfb commit 2e71183

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

tests/Wsse/SymmetricBindingPhpInteropTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ public function test_php_reads_a_wss4j_response_keyed_by_the_key_its_request_est
197197

198198
// The same exchange keys the request used, which is what the middleware hands both directions.
199199
$inbound = $this->context($response, $keys);
200-
(Inbound\Decrypt::fromEstablishedKeys())($inbound);
201-
(new Inbound\VerifySignature($this->trustStore(), signed: [Part::body()]))($inbound);
200+
(new Inbound\Decrypt(useEstablishedKey: true))($inbound);
201+
(new Inbound\VerifySignature($this->trustStore(), signed: [Part::body()], useEstablishedKey: true))($inbound);
202202

203203
self::assertStringContainsString(self::PLAINTEXT_MARKER, $response->toXmlString());
204204
}
@@ -215,8 +215,8 @@ public function test_php_reads_a_wss4j_response_that_derives_a_key_per_block():
215215
$response = $this->wss4jResponseTo($this->establishedRequest($keys), derivedKeys: true);
216216

217217
$inbound = $this->context($response, $keys);
218-
(Inbound\Decrypt::fromEstablishedKeys())($inbound);
219-
(new Inbound\VerifySignature($this->trustStore(), signed: [Part::body()]))($inbound);
218+
(new Inbound\Decrypt(useEstablishedKey: true))($inbound);
219+
(new Inbound\VerifySignature($this->trustStore(), signed: [Part::body()], useEstablishedKey: true))($inbound);
220220

221221
self::assertStringContainsString(self::PLAINTEXT_MARKER, $response->toXmlString());
222222
self::assertStringContainsString('DerivedKeyToken', $response->toXmlString());
@@ -241,8 +241,8 @@ public function test_php_reads_a_wss4j_response_in_the_2005_02_dialect(): void
241241
self::assertStringNotContainsString(WsSecureConversationVersion::V2005_12->value, $response->toXmlString());
242242

243243
$inbound = $this->context($response, $keys);
244-
(Inbound\Decrypt::fromEstablishedKeys())($inbound);
245-
(new Inbound\VerifySignature($this->trustStore(), signed: [Part::body()]))($inbound);
244+
(new Inbound\Decrypt(useEstablishedKey: true))($inbound);
245+
(new Inbound\VerifySignature($this->trustStore(), signed: [Part::body()], useEstablishedKey: true))($inbound);
246246

247247
self::assertStringContainsString(self::PLAINTEXT_MARKER, $response->toXmlString());
248248
}
@@ -254,7 +254,7 @@ public function test_php_refuses_that_same_response_against_a_different_exchange
254254
$response = $this->wss4jResponseTo($this->establishedRequest(new ExchangeKeys()));
255255

256256
$this->expectException(SecurityFault::class);
257-
(Inbound\Decrypt::fromEstablishedKeys())($this->context($response, new ExchangeKeys()));
257+
(new Inbound\Decrypt(useEstablishedKey: true))($this->context($response, new ExchangeKeys()));
258258
}
259259

260260
/** A request that establishes a session key in the given exchange, as a real one would. */
@@ -326,7 +326,7 @@ public function test_php_refuses_a_wss4j_symmetric_signature_keyed_by_a_key_it_d
326326
self::assertStringContainsString(self::PLAINTEXT_MARKER, $document->toXmlString());
327327

328328
$this->expectException(SecurityFault::class);
329-
(new Inbound\VerifySignature($this->trustStore(), signed: [Part::body()]))($context);
329+
(new Inbound\VerifySignature($this->trustStore(), signed: [Part::body()], useEstablishedKey: true))($context);
330330
}
331331

332332
/**
@@ -356,7 +356,7 @@ public function test_php_reads_back_its_own_endorsed_binding(): void
356356
// WSS4J accepts it, and so does this package: the same bytes, read by both.
357357
self::assertTrue($this->verify($document->toXmlString())['valid']);
358358

359-
(new Inbound\VerifySignature($this->trustStore(), signed: [Part::body(), Part::timestamp()]))(
359+
(new Inbound\VerifySignature($this->trustStore(), signed: [Part::body(), Part::timestamp()], useEstablishedKey: true))(
360360
$this->context($document, $keys),
361361
);
362362
}

0 commit comments

Comments
 (0)