Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
37 | public function open(string $box_bin):CryptoBoxInterface{ |
||
38 | $this->checkKeypair(null, SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES); |
||
39 | |||
40 | $this->message = sodium_crypto_sign_open($box_bin, $this->keypair->public); |
||
41 | |||
42 | sodium_memzero($box_bin); |
||
43 | |||
44 | if($this->message !== false){ |
||
45 | return $this; |
||
46 | } |
||
47 | |||
48 | throw new CryptoException('invalid box'); // @codeCoverageIgnore |
||
49 | } |
||
52 |