blob: 60df7792cb21bfad4231cfc4d0b57cdfcc37d59d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
.\" $OpenBSD: RC4.3,v 1.2 2016/11/06 15:52:50 jmc Exp $
.\"
.Dd $Mdocdate: November 6 2016 $
.Dt RC4 3
.Os
.Sh NAME
.Nm RC4_set_key ,
.Nm RC4
.Nd RC4 encryption
.Sh SYNOPSIS
.In openssl/rc4.h
.Ft void
.Fo RC4_set_key
.Fa "RC4_KEY *key"
.Fa "int len"
.Fa "const unsigned char *data"
.Fc
.Ft void
.Fo RC4
.Fa "RC4_KEY *key"
.Fa "unsigned long len"
.Fa "const unsigned char *indata"
.Fa "unsigned char *outdata"
.Fc
.Sh DESCRIPTION
This library implements the alleged RC4 cipher, which is described for
example in
.%B Applied Cryptography .
It is believed to be compatible with RC4[TM], a proprietary cipher of
RSA Security Inc.
.Pp
RC4 is a stream cipher with variable key length.
Typically, 128 bit (16 byte) keys are used for strong encryption, but
shorter insecure key sizes have been widely used due to export
restrictions.
.Pp
RC4 consists of a key setup phase and the actual encryption or
decryption phase.
.Pp
.Fn RC4_set_key
sets up the
.Vt RC4_KEY
.Fa key
using the
.Fa len
bytes long key at
.Fa data .
.Pp
.Fn RC4
encrypts or decrypts the
.Fa len
bytes of data at
.Fa indata
using
.Fa key
and places the result at
.Fa outdata .
Repeated
.Fn RC4
calls with the same
.Fa key
yield a continuous key stream.
.Pp
Since RC4 is a stream cipher (the input is XOR'ed with a pseudo-random
key stream to produce the output), decryption uses the same function
calls as encryption.
.Sh RETURN VALUES
.Fn RC4_set_key
and
.Fn RC4
do not return values.
.Sh SEE ALSO
.Xr blowfish 3 ,
.Xr EVP_EncryptInit 3
.Sh HISTORY
.Fn RC4_set_key
and
.Fn RC4
are available in all versions of SSLeay and OpenSSL.
.Sh BUGS
This cipher is broken and should no longer be used.
|