You are here

public function BaseMethod::encryptFile in DRD Agent 8.3

Same name and namespace in other branches
  1. 4.0.x src/Crypt/BaseMethod.php \Drupal\drd_agent\Crypt\BaseMethod::encryptFile()

Encrypt a file.

Parameters

string $filename: Filename which should be encrypted.

Return value

string Filename of the encrypted version.

Overrides BaseMethodInterface::encryptFile

File

src/Crypt/BaseMethod.php, line 71

Class

BaseMethod
Provides base encryption method.

Namespace

Drupal\drd_agent\Crypt

Code

public function encryptFile($filename) : string {
  if ($this
    ->getCipher()) {
    exec('openssl version', $output, $ret);
    if ($ret === 0) {
      $in = $filename;
      $filename .= '.openssl';
      if ($this
        ->cryptFileExecute('-e', $in, $filename) !== 0) {
        $filename = $in;
      }
    }
  }
  return $filename;
}