Skip to content

Commit 920c53a

Browse files
authored
Allow modificatoin of encryptSignature
Allows the modifcation of the encryptSignature Parameter of the WSSESOAP::encryptSoapDoc method
1 parent 5ffb9b9 commit 920c53a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/WSSecurity/Entry/Encryption.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ final class Encryption implements WsseEntry
1919

2020
private DataEncryptionMethod $dataEncryptionMethod = DataEncryptionMethod::AES256_CBC;
2121
private KeyEncryptionMethod $keyEncryptionMethod = KeyEncryptionMethod::RSA_OAEP_MGF1P;
22+
23+
private bool $encryptSignature = true;
2224

2325
public function __construct(KeyInterface $key, KeyIdentifier $keyIdentifier)
2426
{
@@ -42,6 +44,14 @@ public function withKeyEncryptionMethod(KeyEncryptionMethod $keyEncryptionMethod
4244
return $new;
4345
}
4446

47+
public function withEncryptSignature(bool $encryptSignature): self
48+
{
49+
$new = clone $this;
50+
$new->encryptSignature = $encryptSignature;
51+
52+
return $new;
53+
}
54+
4555
public function __invoke(Document $envelope, WSSESoap $wsse): void
4656
{
4757
$dataEncryptionKey = new XMLSecurityKey($this->dataEncryptionMethod->value);
@@ -51,7 +61,7 @@ public function __invoke(Document $envelope, WSSESoap $wsse): void
5161
$encryptionKey->passphrase = $this->key->passphrase();
5262
$encryptionKey->loadKey($this->key->contents(), false, $this->key->isCertificate());
5363

54-
$wsse->encryptSoapDoc($encryptionKey, $dataEncryptionKey);
64+
$wsse->encryptSoapDoc($encryptionKey, $dataEncryptionKey,encryptSignature:$this->encryptSignature);
5565

5666
$encryptedKey = (new EncryptedKeyLocator())($envelope);
5767
($this->keyIdentifier)($envelope, $wsse, $encryptedKey);

0 commit comments

Comments
 (0)