nrfxlib API 2.7.99
Loading...
Searching...
No Matches

◆ ocrypto_rsa_pkcs1_v15_encrypt()

int ocrypto_rsa_pkcs1_v15_encrypt ( uint8_t *  c,
size_t  c_len,
const uint8_t *  m,
size_t  m_len,
const uint8_t *  seed,
size_t  s_len,
const ocrypto_rsa_pub_key pk,
uint32_t *  mem 
)

#include <crypto/nrf_oberon/include/ocrypto_rsa_operations.h>

RSA PKCS1 V1.5 encryption.

The message m is encrypted to a ciphertext returned in c.

Parameters
[out]cThe generated ciphertext.
c_lenLength of c.
mThe message to be encrypted.
m_lenLength of m. 0 <= m_len <= key-size - 11.
seedThe random seed to be used for the padding.
s_lenLength of seed. s_len >= key-size - 3 - m_len
pkA valid RSA public key.
memThe working memory. Length OCRYPTO_RSA_PUB_MEM_SIZE(bits).
Return values
-1If the message is too long (m_len > key-size - 11).
-2If the seed is too short (s_len < key-size - 3 - m_len).
0On success.
Remarks
The key pk should be initialized with ocrypto_rsa_init_pub_key.
The seed should consist of non-zero random bytes.
c may be same as m or mem.