@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $rootNode = $treeBuilder->root('mes_crypto'); |
30 | 30 | |
31 | 31 | $rootNode |
32 | - ->children() |
|
32 | + ->children() |
|
33 | 33 | ->arrayNode('key') |
34 | 34 | ->addDefaultsIfNotSet() |
35 | 35 | ->children() |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | ->info('your_loader_service_id. Disabled by default. To enabled: loader: ~') |
102 | 102 | ->canBeEnabled() |
103 | 103 | ->end() |
104 | - ->end() |
|
104 | + ->end() |
|
105 | 105 | ; |
106 | 106 | |
107 | 107 | return $treeBuilder; |
@@ -86,21 +86,21 @@ discard block |
||
86 | 86 | |
87 | 87 | // Sets the loader resource. |
88 | 88 | $container->findDefinition($id) |
89 | - ->addMethodCall('setResource', array($attribute['resource'])); |
|
89 | + ->addMethodCall('setResource', array($attribute['resource'])); |
|
90 | 90 | |
91 | 91 | // Load secret from loader. |
92 | 92 | $container->getDefinition('mes_crypto.key_manager_wrapper') |
93 | - ->setMethodCalls(array()) |
|
94 | - ->addMethodCall('setSecret', array($this->loadSecret)); |
|
93 | + ->setMethodCalls(array()) |
|
94 | + ->addMethodCall('setSecret', array($this->loadSecret)); |
|
95 | 95 | |
96 | 96 | // Sets Defuse KeyProtectedByPassword. |
97 | 97 | $container->findDefinition('mes_crypto.raw_key') |
98 | - ->setClass('Defuse\Crypto\KeyProtectedByPassword') |
|
99 | - ->setArguments(array($this->loadKey)) |
|
100 | - ->setFactory(array( |
|
101 | - 'Defuse\Crypto\KeyProtectedByPassword', |
|
102 | - 'loadFromAsciiSafeString', |
|
103 | - )); |
|
98 | + ->setClass('Defuse\Crypto\KeyProtectedByPassword') |
|
99 | + ->setArguments(array($this->loadKey)) |
|
100 | + ->setFactory(array( |
|
101 | + 'Defuse\Crypto\KeyProtectedByPassword', |
|
102 | + 'loadFromAsciiSafeString', |
|
103 | + )); |
|
104 | 104 | |
105 | 105 | // Sets the key |
106 | 106 | $this->createKeyDefinition($container, $this->loadSecret); |
@@ -194,23 +194,23 @@ discard block |
||
194 | 194 | |
195 | 195 | // Reads encoded key from configuration file if key is not external. |
196 | 196 | $rawKeyDefinition->setClass($defuseKey) |
197 | - ->setFactory(array( |
|
198 | - $defuseKey, |
|
199 | - 'loadFromAsciiSafeString', |
|
200 | - )); |
|
197 | + ->setFactory(array( |
|
198 | + $defuseKey, |
|
199 | + 'loadFromAsciiSafeString', |
|
200 | + )); |
|
201 | 201 | $rawKeyDefinition->setArguments(array( |
202 | 202 | $keyIsExternal ? $this->loadKey : $key, |
203 | 203 | )); |
204 | 204 | } else { |
205 | 205 | $rawKeyDefinition->setClass($defuseKey) |
206 | - ->setArguments($secretExists ? array($secretIsExternal ? $this->loadSecret : $secret) : array()) |
|
207 | - ->setFactory($secretExists ? array( |
|
208 | - 'Defuse\Crypto\KeyProtectedByPassword', |
|
209 | - 'createRandomPasswordProtectedKey', |
|
210 | - ) : array( |
|
211 | - 'Defuse\Crypto\Key', |
|
212 | - 'createNewRandomKey', |
|
213 | - )); |
|
206 | + ->setArguments($secretExists ? array($secretIsExternal ? $this->loadSecret : $secret) : array()) |
|
207 | + ->setFactory($secretExists ? array( |
|
208 | + 'Defuse\Crypto\KeyProtectedByPassword', |
|
209 | + 'createRandomPasswordProtectedKey', |
|
210 | + ) : array( |
|
211 | + 'Defuse\Crypto\Key', |
|
212 | + 'createNewRandomKey', |
|
213 | + )); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | if (($createRandomKey || (!$createRandomKey && !$keyIsExternal)) && !$this->loaderEnabled) { |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | } |
219 | 219 | |
220 | 220 | $container->setDefinition('mes_crypto.raw_key', $rawKeyDefinition) |
221 | - ->setPublic(false); |
|
221 | + ->setPublic(false); |
|
222 | 222 | |
223 | 223 | // Key |
224 | 224 | $this->createKeyDefinition($container, $secretExists ? ($secretIsExternal ? $this->loadSecret : $secret) : null); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | 'Mes\Security\CryptoBundle\Model\Key', |
247 | 247 | 'create', |
248 | 248 | )) |
249 | - ->setPublic(false); |
|
249 | + ->setPublic(false); |
|
250 | 250 | |
251 | 251 | $container->setDefinition('mes_crypto.key', $keyDefinition); |
252 | 252 | } |
@@ -271,6 +271,6 @@ discard block |
||
271 | 271 | private function setCryptoLoaderResource(ContainerBuilder $container, $resource) |
272 | 272 | { |
273 | 273 | $container->findDefinition('mes_crypto.loader') |
274 | - ->addMethodCall('setResource', array($resource)); |
|
274 | + ->addMethodCall('setResource', array($resource)); |
|
275 | 275 | } |
276 | 276 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $this->assertHasDefinition('mes_crypto.raw_key'); |
44 | 44 | $this->assertSame('Defuse\Crypto\Key', $this->configuration->findDefinition('mes_crypto.raw_key') |
45 | - ->getClass(), 'Defuse\Crypto\Key class is correct'); |
|
45 | + ->getClass(), 'Defuse\Crypto\Key class is correct'); |
|
46 | 46 | |
47 | 47 | $this->assertNotHasDefinition('mes_crypto.loader'); |
48 | 48 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | $this->assertHasDefinition('mes_crypto.raw_key'); |
57 | 57 | $this->assertSame('Defuse\Crypto\KeyProtectedByPassword', $this->configuration->findDefinition('mes_crypto.raw_key') |
58 | - ->getClass(), 'KeyProtectedByPassword class is correct'); |
|
58 | + ->getClass(), 'KeyProtectedByPassword class is correct'); |
|
59 | 59 | |
60 | 60 | $this->assertNotHasDefinition('mes_crypto.loader'); |
61 | 61 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | $this->assertHasDefinition('mes_crypto.raw_key'); |
70 | 70 | $this->assertSame('Defuse\Crypto\KeyProtectedByPassword', $this->configuration->findDefinition('mes_crypto.raw_key') |
71 | - ->getClass(), 'Defuse\Crypto\KeyProtectedByPassword class is correct'); |
|
71 | + ->getClass(), 'Defuse\Crypto\KeyProtectedByPassword class is correct'); |
|
72 | 72 | $this->assertNotHasDefinition('mes_crypto.loader'); |
73 | 73 | } |
74 | 74 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $this->assertHasDefinition('mes_crypto.raw_key'); |
82 | 82 | $this->assertSame('Defuse\Crypto\KeyProtectedByPassword', $this->configuration->findDefinition('mes_crypto.raw_key') |
83 | - ->getClass(), 'Defuse\Crypto\KeyProtectedByPassword class is correct'); |
|
83 | + ->getClass(), 'Defuse\Crypto\KeyProtectedByPassword class is correct'); |
|
84 | 84 | $this->assertHasDefinition('mes_crypto.loader'); |
85 | 85 | } |
86 | 86 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | $this->assertHasDefinition('mes_crypto.raw_key'); |
94 | 94 | $this->assertSame('Defuse\Crypto\KeyProtectedByPassword', $this->configuration->findDefinition('mes_crypto.raw_key') |
95 | - ->getClass(), 'Defuse\Crypto\KeyProtectedByPassword class is correct'); |
|
95 | + ->getClass(), 'Defuse\Crypto\KeyProtectedByPassword class is correct'); |
|
96 | 96 | $this->assertHasDefinition('mes_crypto.loader'); |
97 | 97 | |
98 | 98 | $this->assertSame('custom_key_storage_service', (string) $this->configuration->getAlias('mes_crypto.key_storage'), 'custom_key_storage_service is correct alias'); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | parent::initialize($input, $output); |
64 | 64 | |
65 | 65 | $this->helper = $this->getHelperSet() |
66 | - ->get('question'); |
|
66 | + ->get('question'); |
|
67 | 67 | |
68 | 68 | $this->symfonyStyle = $this->getStyle($input, $output); |
69 | 69 | } |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | protected function configure() |
75 | 75 | { |
76 | 76 | $this->setName('mes:crypto:generate-key') |
77 | - ->setDefinition($this->createDefinition()) |
|
78 | - ->setDescription('Generates an encoded key with or without authentication secret') |
|
79 | - ->setHelp(<<<'EOF' |
|
77 | + ->setDefinition($this->createDefinition()) |
|
78 | + ->setDescription('Generates an encoded key with or without authentication secret') |
|
79 | + ->setHelp(<<<'EOF' |
|
80 | 80 | The <info>%command.name%</info> generates an encoded key with or without authentication secret and optionally it saves the printable key and the secret in a ini format .crypto file. |
81 | 81 | |
82 | 82 | <info>%command.full_name%</info> |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | <info>%command.full_name%</info> --dir /path/to/dir/key.crypto |
87 | 87 | EOF |
88 | - ); |
|
88 | + ); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $this->writeSection($output, 'Generating key'.($secret ? ' with authentication secret' : '').($dir ? " in $dir" : '')); |
166 | 166 | |
167 | 167 | $encodedKey = $keyGenerator->generate($secret) |
168 | - ->getEncoded(); |
|
168 | + ->getEncoded(); |
|
169 | 169 | |
170 | 170 | $this->log($logger, "The encoded key has been generated with the following sequence:\n{$encodedKey}\n", LogLevel::INFO); |
171 | 171 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | |
226 | 226 | /** @var DebugFormatterHelper */ |
227 | 227 | $dh = $this->getHelperSet() |
228 | - ->get('debug_formatter'); |
|
228 | + ->get('debug_formatter'); |
|
229 | 229 | |
230 | 230 | $process = new Process("ls -la {$options['dir']} | grep \".crypto\""); |
231 | 231 |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $random = $this->generator->generateRandomSecret(); |
105 | 105 | $this->symfonyStyle->newLine(); |
106 | 106 | $question = new Question($this->getQuestion('Insert your authentication secret or use this one randomly generated', $random), $random); |
107 | - $question->setValidator(function ($secret) { |
|
107 | + $question->setValidator(function($secret) { |
|
108 | 108 | if (!ctype_print($secret)) { |
109 | 109 | throw new \RuntimeException(sprintf('The authentication secret is not printable', $secret)); |
110 | 110 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $dh->start(spl_object_hash($process), "Find {$options['dir']}", 'START'), |
235 | 235 | )); |
236 | 236 | |
237 | - $process->run(function ($type, $buffer) use ($process, $output, $dh) { |
|
237 | + $process->run(function($type, $buffer) use ($process, $output, $dh) { |
|
238 | 238 | $output->writeln($dh->progress(spl_object_hash($process), $buffer, Process::ERR === $type)); |
239 | 239 | }); |
240 | 240 |