summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/rsa.3
diff options
context:
space:
mode:
authorschwarze <>2016-11-04 10:17:17 +0000
committerschwarze <>2016-11-04 10:17:17 +0000
commit195fe5e91c60bd205043b4bea113abdff1c67bcc (patch)
tree1d15fe02d83a7ffb422ebe78c34ee1117da63e59 /src/lib/libcrypto/man/rsa.3
parent00872265b9546fcf2d5795aa3a120c35142d268b (diff)
downloadopenbsd-195fe5e91c60bd205043b4bea113abdff1c67bcc.tar.gz
openbsd-195fe5e91c60bd205043b4bea113abdff1c67bcc.tar.bz2
openbsd-195fe5e91c60bd205043b4bea113abdff1c67bcc.zip
convert RSA manuals from pod to mdoc
Diffstat (limited to 'src/lib/libcrypto/man/rsa.3')
-rw-r--r--src/lib/libcrypto/man/rsa.3238
1 files changed, 238 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/rsa.3 b/src/lib/libcrypto/man/rsa.3
new file mode 100644
index 0000000000..7c34f3595b
--- /dev/null
+++ b/src/lib/libcrypto/man/rsa.3
@@ -0,0 +1,238 @@
1.Dd $Mdocdate: November 4 2016 $
2.Dt RSA 3
3.Os
4.Sh NAME
5.Nm rsa
6.Nd RSA public key cryptosystem
7.Sh SYNOPSIS
8.In openssl/rsa.h
9.In openssl/engine.h
10.Ft RSA *
11.Fn RSA_new void
12.Ft void
13.Fo RSA_free
14.Fa "RSA *rsa"
15.Fc
16.Ft int
17.Fo RSA_public_encrypt
18.Fa "int flen"
19.Fa "unsigned char *from"
20.Fa "unsigned char *to"
21.Fa "RSA *rsa"
22.Fa "int padding"
23.Fc
24.Ft int
25.Fo RSA_private_decrypt
26.Fa "int flen"
27.Fa "unsigned char *from"
28.Fa "unsigned char *to"
29.Fa "RSA *rsa"
30.Fa "int padding"
31.Fc
32.Ft int
33.Fo RSA_private_encrypt
34.Fa "int flen"
35.Fa "unsigned char *from"
36.Fa "unsigned char *to"
37.Fa "RSA *rsa"
38.Fa "int padding"
39.Fc
40.Ft int
41.Fo RSA_public_decrypt
42.Fa "int flen"
43.Fa "unsigned char *from"
44.Fa "unsigned char *to"
45.Fa "RSA *rsa"
46.Fa "int padding"
47.Fc
48.Ft int
49.Fo RSA_sign
50.Fa "int type"
51.Fa "unsigned char *m"
52.Fa "unsigned int m_len"
53.Fa "unsigned char *sigret"
54.Fa "unsigned int *siglen"
55.Fa "RSA *rsa"
56.Fc
57.Ft int
58.Fo RSA_verify
59.Fa "int type"
60.Fa "unsigned char *m"
61.Fa "unsigned int m_len"
62.Fa "unsigned char *sigbuf"
63.Fa "unsigned int siglen"
64.Fa "RSA *rsa"
65.Fc
66.Ft int
67.Fo RSA_size
68.Fa "const RSA *rsa"
69.Fc
70.Ft RSA *
71.Fo RSA_generate_key
72.Fa "int num"
73.Fa "unsigned long e"
74.Fa "void (*callback)(int, int, void *)"
75.Fa "void *cb_arg"
76.Fc
77.Ft int
78.Fo RSA_check_key
79.Fa "RSA *rsa"
80.Fc
81.Ft int
82.Fo RSA_blinding_on
83.Fa "RSA *rsa"
84.Fa "BN_CTX *ctx"
85.Fc
86.Ft void
87.Fo RSA_blinding_off
88.Fa "RSA *rsa"
89.Fc
90.Ft void
91.Fo RSA_set_default_method
92.Fa "const RSA_METHOD *meth"
93.Fc
94.Ft const RSA_METHOD *
95.Fn RSA_get_default_method void
96.Ft int
97.Fo RSA_set_method
98.Fa "RSA *rsa"
99.Fa "const RSA_METHOD *meth"
100.Fc
101.Ft const RSA_METHOD *
102.Fo RSA_get_method
103.Fa "const RSA *rsa"
104.Fc
105.Ft RSA_METHOD *
106.Fn RSA_PKCS1_SSLeay void
107.Ft RSA_METHOD *
108.Fn RSA_null_method void
109.Ft int
110.Fo RSA_flags
111.Fa "const RSA *rsa"
112.Fc
113.Ft RSA *
114.Fo RSA_new_method
115.Fa "ENGINE *engine"
116.Fc
117.Ft int
118.Fo RSA_print
119.Fa "BIO *bp"
120.Fa "RSA *x"
121.Fa "int offset"
122.Fc
123.Ft int
124.Fo RSA_print_fp
125.Fa "FILE *fp"
126.Fa "RSA *x"
127.Fa "int offset"
128.Fc
129.Ft int
130.Fo RSA_get_ex_new_index
131.Fa "long argl"
132.Fa "char *argp"
133.Fa "int (*new_func)()"
134.Fa "int (*dup_func)()"
135.Fa "void (*free_func)()"
136.Fc
137.Ft int
138.Fo RSA_set_ex_data
139.Fa "RSA *r"
140.Fa "int idx"
141.Fa "char *arg"
142.Fc
143.Ft char *
144.Fo RSA_get_ex_data
145.Fa "RSA *r"
146.Fa "int idx"
147.Fc
148.Ft int
149.Fo RSA_sign_ASN1_OCTET_STRING
150.Fa "int dummy"
151.Fa "unsigned char *m"
152.Fa "unsigned int m_len"
153.Fa "unsigned char *sigret"
154.Fa "unsigned int *siglen"
155.Fa "RSA *rsa"
156.Fc
157.Ft int
158.Fo RSA_verify_ASN1_OCTET_STRING
159.Fa "int dummy"
160.Fa "unsigned char *m"
161.Fa "unsigned int m_len"
162.Fa "unsigned char *sigbuf"
163.Fa "unsigned int siglen"
164.Fa "RSA *rsa"
165.Fc
166.Sh DESCRIPTION
167These functions implement RSA public key encryption and signatures as
168defined in PKCS #1 v2.0 [RFC 2437].
169.Pp
170The
171.Vt RSA
172structure consists of several BIGNUM components.
173It can contain public as well as private RSA keys:
174.Bd -literal
175typdef struct {
176 BIGNUM *n; // public modulus
177 BIGNUM *e; // public exponent
178 BIGNUM *d; // private exponent
179 BIGNUM *p; // secret prime factor
180 BIGNUM *q; // secret prime factor
181 BIGNUM *dmp1; // d mod (p-1)
182 BIGNUM *dmq1; // d mod (q-1)
183 BIGNUM *iqmp; // q^-1 mod p
184 // ...
185} RSA;
186.Ed
187.Pp
188In public keys, the private exponent and the related secret values are
189.Dv NULL .
190.Pp
191.Fa p ,
192.Fa q ,
193.Fa dmp1 ,
194.Fa dmq1 ,
195and
196.Fa iqmp
197may be
198.Dv NULL
199in private keys, but the RSA operations are much faster when these
200values are available.
201.Pp
202Note that RSA keys may use non-standard
203.Vt RSA_METHOD
204implementations, either directly or by the use of
205.Vt ENGINE
206modules.
207In some cases (eg. an
208.Vt ENGINE
209providing support for hardware-embedded keys), these
210.Vt BIGNUM
211values will not be used by the implementation or may be used for
212alternative data storage.
213For this reason, applications should generally avoid using
214.Vt RSA
215structure elements directly and instead use API functions to query
216or modify keys.
217.Sh SEE ALSO
218.Xr bn 3 ,
219.Xr dh 3 ,
220.Xr dsa 3 ,
221.Xr engine 3 ,
222.Xr RSA_blinding_on 3 ,
223.Xr RSA_check_key 3 ,
224.Xr RSA_generate_key 3 ,
225.Xr RSA_get_ex_new_index 3 ,
226.Xr RSA_new 3 ,
227.Xr RSA_padding_add_PKCS1_type_1 3 ,
228.Xr RSA_print 3 ,
229.Xr RSA_private_encrypt 3 ,
230.Xr RSA_public_encrypt 3 ,
231.Xr RSA_set_method 3 ,
232.Xr RSA_sign 3 ,
233.Xr RSA_sign_ASN1_OCTET_STRING 3 ,
234.Xr RSA_size 3
235.Sh STANDARDS
236SSL, PKCS #1 v2.0
237.Pp
238RSA was covered by a US patent which expired in September 2000.