Home | History | Annotate | Line # | Download | only in man3
      1 =pod
      2 
      3 =head1 NAME
      4 
      5 RSA_private_encrypt, RSA_public_decrypt - low-level signature operations
      6 
      7 =head1 SYNOPSIS
      8 
      9  #include <openssl/rsa.h>
     10 
     11 The following functions have been deprecated since OpenSSL 3.0, and can be
     12 hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
     13 see L<openssl_user_macros(7)>:
     14 
     15  int RSA_private_encrypt(int flen, unsigned char *from,
     16                          unsigned char *to, RSA *rsa, int padding);
     17 
     18  int RSA_public_decrypt(int flen, unsigned char *from,
     19                         unsigned char *to, RSA *rsa, int padding);
     20 
     21 =head1 DESCRIPTION
     22 
     23 Both of the functions described on this page are deprecated.
     24 Applications should instead use L<EVP_PKEY_sign_init_ex(3)>,
     25 L<EVP_PKEY_sign(3)>, L<EVP_PKEY_verify_recover_init(3)>, and
     26 L<EVP_PKEY_verify_recover(3)>.
     27 
     28 These functions handle RSA signatures at a low-level.
     29 
     30 RSA_private_encrypt() signs the B<flen> bytes at B<from> (usually a
     31 message digest with an algorithm identifier) using the private key
     32 B<rsa> and stores the signature in B<to>. B<to> must point to
     33 B<RSA_size(rsa)> bytes of memory.
     34 
     35 B<padding> denotes one of the following modes:
     36 
     37 =over 4
     38 
     39 =item RSA_PKCS1_PADDING
     40 
     41 PKCS #1 v1.5 padding. This function does not handle the
     42 B<algorithmIdentifier> specified in PKCS #1. When generating or
     43 verifying PKCS #1 signatures, L<RSA_sign(3)> and L<RSA_verify(3)> should be
     44 used.
     45 
     46 =item RSA_NO_PADDING
     47 
     48 Raw RSA signature. This mode should I<only> be used to implement
     49 cryptographically sound padding modes in the application code.
     50 Signing user data directly with RSA is insecure.
     51 
     52 =back
     53 
     54 RSA_public_decrypt() recovers the message digest from the B<flen>
     55 bytes long signature at B<from> using the signer's public key
     56 B<rsa>. B<to> must point to a memory section large enough to hold the
     57 message digest (which is smaller than B<RSA_size(rsa) -
     58 11>). B<padding> is the padding mode that was used to sign the data.
     59 
     60 =head1 RETURN VALUES
     61 
     62 RSA_private_encrypt() returns the size of the signature (i.e.,
     63 RSA_size(rsa)). RSA_public_decrypt() returns the size of the
     64 recovered message digest.
     65 
     66 On error, -1 is returned; the error codes can be
     67 obtained by L<ERR_get_error(3)>.
     68 
     69 =head1 SEE ALSO
     70 
     71 L<ERR_get_error(3)>,
     72 L<RSA_sign(3)>, L<RSA_verify(3)>,
     73 L<EVP_PKEY_sign(3)>, L<EVP_PKEY_verify_recover(3)>
     74 
     75 =head1 HISTORY
     76 
     77 Both of these functions were deprecated in OpenSSL 3.0.
     78 
     79 =head1 COPYRIGHT
     80 
     81 Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
     82 
     83 Licensed under the Apache License 2.0 (the "License").  You may not use
     84 this file except in compliance with the License.  You can obtain a copy
     85 in the file LICENSE in the source distribution or at
     86 L<https://www.openssl.org/source/license.html>.
     87 
     88 =cut
     89