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