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