Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

rsa.h File Reference

RSA algorithm. More...

#include "rsakp.h"

Go to the source code of this file.

Functions

int rsapub (const rsapk *pk, const mpnumber *m, mpnumber *c)
 This function performs a raw RSA public key operation.

int rsapri (const rsakp *kp, const mpnumber *c, mpnumber *m)
 This function performs a raw RSA private key operation.

int rsapricrt (const rsakp *kp, const mpnumber *c, mpnumber *m)
 This function performs a raw RSA private key operation, with application of the Chinese Remainder Theorem.

int rsavrfy (const rsapk *pk, const mpnumber *m, const mpnumber *c)
 This function performs a raw RSA verification.


Detailed Description

RSA algorithm.

Author:
Bob Deblier <bob.deblier@pandora.be>

Definition in file rsa.h.


Function Documentation

int rsapri const rsakp kp,
const mpnumber c,
mpnumber m
 

This function performs a raw RSA private key operation.

This function can be used for decryption and signing.

It performs the operation:

  • $m=c^{d}\ \textrm{mod}\ n$
Parameters:
kp The RSA keypair.
c The ciphertext.
m The message.
Return values:
0 on success.
-1 on failure.

int rsapricrt const rsakp kp,
const mpnumber c,
mpnumber m
 

This function performs a raw RSA private key operation, with application of the Chinese Remainder Theorem.

It performs the operation:

  • $j_1=c^{d_1}\ \textrm{mod}\ p$
  • $j_2=c^{d_2}\ \textrm{mod}\ q$
  • $h=c \cdot (j_1-j_2)\ \textrm{mod}\ p$
  • $m=j_2+hq$
Parameters:
kp The RSA keypair.
c The ciphertext.
m The message.
Return values:
0 on success.
-1 on failure.

int rsapub const rsapk pk,
const mpnumber m,
mpnumber c
 

This function performs a raw RSA public key operation.

This function can be used for encryption and verifying.

It performs the following operation:

  • $c=m^{e}\ \textrm{mod}\ n$
Parameters:
pk The RSA public key.
m The message.
c The ciphertext.
Return values:
0 on success.
-1 on failure.

int rsavrfy const rsapk pk,
const mpnumber m,
const mpnumber c
 

This function performs a raw RSA verification.

It verifies if ciphertext c was encrypted from cleartext m with the private key matching the given public key pk.

Parameters:
pk The public key.
m The cleartext message.
c The ciphertext message.
Return values:
1 on success.
0 on failure.


Generated on Wed Mar 24 13:56:54 2004 for BeeCrypt by doxygen 1.3.6