@@ 383-391 (lines=9) @@ | ||
380 | * @throws \RuntimeException If encrypt fails |
|
381 | * @return string |
|
382 | */ |
|
383 | protected function _encrypt($kek, $block) { |
|
384 | $str = openssl_encrypt($block, $this->_cipherMethod(), $kek, |
|
385 | OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); |
|
386 | if (false === $str) { |
|
387 | throw new \RuntimeException( |
|
388 | "openssl_encrypt() failed: " . $this->_getLastOpenSSLError()); |
|
389 | } |
|
390 | return $str; |
|
391 | } |
|
392 | ||
393 | /** |
|
394 | * Apply AES-1(K, W) operation (decrypt) to 64 bit block. |
|
@@ 401-409 (lines=9) @@ | ||
398 | * @throws \RuntimeException If decrypt fails |
|
399 | * @return string |
|
400 | */ |
|
401 | protected function _decrypt($kek, $block) { |
|
402 | $str = openssl_decrypt($block, $this->_cipherMethod(), $kek, |
|
403 | OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); |
|
404 | if (false === $str) { |
|
405 | throw new \RuntimeException( |
|
406 | "openssl_decrypt() failed: " . $this->_getLastOpenSSLError()); |
|
407 | } |
|
408 | return $str; |
|
409 | } |
|
410 | ||
411 | /** |
|
412 | * Get the latest OpenSSL error message. |