API Reference | developer.brewmp.com API Reference | developer.brewmp.com


API Reference


Brew Release
Brew MP 1.0.2
See Also

This interface is deprecated. Refer to the IPubKey interface instead.
This interface provides access to the RSA public key cryptographic algorithm and the basic underlying modular exponentiation. It also provides some of the padding and encoding commonly used with the RSA algorithm. Last it is modestly useful for managing memory in which keys are stored. For details on the algorithm itself and its uses see a good cryptography text book. If you are not familiar with RSA this is highly recommended.
Some platforms offer support for hardware based modular exponentiation.
Required header file: AEERSA.h
Software based RSA operations can take a long time and the time varies depending on the modulus/key size and the exponent. On most handsets, the public operations encrypt and verify will perform reasonably fast. The private operations, sign and decrypt, will take prohibitively long and performing them in software is discouraged. This is because public keys usually have a small well chosen exponent such as 3 or 2^16+1. For example keys in X.509 certificates typically use the exponent 2^16+1.
Typical use involves instantiating an IRSA with the usual call to ISHELL_CreateInstance(). The key material is added to the IRSA instance by calling IRSA_Init(). Then any of the RSA operations may be performed including modular exponentiation, encrypting, decrypting and signature verification. A separate interface for signing is not provided because it is the same as encrypt.
The data to be encrypted must be less than the modulus. In other words, when using MEMCMP on the data and modulus buffers, the modulus must be bigger. RSA algorithm can only be applied when data is less than modulus.
The IRSA_RSA() function is supported, but not recommended because it is a blocking synchronous function that doesn't support cancelling. The other functions take a call back record and are non-blocking. The callback is called when the operation is complete. The callback also allows the operation to be cancelled. It also allows the handset to process other events such as key presses while the RSA calculation is going on.
An operation that takes a callback can be cancelled anytime by calling CALLBACK_Cancel() on that callback. The processing yields to the main Brew event loop periodically. This allows cancel requests to be processed and other scheduled events to be processed.
An IRSA instance is a ref counted object that stores an RSA key.
The returns codes for IRSA functions are described below with each function. The IRSA functions may also return other BREW error codes, so the caller must take proper precautions dealing with them.
Finally a few notes on what is absent. There is no key generation. This would be extremely slow in software, but might be acceptable on a DSP. There is no way to retrieve a key once stored. Some of the modern padding types, OEAP and PSS in particular, are not available. There is also no way to store a full private/public key pair to enable faster private key operations using the Chinese Remainder Theorem.
This interface is deprecated. Refer to the IPubKey interface instead.