| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | private function generateNonce() |
||
| 36 | { |
||
| 37 | if (! $this->browser->supportNonceSource()) { |
||
| 38 | $this->nonce = static::UNSUPPORTED_BROWSER_NONCE; |
||
| 39 | return; |
||
| 40 | } |
||
| 41 | |||
| 42 | $length = 16; |
||
| 43 | $usable = true; |
||
| 44 | $bytes = openssl_random_pseudo_bytes($length, $usable); |
||
| 45 | if ($usable === false) { |
||
| 46 | // weak |
||
| 47 | // @TODO do something? |
||
| 48 | } |
||
| 49 | |||
| 50 | $this->nonce = base64_encode($bytes); |
||
| 51 | } |
||
| 52 | |||
| 65 |