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