<commit_before>## How to decrypt

The encryption script `/var/lib/nc-backup-py/encryption/encryption.py` is also used for decryption.

### Decrypting a single file:

* The backup files are encrypted with keys located at `/etc/nc-backup-py/key_file`.

* Download the files to you computer (ex:`/opt/backup/restore`)
  ```bash
  $ mkdir -p /opt/backup/restore # If /opt/backup/restore is not present
  $ aws s3 cp s3://cnc-bj-backup/srv-nc-bj-zabbix-qa1/20160705_042923.tar.gz.crypt.000 /opt/backup/restore
  ```

* Restore using the following command. Here `20171106_105027.tar.gz` is the decrypted tar archive.
  ```bash
  # Execute the decryption command:
  # For a encrypted archive "20160705_042923.tar.gz.crypt.000"
  $ ls
  $ 20160705_042923.tar.gz.crypt.000
  $ python /var/lib/nc-backup-py/encryption/encryption.py -d \<commit_msg>Update docs.<commit_after>## How to decrypt

The encryption script `/var/lib/nc-backup-py/encryption/encryption.py` is also used for decryption.

### Decrypting a single file:

* The backup files are encrypted with keys located at `/etc/nc-backup-py/key_file`.

* Download the files to you computer (ex:`/opt/backup/restore`)
  ```bash
  $ mkdir -p /opt/backup/restore # If /opt/backup/restore is not present
  $ aws s3 cp s3://cnc-bj-backup/srv-nc-bj-zabbix-qa1/20160705_042923.tar.gz.crypt.000 /opt/backup/restore
  ```

* Optionally you can change the user to ncbackup to use the same permissions as used during encryption, but this is not necessary.
  ```
  # su - ncbackup -s bin/bash
  ```

* Restore using the following command. Here `20171106_105027.tar.gz` is the decrypted tar archive.
  ```bash
  # Execute the decryption command:
  # For a encrypted archive "20160705_042923.tar.gz.crypt.000"
  $ ls
  $ 20160705_042923.tar.gz.crypt.000
  $ python /var/lib/nc-backup-py/encryption/encryption.py -d \
{'fraction_non_alphanumeric': 0.12439156300703083, 'fraction_numerical': 0.07355327203893997, 'mean_word_length': 3.636591478696742, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '762833', 'n_tokens_mistral': 749, 'n_tokens_neox': 649, 'n_words': 177}