What are Kryptel Components

All cryptographic functions are implemented as isolated components (in C++ and C# implementations they can even be loaded separately). For instance, you can't write new Aes() to create the AES cipher; you need to call the component loader and pass AES cipher's component ID. A simple example code will illustrate this concept better:

IKryptelComponent compAes = (IKryptelComponent)Loader.CreateComponent(CID_CIPHER_AES);

The argument of the CreateComponent function is component ID – a 128-bit unique value (UUID, also known as GUID). See the Guids class for the list of component IDs.

The loader creates a component class and returns its IKryptelComponent interface. This interface is literally component's heart – it allows access to all other component interfaces.

First we will need the cipher's ICipherParams interface to set the encryption key:

ICipherParams aesParams = (ICipherParams)compAes.GetInterface(IID_ICipherParams);

Interface IDs are also 128-bit UUIDs defined in the Guids class. Their names always have the form IID_<interface name>.

After setting the encryption key we will likely need the primary cipher interface:

ICipher aes = (ICipher)compAes.GetInterface(IID_ICipher);

When the work is done, it is a good practice to do a graceful cleanup:


Or you can simply use the try block as all the components support AutoCloseable:

try (IKryptelComponent compAes = (IKryptelComponent)Loader.CreateComponent(CID_CIPHER_AES)) {
  . . .

If you need a more practical component usage example, Computing String HMAC is probably the simplest one.

Other interfaces

In addition to IKryptelComponent interface, which is mandatory for all components, a component must also export IComponentState. The third and the last common component interface IComponentCapabilities is optional and exported only by those components that support feature limitation.