@@ -19,6 +19,8 @@ final class Encryption implements WsseEntry
19
19
20
20
private DataEncryptionMethod $ dataEncryptionMethod = DataEncryptionMethod::AES256_CBC ;
21
21
private KeyEncryptionMethod $ keyEncryptionMethod = KeyEncryptionMethod::RSA_OAEP_MGF1P ;
22
+
23
+ private bool $ encryptSignature = true ;
22
24
23
25
public function __construct (KeyInterface $ key , KeyIdentifier $ keyIdentifier )
24
26
{
@@ -42,6 +44,14 @@ public function withKeyEncryptionMethod(KeyEncryptionMethod $keyEncryptionMethod
42
44
return $ new ;
43
45
}
44
46
47
+ public function withEncryptSignature (bool $ encryptSignature ): self
48
+ {
49
+ $ new = clone $ this ;
50
+ $ new ->encryptSignature = $ encryptSignature ;
51
+
52
+ return $ new ;
53
+ }
54
+
45
55
public function __invoke (Document $ envelope , WSSESoap $ wsse ): void
46
56
{
47
57
$ dataEncryptionKey = new XMLSecurityKey ($ this ->dataEncryptionMethod ->value );
@@ -51,7 +61,7 @@ public function __invoke(Document $envelope, WSSESoap $wsse): void
51
61
$ encryptionKey ->passphrase = $ this ->key ->passphrase ();
52
62
$ encryptionKey ->loadKey ($ this ->key ->contents (), false , $ this ->key ->isCertificate ());
53
63
54
- $ wsse ->encryptSoapDoc ($ encryptionKey , $ dataEncryptionKey );
64
+ $ wsse ->encryptSoapDoc ($ encryptionKey , $ dataEncryptionKey,encryptSignature: $ this -> encryptSignature );
55
65
56
66
$ encryptedKey = (new EncryptedKeyLocator ())($ envelope );
57
67
($ this ->keyIdentifier )($ envelope , $ wsse , $ encryptedKey );
0 commit comments