Forum: Ruby on Rails Encrypting files

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F28f75d17a0c236e079c6ebbb8fff2b9?d=identicon&s=25 Mark Haliday (markh)
on 2005-12-17 21:10
Anyone know of a good (fast) way to encrypt/decrypt uploaded files in
RoR?  I've seen this project: http://ezcrypto.rubyforge.org/  but it
only seems to encrypt strings and such.  I need to encrypt files once
they are uploaded, then decrypt them when they request the file back.

Any ideas?

Thanks,

Mark
8e44c65ac5b896da534ef2440121c953?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2005-12-17 23:01
(Received via mailing list)
On Dec 17, 2005, at 12:10 PM, Mark Haliday wrote:

>
Mark-

	If you want to do this one way I can think of is the use the
ezcrypto lib you found and with a few other steps you could make it
work. What you could do is once the file is uploaded, read it into a
string and Base64 encode it before it goes in the db or on the
filesystem. Then when it comes time to send the file down to a user
again, you can read it in and unencode it form base64 and then
decrypt it and use send_file or send_data to get it to the browser.

	There might be a much better way to do this with less overhead but
this is one way.

Cheers-

-Ezra Zygmuntowicz
WebMaster
Yakima Herald-Republic Newspaper
ezra@yakima-herald.com
509-577-7732
4bd34a2216dc8bdbf1f017f64e4d59e8?d=identicon&s=25 Kyle Maxwell (Guest)
on 2005-12-17 23:46
(Received via mailing list)
OpenSSL is in the Ruby standard library.  Here's a blog with some
sample usage:
http://weblog.masukomi.org/index.pl/view/encryptio...
This topic is locked and can not be replied to.