Skip to content

Commit 4a6c310

Browse files
committed
CS
1 parent 1cbfbe3 commit 4a6c310

11 files changed

+13
-23
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/encryption.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,7 @@
1111

1212
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
1313

14-
use Doctrine\Common\Annotations\AnnotationReader;
15-
use Doctrine\Common\Annotations\AnnotationRegistry;
16-
use Doctrine\Common\Annotations\CachedReader;
17-
use Doctrine\Common\Annotations\Reader;
18-
use Doctrine\Common\Cache\ArrayCache;
19-
use Doctrine\Common\Cache\FilesystemCache;
2014
use phpseclib\Crypt\AES;
21-
use Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer;
22-
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
23-
use Symfony\Component\Cache\DoctrineProvider;
2415
use Symfony\Component\Encryption\AsymmetricEncryptionInterface;
2516
use Symfony\Component\Encryption\Provider\PhpseclibEncryption;
2617
use Symfony\Component\Encryption\Provider\SodiumEncryption;

src/Symfony/Component/Encryption/AsymmetricEncryptionInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public function encrypt(string $message, string $publicKey, ?string $privateKey
6363
* @param string|null $publicKey Alice's public key. If a public key is provided, Bob will be sure the message comes from Alice.
6464
*
6565
* @throws EncryptionException
66-
* @throws UnableToVerifySignatureException Either it was the wrong sender/receiver, or the message was tampered with.
67-
* @throws SignatureVerificationRequiredException Thrown when you passed null as public key but the public key is needed.
66+
* @throws UnableToVerifySignatureException either it was the wrong sender/receiver, or the message was tampered with
67+
* @throws SignatureVerificationRequiredException thrown when you passed null as public key but the public key is needed
6868
*/
6969
public function decrypt(string $message, string $privateKey, ?string $publicKey = null): string;
7070
}

src/Symfony/Component/Encryption/Ciphertext.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
<?php
22

3-
declare(strict_types=1);
4-
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
511

612
namespace Symfony\Component\Encryption;
713

src/Symfony/Component/Encryption/Provider/PhpseclibEncryption.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Symfony\Component\Encryption\Exception\DecryptionException;
1919
use Symfony\Component\Encryption\Exception\EncryptionException;
2020
use Symfony\Component\Encryption\Exception\InvalidArgumentException;
21-
use Symfony\Component\Encryption\Exception\MalformedCipherException;
2221
use Symfony\Component\Encryption\Exception\SignatureVerificationRequiredException;
2322
use Symfony\Component\Encryption\Exception\UnableToVerifySignatureException;
2423
use Symfony\Component\Encryption\Exception\UnsupportedAlgorithmException;

src/Symfony/Component/Encryption/Provider/SodiumEncryption.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717
use Symfony\Component\Encryption\Exception\EncryptionException;
1818
use Symfony\Component\Encryption\Exception\InvalidArgumentException;
1919
use Symfony\Component\Encryption\Exception\SignatureVerificationRequiredException;
20-
use Symfony\Component\Encryption\Exception\UnableToVerifySignatureException;
2120
use Symfony\Component\Encryption\Exception\UnsupportedAlgorithmException;
2221
use Symfony\Component\Encryption\SymmetricEncryptionInterface;
2322

24-
2523
/**
2624
* The secret key length should be 32 bytes, but other sizes are accepted.
2725
*
@@ -57,12 +55,14 @@ public function encrypt(string $message, ?string $publicKey = null, ?string $pri
5755
try {
5856
if (null === $publicKey) {
5957
$ciphertext = sodium_crypto_secretbox($message, $nonce, $this->getSodiumKey($this->secret));
58+
6059
return (new Ciphertext('sodium_secretbox', $ciphertext, $nonce))->getUrlSafeRepresentation();
6160
} elseif (null === $privateKey) {
6261
return (new Ciphertext('sodium_crypto_box_seal', sodium_crypto_box_seal($message, $publicKey), $nonce))->getUrlSafeRepresentation();
6362
} elseif (null !== $publicKey && null !== $privateKey) {
6463
$keypair = sodium_crypto_box_keypair_from_secretkey_and_publickey($privateKey, $publicKey);
6564
$ciphertext = sodium_crypto_box($message, $nonce, $keypair);
65+
6666
return (new Ciphertext('sodium_crypto_box', $ciphertext, $nonce))->getUrlSafeRepresentation();
6767
} else {
6868
throw new InvalidArgumentException('Private key cannot have a value when no public key is provided.');

src/Symfony/Component/Encryption/Tests/AbstractAsymmetricEncryptionTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616
use Symfony\Component\Encryption\Exception\DecryptionException;
1717
use Symfony\Component\Encryption\Exception\MalformedCipherException;
1818
use Symfony\Component\Encryption\Exception\SignatureVerificationRequiredException;
19-
use Symfony\Component\Encryption\Exception\UnableToVerifySignatureException;
2019
use Symfony\Component\Encryption\Exception\UnsupportedAlgorithmException;
2120

22-
2321
/**
2422
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
2523
*/

src/Symfony/Component/Encryption/Tests/Provider/PhpseclibAsymmetricEncryptionTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\Encryption\Provider\PhpseclibEncryption;
1717
use Symfony\Component\Encryption\Tests\AbstractAsymmetricEncryptionTest;
1818

19-
2019
/**
2120
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
2221
*/

src/Symfony/Component/Encryption/Tests/Provider/PhpseclibSymmetricEncryptionTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\Encryption\SymmetricEncryptionInterface;
1717
use Symfony\Component\Encryption\Tests\AbstractSymmetricEncryptionTest;
1818

19-
2019
/**
2120
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
2221
*/

src/Symfony/Component/Encryption/Tests/Provider/SodiumAsymmetricEncryptionTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Encryption\Tests\Encryption\Provider;
1313

14-
1514
use Symfony\Component\Encryption\AsymmetricEncryptionInterface;
1615
use Symfony\Component\Encryption\Provider\SodiumEncryption;
1716
use Symfony\Component\Encryption\Tests\AbstractAsymmetricEncryptionTest;

src/Symfony/Component/Encryption/Tests/Provider/SodiumSymmetricEncryptionTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Encryption\Tests\Encryption\Provider;
1313

14-
1514
use Symfony\Component\Encryption\Provider\SodiumEncryption;
1615
use Symfony\Component\Encryption\SymmetricEncryptionInterface;
1716
use Symfony\Component\Encryption\Tests\AbstractSymmetricEncryptionTest;

0 commit comments

Comments
 (0)