| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public function open(string $box_bin, string $nonce_bin):CryptoBoxInterface{ |
||
| 34 | $this->checkKeypair(SODIUM_CRYPTO_BOX_SECRETKEYBYTES); |
||
| 35 | |||
| 36 | $this->message = sodium_crypto_secretbox_open($box_bin, $nonce_bin, $this->keypair->secret); |
||
| 37 | |||
| 38 | if($this->message === false){ |
||
| 39 | throw new CryptoException('invalid box'); |
||
| 40 | } |
||
| 41 | |||
| 42 | return $this; |
||
| 43 | } |
||
| 46 |