Project

ccrypto

0.0
The project is in a healthy, maintained state
Attempt to have a common crypto for Ruby and Java to take the selection decision out from the application development until further date
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Ccrypto

Ccrypto - Common Crypto is the attempt to normalize cryptography API between Ruby and Java, and possibly other runtime supported by Ruby.

It is rooted in Ruby because of its expressiveness.

This gem is mainly provide high level common elements for the implemented runtime to select a proper implementation.

This including all the classes under the lib/ccrypto/configs/ directory. Those are suppose to be parameter pass to the runtime implementation to pick the required implementation under that runtime.

Note this layer is suppose to be barebone native cryptographic algorithm API which should be just thin wrapper around the runtime cryptographic library

Installation

Add this line to your application's Gemfile:

gem 'ccrypto'

# select runtime
# if Ruby runtime backed by OpenSSL
# https://github.com/cameronian/ccrypto-ruby
gem 'ccrypto-ruby'

# or on Java runtime backed by JCE + bouncycastle
# https://github.com/cameronian/ccrypto-java
gem 'ccrypto-java'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install ccrypto
$ gem install ccrypto-ruby # for Ruby runtime
$ gem install ccrypto-java # for Java runtime

Usage

Detail usage refers to spec files in ccrypto-ruby and ccrypto-java.

Development hint

To add a different provider, runtime implementation requires to implement a provider class that has the following methods:

  • All static method
    • provider_name() - returns string indicating the provider
    • algo_instance(*args,&block) - return specific implementation class for the given arguments
    • asn1_engine(*args, &block) - return ASN1 engine from the runtime for given arguments
    • util_instance(*args, &block) - return utilities from the runtime. For example memory buffer, compression engine, data conversion etc.

In the main entry for the runtime implementation, register this provider by calling:

Ccrypto::Provider.instance.register(<provider class>)

That's it.

Refers to Ccrypto ruby runtime or Ccrypto Java runtime for more info.