Skip to content

Latest commit

 

History

History
50 lines (31 loc) · 1.01 KB

GUID-3ABC8F43-A362-4959-8705-47CAB2EDA112.md

File metadata and controls

50 lines (31 loc) · 1.01 KB

CRYPT_RSA_EncryptSizeGet Function

Parent topic:MPLAB® Harmony Crypto Library

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

Parameters Description
rsa Pointer 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);