1.34 CRYPT_RSA_EncryptSizeGet Function

C

int CRYPT_RSA_EncryptSizeGet(
    CRYPT_RSA_CTX* rsa
);

Description

This function retrieves the size of the RSA key in use for the context.

Preconditions

The context must be initialized with a call to CRYPT_RSA_Initialize and the keys decoded either with CRYPT_RSA_PrivateKeyDecode or CRYPT_RSA_PublicKeyDecode.

Parameters

ParametersDescription
rsaPointer to context which saves state between calls.

Returns

  • BAD_FUNC_ARG - An invalid pointer was passed to the function.

  • int - Size of the key.

Remarks

None.

Example

CRYPT_RSA_CTX mcRsa;
int           ret;
unsigned int  keySz = (unsigned int)sizeof(client_key_der_1024);
byte          out1[256];

ret = CRYPT_RSA_Initialize(&mcRsa);
ret = CRYPT_RSA_PrivateKeyDecode(&mcRsa, client_key_der_1024, keySz);
ret = CRYPT_RSA_EncryptSizeGet(&mcRsa);