template class xf::security::rsa

#include "asymmetric.hpp"

Overview

RSA encryption/decryption class.

Parameters:

N BitWdith of modulus of key.
L BitWdith of exponents of RSA encryption and decryption
template <
    int N,
    int L
    >
class rsa

// fields

ap_uint <L> exponent
ap_uint <N> modulus
ap_uint <N> rMod

Methods

updateKey

updateKey overload (1)

void updateKey (
    ap_uint <N> inputModulus,
    ap_uint <L> inputExponent
    )

Update key before use it to encrypt message.

Parameters:

inputModulus Modulus in RSA public key.
inputExponent Exponent in RSA public key or private key.

updateKey overload (2)

void updateKey (
    ap_uint <N> inputModulus,
    ap_uint <L> inputExponent,
    ap_uint <N> inputRMod
    )

Update key before use it to encrypt message.

Parameters:

inputModulus Modulus in RSA public key.
inputExponent Exponent in RSA public key or private key.
inputRMod 2^(2 * N) mod modulus, pre-calculated by user

process

void process (
    ap_uint <N> message,
    ap_uint <N>& result
    )

Encrypt message and get result. It does not include any padding scheme.

Parameters:

message Message to be encrypted/decrypted
result Generated encrypted/decrypted result.