xref: /freebsd/crypto/openssl/doc/man3/RC4_set_key.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
5e71b7053SJung-uk KimRC4_set_key, RC4 - RC4 encryption
6e71b7053SJung-uk Kim
7e71b7053SJung-uk Kim=head1 SYNOPSIS
8e71b7053SJung-uk Kim
9e71b7053SJung-uk Kim #include <openssl/rc4.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 void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);
16e71b7053SJung-uk Kim
17e71b7053SJung-uk Kim void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
18e71b7053SJung-uk Kim          unsigned char *outdata);
19e71b7053SJung-uk Kim
20e71b7053SJung-uk Kim=head1 DESCRIPTION
21e71b7053SJung-uk Kim
22*b077aed3SPierre ProncheryAll of the functions described on this page are deprecated. Applications should
23*b077aed3SPierre Proncheryinstead use L<EVP_EncryptInit_ex(3)>, L<EVP_EncryptUpdate(3)> and
24*b077aed3SPierre ProncheryL<EVP_EncryptFinal_ex(3)> or the equivalently named decrypt functions.
25*b077aed3SPierre Pronchery
26e71b7053SJung-uk KimThis library implements the Alleged RC4 cipher, which is described for
27e71b7053SJung-uk Kimexample in I<Applied Cryptography>.  It is believed to be compatible
28e71b7053SJung-uk Kimwith RC4[TM], a proprietary cipher of RSA Security Inc.
29e71b7053SJung-uk Kim
30e71b7053SJung-uk KimRC4 is a stream cipher with variable key length.  Typically, 128 bit
31e71b7053SJung-uk Kim(16 byte) keys are used for strong encryption, but shorter insecure
32e71b7053SJung-uk Kimkey sizes have been widely used due to export restrictions.
33e71b7053SJung-uk Kim
34e71b7053SJung-uk KimRC4 consists of a key setup phase and the actual encryption or
35e71b7053SJung-uk Kimdecryption phase.
36e71b7053SJung-uk Kim
37e71b7053SJung-uk KimRC4_set_key() sets up the B<RC4_KEY> B<key> using the B<len> bytes long
38e71b7053SJung-uk Kimkey at B<data>.
39e71b7053SJung-uk Kim
40e71b7053SJung-uk KimRC4() encrypts or decrypts the B<len> bytes of data at B<indata> using
41e71b7053SJung-uk KimB<key> and places the result at B<outdata>.  Repeated RC4() calls with
42e71b7053SJung-uk Kimthe same B<key> yield a continuous key stream.
43e71b7053SJung-uk Kim
44e71b7053SJung-uk KimSince RC4 is a stream cipher (the input is XORed with a pseudo-random
45e71b7053SJung-uk Kimkey stream to produce the output), decryption uses the same function
46e71b7053SJung-uk Kimcalls as encryption.
47e71b7053SJung-uk Kim
48e71b7053SJung-uk Kim=head1 RETURN VALUES
49e71b7053SJung-uk Kim
50e71b7053SJung-uk KimRC4_set_key() and RC4() do not return values.
51e71b7053SJung-uk Kim
52e71b7053SJung-uk Kim=head1 NOTE
53e71b7053SJung-uk Kim
54e71b7053SJung-uk KimApplications should use the higher level functions
55e71b7053SJung-uk KimL<EVP_EncryptInit(3)> etc. instead of calling these
56e71b7053SJung-uk Kimfunctions directly.
57e71b7053SJung-uk Kim
58e71b7053SJung-uk KimIt is difficult to securely use stream ciphers. For example, do not perform
59e71b7053SJung-uk Kimmultiple encryptions using the same key stream.
60e71b7053SJung-uk Kim
61e71b7053SJung-uk Kim=head1 SEE ALSO
62e71b7053SJung-uk Kim
63e71b7053SJung-uk KimL<EVP_EncryptInit(3)>
64e71b7053SJung-uk Kim
65*b077aed3SPierre Pronchery=head1 HISTORY
66*b077aed3SPierre Pronchery
67*b077aed3SPierre ProncheryAll of these functions were deprecated in OpenSSL 3.0.
68*b077aed3SPierre Pronchery
69e71b7053SJung-uk Kim=head1 COPYRIGHT
70e71b7053SJung-uk Kim
71*b077aed3SPierre ProncheryCopyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
72e71b7053SJung-uk Kim
73*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
74e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
75e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
76e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
77e71b7053SJung-uk Kim
78e71b7053SJung-uk Kim=cut
79