@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | class Signer |
| 34 | 34 | { |
| 35 | - private static $canonical = [false,false,null,null]; |
|
| 35 | + private static $canonical = [false, false, null, null]; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Make Signature tag |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $tagname = '', |
| 52 | 52 | $mark = 'Id', |
| 53 | 53 | $algorithm = OPENSSL_ALGO_SHA1, |
| 54 | - $canonical = [false,false,null,null], |
|
| 54 | + $canonical = [false, false, null, null], |
|
| 55 | 55 | $rootname = '' |
| 56 | 56 | ) { |
| 57 | 57 | if (!empty($canonical)) { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | 'Tag not found ' . $tagname . ' ' . $rootname |
| 72 | 72 | ); |
| 73 | 73 | } |
| 74 | - if (! self::existsSignature($dom)) { |
|
| 74 | + if (!self::existsSignature($dom)) { |
|
| 75 | 75 | $dom = self::createSignature( |
| 76 | 76 | $certificate, |
| 77 | 77 | $dom, |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | DOMElement $node, |
| 138 | 138 | $mark, |
| 139 | 139 | $algorithm = OPENSSL_ALGO_SHA1, |
| 140 | - $canonical = [false,false,null,null] |
|
| 140 | + $canonical = [false, false, null, null] |
|
| 141 | 141 | ) { |
| 142 | 142 | $nsDSIG = 'http://www.w3.org/2000/09/xmldsig#'; |
| 143 | 143 | $nsCannonMethod = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315'; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $nsSignatureMethod = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'; |
| 150 | 150 | $nsDigestMethod = 'http://www.w3.org/2001/04/xmlenc#sha256'; |
| 151 | 151 | } |
| 152 | - $nsTransformMethod1 ='http://www.w3.org/2000/09/xmldsig#enveloped-signature'; |
|
| 152 | + $nsTransformMethod1 = 'http://www.w3.org/2000/09/xmldsig#enveloped-signature'; |
|
| 153 | 153 | $nsTransformMethod2 = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315'; |
| 154 | 154 | $idSigned = trim($node->getAttribute($mark)); |
| 155 | 155 | $digestValue = self::makeDigest($node, $digestAlgorithm, $canonical); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | { |
| 251 | 251 | $node = $dom->getElementsByTagName($tagname)->item(0); |
| 252 | 252 | if (empty($node)) { |
| 253 | - throw new \RuntimeException('Tag not found ' .$tagname); |
|
| 253 | + throw new \RuntimeException('Tag not found ' . $tagname); |
|
| 254 | 254 | } |
| 255 | 255 | $signature = $dom->getElementsByTagName('Signature')->item(0); |
| 256 | 256 | if (empty($signature)) { |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * @param array $canonical |
| 288 | 288 | * @return string |
| 289 | 289 | */ |
| 290 | - private static function makeDigest(DOMElement $node, $algorithm, $canonical = [false,false,null,null]) |
|
| 290 | + private static function makeDigest(DOMElement $node, $algorithm, $canonical = [false, false, null, null]) |
|
| 291 | 291 | { |
| 292 | 292 | //calcular o hash dos dados |
| 293 | 293 | $c14n = $node->C14N( |
@@ -374,9 +374,9 @@ discard block |
||
| 374 | 374 | ); |
| 375 | 375 | } |
| 376 | 376 | $this->certsdir = $this->certificate->getCnpj() . '/certs/'; |
| 377 | - $this->prifile = $this->certsdir. Strings::randomString(10).'.pem'; |
|
| 378 | - $this->pubfile = $this->certsdir . Strings::randomString(10).'.pem'; |
|
| 379 | - $this->certfile = $this->certsdir . Strings::randomString(10).'.pem'; |
|
| 377 | + $this->prifile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
| 378 | + $this->pubfile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
| 379 | + $this->certfile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
| 380 | 380 | $ret = true; |
| 381 | 381 | //cria uma senha temporária ALEATÓRIA para salvar a chave primaria |
| 382 | 382 | //portanto mesmo que localizada e identificada não estará acessível |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | //utilize a API. Outra solução para remover arquivos "perdidos" pode ser |
| 424 | 424 | //encontrada oportunamente. |
| 425 | 425 | $dt = new \DateTime(); |
| 426 | - $tint = new \DateInterval("PT".$this->waitingTime."M"); |
|
| 426 | + $tint = new \DateInterval("PT" . $this->waitingTime . "M"); |
|
| 427 | 427 | $tint->invert = true; |
| 428 | 428 | $tsLimit = $dt->add($tint)->getTimestamp(); |
| 429 | 429 | foreach ($contents as $item) { |