@@ -92,7 +92,7 @@ |
||
92 | 92 | |
93 | 93 | // rawKey is locked and become instance of \Defuse\Crypto\Key. |
94 | 94 | $this->rawKey = $this->getRawKey() |
95 | - ->unlockKey($this->getSecret()); |
|
95 | + ->unlockKey($this->getSecret()); |
|
96 | 96 | |
97 | 97 | return $this; |
98 | 98 | } |
@@ -99,7 +99,7 @@ |
||
99 | 99 | * @var FormatterHelper |
100 | 100 | */ |
101 | 101 | $formatter = $this->getHelperSet() |
102 | - ->get('formatter'); |
|
102 | + ->get('formatter'); |
|
103 | 103 | |
104 | 104 | $output->writeln(array( |
105 | 105 | '', |
@@ -26,13 +26,13 @@ |
||
26 | 26 | protected function configure() |
27 | 27 | { |
28 | 28 | $this->setName('mes:crypto:generate-secret') |
29 | - ->setDescription('Generates an authentication secret') |
|
30 | - ->setHelp(<<<'EOF' |
|
29 | + ->setDescription('Generates an authentication secret') |
|
30 | + ->setHelp(<<<'EOF' |
|
31 | 31 | The <info>%command.name%</info> generates an authentication secret. |
32 | 32 | |
33 | 33 | <info>%command.full_name%</info> |
34 | 34 | EOF |
35 | - ); |
|
35 | + ); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $rootNode = $treeBuilder->root('mes_crypto'); |
32 | 32 | |
33 | 33 | $rootNode |
34 | - ->children() |
|
34 | + ->children() |
|
35 | 35 | ->arrayNode('key') |
36 | 36 | ->addDefaultsIfNotSet() |
37 | 37 | ->children() |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | ->info('your_encryption_service_id. Default: Mes Encryption.') |
99 | 99 | ->defaultNull() |
100 | 100 | ->end() |
101 | - ->end() |
|
101 | + ->end() |
|
102 | 102 | ; |
103 | 103 | |
104 | 104 | return $treeBuilder; |
@@ -34,7 +34,7 @@ |
||
34 | 34 | $this->keyStorage->setKey($key); |
35 | 35 | |
36 | 36 | $this->assertInstanceOf('Defuse\Crypto\KeyProtectedByPassword', $this->keyStorage->getKey() |
37 | - ->getRawKey()); |
|
37 | + ->getRawKey()); |
|
38 | 38 | $this->assertSame($secret, $this->keyStorage->getKey() |
39 | 39 | ->getSecret()); |
40 | 40 | } |
@@ -49,6 +49,6 @@ |
||
49 | 49 | private function unlockKey(Key $key) |
50 | 50 | { |
51 | 51 | return $key->unlock() |
52 | - ->getRawKey(); |
|
52 | + ->getRawKey(); |
|
53 | 53 | } |
54 | 54 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | parent::initialize($input, $output); |
42 | 42 | |
43 | 43 | $this->helper = $this->getHelperSet() |
44 | - ->get('question'); |
|
44 | + ->get('question'); |
|
45 | 45 | |
46 | 46 | $this->symfonyStyle = $this->getStyle($input, $output); |
47 | 47 | } |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | protected function configure() |
50 | 50 | { |
51 | 51 | $this->setName('mes:crypto:generate-key') |
52 | - ->setDefinition($this->createDefinition()) |
|
53 | - ->setDescription('Generates an encoded key with or without authentication secret') |
|
54 | - ->setHelp(<<<'EOF' |
|
52 | + ->setDefinition($this->createDefinition()) |
|
53 | + ->setDescription('Generates an encoded key with or without authentication secret') |
|
54 | + ->setHelp(<<<'EOF' |
|
55 | 55 | 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. |
56 | 56 | |
57 | 57 | <info>%command.full_name%</info> |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | <info>%command.full_name%</info> --dir /path/to/dir/key.crypto |
62 | 62 | EOF |
63 | - ); |
|
63 | + ); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | protected function interact(InputInterface $input, OutputInterface $output) |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $this->writeSection($output, 'Generating key'.($secret ? ' with authentication secret' : '').($dir ? " in $dir" : '')); |
134 | 134 | |
135 | 135 | $encodedKey = $keyGenerator->generate($secret) |
136 | - ->getEncoded(); |
|
136 | + ->getEncoded(); |
|
137 | 137 | |
138 | 138 | $this->log($logger, "The encoded key has been generated with the following sequence:\n{$encodedKey}\n", LogLevel::INFO); |
139 | 139 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @var DebugFormatterHelper |
198 | 198 | */ |
199 | 199 | $dh = $this->getHelperSet() |
200 | - ->get('debug_formatter'); |
|
200 | + ->get('debug_formatter'); |
|
201 | 201 | |
202 | 202 | $process = new Process("ls -la {$options['dir']} | grep \".crypto\""); |
203 | 203 |
@@ -129,23 +129,23 @@ discard block |
||
129 | 129 | |
130 | 130 | // Reads encoded key from configuration file if key is not external. |
131 | 131 | $rawKeyDefinition->setClass($defuseKey) |
132 | - ->setFactory(array( |
|
133 | - $defuseKey, |
|
134 | - 'loadFromAsciiSafeString', |
|
135 | - )); |
|
132 | + ->setFactory(array( |
|
133 | + $defuseKey, |
|
134 | + 'loadFromAsciiSafeString', |
|
135 | + )); |
|
136 | 136 | $rawKeyDefinition->setArguments(array( |
137 | 137 | $keyIsExternal ? $loadKey : $key, |
138 | 138 | )); |
139 | 139 | } else { |
140 | 140 | $rawKeyDefinition->setClass($defuseKey) |
141 | - ->setArguments($secretExists ? array($secretIsExternal ? $loadSecret : $secret) : array()) |
|
142 | - ->setFactory($secretExists ? array( |
|
143 | - 'Defuse\Crypto\KeyProtectedByPassword', |
|
144 | - 'createRandomPasswordProtectedKey', |
|
145 | - ) : array( |
|
146 | - 'Defuse\Crypto\Key', |
|
147 | - 'createNewRandomKey', |
|
148 | - )); |
|
141 | + ->setArguments($secretExists ? array($secretIsExternal ? $loadSecret : $secret) : array()) |
|
142 | + ->setFactory($secretExists ? array( |
|
143 | + 'Defuse\Crypto\KeyProtectedByPassword', |
|
144 | + 'createRandomPasswordProtectedKey', |
|
145 | + ) : array( |
|
146 | + 'Defuse\Crypto\Key', |
|
147 | + 'createNewRandomKey', |
|
148 | + )); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | if ($createRandomKey || (!$createRandomKey && !$keyIsExternal)) { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | $container->setDefinition('mes_crypto.raw_key', $rawKeyDefinition) |
156 | - ->setPublic(false); |
|
156 | + ->setPublic(false); |
|
157 | 157 | |
158 | 158 | // Key |
159 | 159 | $keyDefinition = new Definition('Mes\Security\CryptoBundle\Model\Key', array( |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | 'create', |
166 | 166 | )); |
167 | 167 | $container->setDefinition('mes_crypto.key', $keyDefinition) |
168 | - ->setPublic(false); |
|
168 | + ->setPublic(false); |
|
169 | 169 | |
170 | 170 | $keyManagerDefinition = $container->getDefinition('mes_crypto.key_manager_wrapper'); |
171 | 171 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | private function setCryptoLoaderResource(ContainerBuilder $container, $resource) |
201 | 201 | { |
202 | 202 | $container->getDefinition('mes_crypto.crypto_loader') |
203 | - ->replaceArgument(0, $resource); |
|
203 | + ->replaceArgument(0, $resource); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | protected function setUp() |
37 | 37 | { |
38 | 38 | $this->keyManager = $this->getMockBuilder('\Mes\Security\CryptoBundle\KeyManagerInterface') |
39 | - ->getMock(); |
|
39 | + ->getMock(); |
|
40 | 40 | $this->wrapper = new KeyManagerWrapper($this->keyManager); |
41 | 41 | } |
42 | 42 | |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | public function testGenerateCreatesKey() |
49 | 49 | { |
50 | 50 | $this->keyManager->expects($this->once()) |
51 | - ->method('generate') |
|
52 | - ->with(null) |
|
53 | - ->will($this->returnValue($this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'))); |
|
51 | + ->method('generate') |
|
52 | + ->with(null) |
|
53 | + ->will($this->returnValue($this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'))); |
|
54 | 54 | |
55 | 55 | $key = $this->wrapper->generate(); |
56 | 56 | |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | { |
65 | 65 | try { |
66 | 66 | $this->keyManager->expects($this->once()) |
67 | - ->method('generate') |
|
68 | - ->with(null) |
|
69 | - ->will($this->throwException(new EnvironmentIsBrokenException())); |
|
67 | + ->method('generate') |
|
68 | + ->with(null) |
|
69 | + ->will($this->throwException(new EnvironmentIsBrokenException())); |
|
70 | 70 | } catch (EnvironmentIsBrokenException $ex) { |
71 | 71 | $this->throwException(new CryptoException()); |
72 | 72 | } |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | $secret = 'ThisIsASecretPassword'; |
81 | 81 | |
82 | 82 | $this->keyManager->expects($this->once()) |
83 | - ->method('generateFromAscii') |
|
84 | - ->with($key_encoded, $secret) |
|
85 | - ->will($this->returnValue($this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'))); |
|
83 | + ->method('generateFromAscii') |
|
84 | + ->with($key_encoded, $secret) |
|
85 | + ->will($this->returnValue($this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'))); |
|
86 | 86 | |
87 | 87 | $key = $this->wrapper->generateFromAscii($key_encoded, $secret); |
88 | 88 | |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | |
100 | 100 | try { |
101 | 101 | $this->keyManager->expects($this->once()) |
102 | - ->method('generateFromAscii') |
|
103 | - ->with($key_encoded, $secret) |
|
104 | - ->will($this->throwException(new BaseCryptoException())); |
|
102 | + ->method('generateFromAscii') |
|
103 | + ->with($key_encoded, $secret) |
|
104 | + ->will($this->throwException(new BaseCryptoException())); |
|
105 | 105 | } catch (CryptoException $ex) { |
106 | 106 | $this->throwException(new CryptoException()); |
107 | 107 | } |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | public function testGetKeyReadsKey() |
113 | 113 | { |
114 | 114 | $this->keyManager->expects($this->once()) |
115 | - ->method('getKey') |
|
116 | - ->will($this->returnValue($this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'))); |
|
115 | + ->method('getKey') |
|
116 | + ->will($this->returnValue($this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'))); |
|
117 | 117 | |
118 | 118 | $key = $this->wrapper->getKey(); |
119 | 119 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | public function testSetKeyStoresKey() |
124 | 124 | { |
125 | 125 | $this->keyManager->expects($this->once()) |
126 | - ->method('setKey') |
|
127 | - ->with($this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface')); |
|
126 | + ->method('setKey') |
|
127 | + ->with($this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface')); |
|
128 | 128 | |
129 | 129 | $this->wrapper->setKey($this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface')); |
130 | 130 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | public function testSetSecretStoresSecret() |
133 | 133 | { |
134 | 134 | $this->keyManager->expects($this->once()) |
135 | - ->method('setSecret') |
|
136 | - ->with('ThisIsASecret'); |
|
135 | + ->method('setSecret') |
|
136 | + ->with('ThisIsASecret'); |
|
137 | 137 | |
138 | 138 | $this->wrapper->setSecret('ThisIsASecret'); |
139 | 139 | } |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | public function testGetSecretReadsSecret() |
142 | 142 | { |
143 | 143 | $this->keyManager->expects($this->once()) |
144 | - ->method('getSecret') |
|
145 | - ->will($this->returnValue('ThisIsYourSecret')); |
|
144 | + ->method('getSecret') |
|
145 | + ->will($this->returnValue('ThisIsYourSecret')); |
|
146 | 146 | |
147 | 147 | $secret = $this->wrapper->getSecret(); |
148 | 148 |