summaryrefslogtreecommitdiff
path: root/lib/libcrypto/man/rsa.3
blob: 528adb378be5ee9c1a61dbeaba6a609beff2a999 (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
82
83
84
85
.\"	$OpenBSD: rsa.3,v 1.3 2016/11/06 15:52:50 jmc Exp $
.\"
.Dd $Mdocdate: November 6 2016 $
.Dt RSA 3
.Os
.Sh NAME
.Nm rsa
.Nd RSA public key cryptosystem
.Sh SYNOPSIS
.In openssl/rsa.h
.Sh DESCRIPTION
These functions implement RSA public key encryption and signatures as
defined in PKCS #1 v2.0 [RFC 2437].
.Pp
The
.Vt RSA
structure consists of several BIGNUM components.
It can contain public as well as private RSA keys:
.Bd -literal
typdef struct {
        BIGNUM *n;		// public modulus
        BIGNUM *e;		// public exponent
        BIGNUM *d;		// private exponent
        BIGNUM *p;		// secret prime factor
        BIGNUM *q;		// secret prime factor
        BIGNUM *dmp1;		// d mod (p-1)
        BIGNUM *dmq1;		// d mod (q-1)
        BIGNUM *iqmp;		// q^-1 mod p
	// ...
} RSA;
.Ed
.Pp
In public keys, the private exponent and the related secret values are
.Dv NULL .
.Pp
.Fa p ,
.Fa q ,
.Fa dmp1 ,
.Fa dmq1 ,
and
.Fa iqmp
may be
.Dv NULL
in private keys, but the RSA operations are much faster when these
values are available.
.Pp
Note that RSA keys may use non-standard
.Vt RSA_METHOD
implementations, either directly or by the use of
.Vt ENGINE
modules.
In some cases (e.g. an
.Vt ENGINE
providing support for hardware-embedded keys), these
.Vt BIGNUM
values will not be used by the implementation or may be used for
alternative data storage.
For this reason, applications should generally avoid using
.Vt RSA
structure elements directly and instead use API functions to query
or modify keys.
.Sh SEE ALSO
.Xr bn 3 ,
.Xr d2i_RSAPublicKey 3 ,
.Xr dh 3 ,
.Xr dsa 3 ,
.Xr engine 3 ,
.Xr EVP_PKEY_set1_RSA 3 ,
.Xr RSA_blinding_on 3 ,
.Xr RSA_check_key 3 ,
.Xr RSA_generate_key 3 ,
.Xr RSA_get_ex_new_index 3 ,
.Xr RSA_new 3 ,
.Xr RSA_padding_add_PKCS1_type_1 3 ,
.Xr RSA_print 3 ,
.Xr RSA_private_encrypt 3 ,
.Xr RSA_public_encrypt 3 ,
.Xr RSA_set_method 3 ,
.Xr RSA_sign 3 ,
.Xr RSA_sign_ASN1_OCTET_STRING 3 ,
.Xr RSA_size 3
.Sh STANDARDS
SSL, PKCS #1 v2.0
.Pp
RSA was covered by a US patent which expired in September 2000.