@@ 373-381 (lines=9) @@ | ||
370 | * @throws \RuntimeException If encrypt fails |
|
371 | * @return string |
|
372 | */ |
|
373 | protected function _encrypt($kek, $block) { |
|
374 | $str = openssl_encrypt($block, $this->_cipherMethod(), $kek, |
|
375 | OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); |
|
376 | if (false === $str) { |
|
377 | throw new \RuntimeException( |
|
378 | "openssl_encrypt() failed: " . $this->_getLastOpenSSLError()); |
|
379 | } |
|
380 | return $str; |
|
381 | } |
|
382 | ||
383 | /** |
|
384 | * Apply AES-1(K, W) operation (decrypt) to 64 bit block. |
|
@@ 391-399 (lines=9) @@ | ||
388 | * @throws \RuntimeException If decrypt fails |
|
389 | * @return string |
|
390 | */ |
|
391 | protected function _decrypt($kek, $block) { |
|
392 | $str = openssl_decrypt($block, $this->_cipherMethod(), $kek, |
|
393 | OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); |
|
394 | if (false === $str) { |
|
395 | throw new \RuntimeException( |
|
396 | "openssl_decrypt() failed: " . $this->_getLastOpenSSLError()); |
|
397 | } |
|
398 | return $str; |
|
399 | } |
|
400 | ||
401 | /** |
|
402 | * Get latest OpenSSL error message. |