Different RSA functions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Different RSA functions

Heinz Markgraf
Hi!

I would like to ask why there two pairs of RSA
functions. Would one not be enough?
What's the difference?


  int RSA_public_encrypt(int flen, unsigned char *from,
     unsigned char *to, RSA *rsa, int padding);
  int RSA_private_decrypt(int flen, unsigned char *from,
     unsigned char *to, RSA *rsa, int padding);
  int RSA_private_encrypt(int flen, unsigned char *from,
     unsigned char *to, RSA *rsa,int padding);
  int RSA_public_decrypt(int flen, unsigned char *from,
     unsigned char *to, RSA *rsa,int padding);


Thanks,

Heinz

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Different RSA functions

Michael Sierchio
Heinz Markgraf wrote:

> Hi!
>
> I would like to ask why there two pairs of RSA
> functions. Would one not be enough?
> What's the difference?
>
>
>  int RSA_public_encrypt(int flen, unsigned char *from,
>     unsigned char *to, RSA *rsa, int padding);
>  int RSA_private_decrypt(int flen, unsigned char *from,
>     unsigned char *to, RSA *rsa, int padding);
>  int RSA_private_encrypt(int flen, unsigned char *from,
>     unsigned char *to, RSA *rsa,int padding);
>  int RSA_public_decrypt(int flen, unsigned char *from,
>     unsigned char *to, RSA *rsa,int padding);

You may encrypt/decrypt using a private key (yours), or encrypt/decrypt
using the public key of another party.  The latter is commonly done
when verifying signatures, though encrypting with another's public
key is a common enveloping technique.


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Different RSA functions

Heinz Markgraf
Hi!

> You may encrypt/decrypt using a private key (yours), or encrypt/decrypt
> using the public key of another party.  The latter is commonly done
> when verifying signatures, though encrypting with another's public
> key is a common enveloping technique.

Hm, I still don't get the point in having four functions.

Mathematically seen there are only two different actions I can do:
either raise the 'message' x to the power of the public exponent or
to the power of the private exponent. Right?


Heinz


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Different RSA functions

Michael Sierchio
Heinz Markgraf wrote:

> Hm, I still don't get the point in having four functions.
>
> Mathematically seen there are only two different actions I can do:
> either raise the 'message' x to the power of the public exponent or
> to the power of the private exponent. Right?

Operations using private keys is fundamentally different, since the PKCS#1
private key components are present, not just the exponent.

See PKCS#1

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Different RSA functions

Nils Larsch
In reply to this post by Heinz Markgraf
Heinz Markgraf wrote:

> Hi!
>
>> You may encrypt/decrypt using a private key (yours), or encrypt/decrypt
>> using the public key of another party.  The latter is commonly done
>> when verifying signatures, though encrypting with another's public
>> key is a common enveloping technique.
>
>
> Hm, I still don't get the point in having four functions.
>
> Mathematically seen there are only two different actions I can do:
> either raise the 'message' x to the power of the public exponent or
> to the power of the private exponent. Right?

right, but different padding schemes are used for encryption
and decryption (in case padding is used).

Nils
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]