high-level ruby library for encryption
Asked Answered
D

5

7

It seems like the most established ones like keyczar, cryptlib and NaCl are not available for Ruby. What are some ruby libraries (or bindings) for a high-level library where decisions about cryptographic primitives have been made for you (no need to generate IVs, CBC vs EBC etc.). I did find ruby-gpgme. There's also libmcrypt which has support for symmetric encryption of streams which is what I am ultimately interested in.

Doubling answered 10/3, 2012 at 6:28 Comment(0)
A
6

NaCl is now (1.0.0 of the gem was published some days ago) available for Ruby through RbNaCl (which uses libsodium, "portable, cross-compilable, installable, packageable, API-compatible version of NaCl"). There is also krypt.

Abutting answered 10/3, 2013 at 0:29 Comment(0)
S
1

Why not OpenSSL?

It is part of the standard libary:

http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/index.html

Setzer answered 10/3, 2012 at 6:34 Comment(1)
It provides primitives, not really plug-and-play. Besides it's easy to make a mistake. That's why there are high-level crypto libraries.Doubling
A
1

ruby-mcrypt, last commit is from two years ago. You might be better off with OpenSSL and some tests to check any mistakes in your code.

Assort answered 16/3, 2012 at 20:15 Comment(1)
I didn't mean implementation mistakes but wrong decisions about crypto. For example, choosing the wrong cipher mode, using Random instead of SecureRandom etc. These kind of mistakes are hard to spot even through code review. In the case of mcrypt - yes, I should probably just use OpenSSL's ciphers. There's not much I can mess up :)Doubling
S
0

Since Keyczar is a Java library, you should be able to use it by either running JRuby or by accessing it with RJB ( http://rjb.rubyforge.org/ ) from plain old Ruby. It doesn't look like there are any extremely simple interfaces to it or documentation on using it in JRuby, but the Keyczar API is pretty simple and it may not be hard to integrate.

Standstill answered 14/11, 2012 at 17:26 Comment(0)
L
0

There is a plug'n'play library providing some cryptographic services in a very easy-to-use manner for Ruby, it's called Themis (gem rubythemis, more info @ https://www.github.com/cossacklabs/themis).

Disclaimer: I'm one of the contributors in this library and am very interested to draw more attention from Ruby community to it to make it more suitable to Ruby people: we understand how Ruby hold completely different patterns and methods of working with external libraries and would like to hear any feedback and advise - for now it just works, but the beauty factor is left aside :)

Legation answered 4/10, 2015 at 12:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.