Retrieves the key values and their lengths from an RSA private and/or public key object.
#include "hursa.h"
int hu_RSAKeyGet(sb_Params rsaParams, sb_PrivateKey privateKey, sb_PublicKey publicKey, size_t *eLen, unsigned char *e, size_t *nLen, unsigned char *n, size_t *dLen, unsigned char *d, size_t *pLen, unsigned char *p, size_t *qLen, unsigned char *q, size_t *dModPLen, unsigned char *dModPm1, size_t *dModQLen, unsigned char *dModQm1, size_t *qInvLen, unsigned char *qInvModP, sb_GlobalCtx sbCtx)
BlackBerry 10.0.0
An RSA parameters object.
An RSA private key object.
An RSA public key object.
The length (in bytes) of the public exponent.
The public exponent.
The length (in bytes) of the modulus.
Modulus.
The length (in bytes) of the private exponent. (This is the same as nLen.)
The private exponent.
The length (in bytes) of the first prime p.
First large prime factor of the modulus.
The length (in bytes) of the second prime q.
Second large prime factor of the modulus.
The length (in bytes) of the d mod p-1 CRT coefficient. (This is the same as pLen.)
d mod p-1 CRT coefficient.
The length (in bytes) of the d mod q-1 CRT coefficient. (This is the same as qLen.)
d mod q-1 CRT coefficient.
The length (in bytes) of q inverse mod p CRT coefficient. (This is the same as pLen.)
q inverse mod p CRT coefficient.
A global context.
The following values and their lengths can be retrieved from an RSA private key: n, d, p, q, d mod p-1, d mod q-1, q inverse mod p.
The following values and their lengths can be retrieved from an RSA public key: n, e.
If the prime factors p and q were generated or computed by the library, this function will return the primes such that p is numerically greater or equal to q. Otherwise, if these primes were supplied during key setting, this function will return them as given.
If the length of a key data value is known, a pointer to a buffer large enough to hold the key data value should be passed in the appropriate argument and its length in the corresponding length argument. This function will copy the value into the buffer and set the actual length of the value in the length argument.
If key value buffer is NULL, then this function will set the correct length of the key value in the length argument. If the buffer is not NULL but buffer length is too small, this function will return an error.
Set both the parameter argument and its length to NULL for any parameters that are to be ignored.
The rsaParams object is NULL.
The tag for the params object is not of the expected type.
Both the private key and public key objects are NULL.
The private key object is invalid.
The public key object is invalid.
The private exponent (d) is not exportable.
The CRT components (p, q, d mod p-1, d mod q-1, q inverse mod p) cannot be retrieved.
Success.