emboss edited this page Dec 6, 2011 · 10 revisions
Clone this wiki locally


krypt's architecture consists of three parts, the krypt, krypt-core and krypt-core-C APIs:

krypt architecture

krypt API

The krypt API covers the higher-level functionality, it offers an API similar to the OpenSSL extension today. It is implemented entirely in Ruby and shall be shared among all Ruby implementations.

krypt-core API

It comprises lower-level primitives such as symmetric and asymmetric algorithms, message digests and ASN.1 parsing/encoding. The API offers a pre-defined Ruby interface that is used by the higher-level krypt API implementation. To guarantee maximum performance, the krypt-core API implementation will be mostly using native code in first instance. There are two implementations, a C-based one for all C-based Rubies and a Java-based one for JRuby.

krypt-core-C API

It defines an interface on the C level. The motivation is that this level of modularity will ensure that only one C implementation of the krypt-core API is needed and that all implementation-specific details can be encapsulated and hidden in the implementations of krypt-core-C. It also minimizes the effort needed to implement an alternative. All that is needed is to implement a few functions in C, the glue code between C and Ruby is already provided in the C implementation of krypt-core. The default implementation will use OpenSSL to implement krypt-core-C, but numerous alternatives using the cryptography stack that is available by default on a given OS are feasible.