# Encrypting Backups

**URL:** <https://community.open-emr.org/t/encrypting-backups/6063>\
**Category:** OpenEMR Development\
**Created:** [August 9, 2011, 3:02am UTC](https://community.open-emr.org/t/encrypting-backups/6063 "2011-08-09T03:02:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [August 9, 2011, 3:02am UTC](https://community.open-emr.org/t/encrypting-backups/6063/1 "2011-08-09T03:02:19Z")

</div>

**[sunsetsystems](https://sourceforge.net/u/sunsetsystems/)** wrote on [Tuesday, August 09, 2011](https://sourceforge.net/p/openemr/discussion/202506/thread/7111c66d/#7039):

Client wants backups to be encrypted with AES-256.&nbsp; PHP 5.3.0 and above can do that with its openssl functions, but only for strings, not files, and it seems impractical to load up a string that is always huge and can be arbitrarily large.&nbsp; So I guess I’ll have it (backup.php) optionally exec openssl externally, unless someone has a better idea?&nbsp; Obviously this requires having the openssl utility installed.

Thought I’d bring this up before submitting code for review. 🙂

Rod  
[www.sunsetsystems.com](http://www.sunsetsystems.com)

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [August 9, 2011, 4:11am UTC](https://community.open-emr.org/t/encrypting-backups/6063/2 "2011-08-09T04:11:40Z")

</div>

**[stephen-smith](https://sourceforge.net/u/stephen-smith/)** wrote on [Tuesday, August 09, 2011](https://sourceforge.net/p/openemr/discussion/202506/thread/7111c66d/#f009):

Are we still even pretending to support PHP 4?&nbsp; If so, make sure code that need PHP 5.3 has the proper conditionals around it.

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [August 9, 2011, 4:23am UTC](https://community.open-emr.org/t/encrypting-backups/6063/3 "2011-08-09T04:23:02Z")

</div>

**[sunsetsystems](https://sourceforge.net/u/sunsetsystems/)** wrote on [Tuesday, August 09, 2011](https://sourceforge.net/p/openemr/discussion/202506/thread/7111c66d/#4abe):

function\_exists() is handy for that, not a problem.&nbsp; But not an issue if I don’t use the function anyway.

Rod  
[www.sunsetsystems.com](http://www.sunsetsystems.com)

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [August 9, 2011, 6:30am UTC](https://community.open-emr.org/t/encrypting-backups/6063/4 "2011-08-09T06:30:53Z")

</div>

**[tmccormi](https://sourceforge.net/u/tmccormi/)** wrote on [Tuesday, August 09, 2011](https://sourceforge.net/p/openemr/discussion/202506/thread/7111c66d/#317d):

Another option is to make the backup directory an encrypted file system partition.&nbsp; Using TrueCrypt is a good option for this.  
-Tony

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [August 9, 2011, 3:50pm UTC](https://community.open-emr.org/t/encrypting-backups/6063/5 "2011-08-09T15:50:36Z")

</div>

**[sunsetsystems](https://sourceforge.net/u/sunsetsystems/)** wrote on [Tuesday, August 09, 2011](https://sourceforge.net/p/openemr/discussion/202506/thread/7111c66d/#ce38):

Thanks Tony, TrueCrypt is a nice tool, not quite what’s wanted in this case though.

Rod  
[www.sunsetsystems.com](http://www.sunsetsystems.com)

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [August 9, 2011, 4:40pm UTC](https://community.open-emr.org/t/encrypting-backups/6063/6 "2011-08-09T16:40:41Z")

</div>

**[sunsetsystems](https://sourceforge.net/u/sunsetsystems/)** wrote on [Tuesday, August 09, 2011](https://sourceforge.net/p/openemr/discussion/202506/thread/7111c66d/#a776):

Here’s one easy and flexible way to do it.&nbsp; Make a global parameter that is itself the encryption command to be EXEC’d, key and all.&nbsp; If you choose encryption, backup.php would run it through sprintf() to plug in its temporary file names, and then exec().&nbsp; A sample parameter:

openssl aes-256-ecb -in %s -out %s -K 3132333435363738313233343536373831323334353637383132333435363738

That way just about any encryption command or script could be invoked, and the default would only need the key to be fixed.

Rod  
[www.sunsetsystems.com](http://www.sunsetsystems.com)

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [August 9, 2011, 5:13pm UTC](https://community.open-emr.org/t/encrypting-backups/6063/7 "2011-08-09T17:13:42Z")

</div>

**[tmccormi](https://sourceforge.net/u/tmccormi/)** wrote on [Tuesday, August 09, 2011](https://sourceforge.net/p/openemr/discussion/202506/thread/7111c66d/#d3d9):

Does that work for windows installations?  
-Tony
