pub unsafe extern "C" fn ocrypto_rsa_pkcs1_v15_encrypt(
    c: *mut u8,
    c_len: usize,
    m: *const u8,
    m_len: usize,
    seed: *const u8,
    s_len: usize,
    pk: *const ocrypto_rsa_pub_key,
    mem: *mut u32
) -> c_int
Expand description

RSA operations.

This group of functions is used for RSA with padding. / /@{*/ / RSA PKCS1 V1.5 encryption.

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

  • c - The generated ciphertext.
  • c_len - Length of * c - .
  • m - The message to be encrypted.
  • m_len - Length of * m - . 0 <= m_len <= key-size - 11.
  • seed - The random seed to be used for the padding.
  • s_len - Length of * seed - . * s_len - >= key-size - 3 - * m_len -
  • pk - A valid RSA public key.
  • mem - The working memory. Length OCRYPTO_RSA_PUB_MEM_SIZE(bits).

Returns -1 If the message is too long (m_len > key-size - 11). Returns -2 If the seed is too short (s_len < key-size - 3 - m_len). Returns 0 On success.

@remark The key * pk - should be initialized with * ocrypto_rsa_init_pub_key - . @remark The * seed - should consist of non-zero random bytes. @remark * c - may be same as * m - or * mem - .