summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/RSA_check_key.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_check_key.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_check_key.3')
-rw-r--r--src/lib/libcrypto/man/RSA_check_key.397
1 files changed, 97 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/RSA_check_key.3 b/src/lib/libcrypto/man/RSA_check_key.3
new file mode 100644
index 0000000000..c57ed4b4db
--- /dev/null
+++ b/src/lib/libcrypto/man/RSA_check_key.3
@@ -0,0 +1,97 @@
1.Dd $Mdocdate: November 4 2016 $
2.Dt RSA_CHECK_KEY 3
3.Os
4.Sh NAME
5.Nm RSA_check_key
6.Nd validate private RSA keys
7.Sh SYNOPSIS
8.In openssl/rsa.h
9.Ft int
10.Fo RSA_check_key
11.Fa "RSA *rsa"
12.Fc
13.Sh DESCRIPTION
14This function validates RSA keys.
15It checks that
16.Fa rsa->p
17and
18.Fa rsa->q
19are in fact prime, and that
20.Fa rsa->n
21satifies n = p*q.
22.Pp
23It also checks that
24.Fa rsa->d
25and
26.Fa rsa->e
27satisfy d*e = 1 mod ((p-1)*(q-1)),
28and that
29.Fa rsa->dmp1 ,
30.Fa rsa->dmq1 ,
31and
32.Fa resa->iqmp
33are set correctly or are
34.Dv NULL .
35.Pp
36As such, this function cannot be used with any arbitrary
37.Vt RSA
38key object, even if it is otherwise fit for regular RSA operation.
39.Pp
40This function does not work on RSA public keys that have only the
41modulus and public exponent elements populated.
42It performs integrity checks on all the RSA key material, so the
43.Vt RSA
44key structure must contain all the private key data too.
45.Pp
46Unlike most other RSA functions, this function does
47.Sy not
48work transparently with any underlying
49.Vt ENGINE
50implementation because it uses the key data in the
51.Vt RSA
52structure directly.
53An
54.Vt ENGINE
55implementation can override the way key data is stored and handled,
56and can even provide support for HSM keys - in which case the
57.Vt RSA
58structure may contain
59.Sy no
60key data at all!
61If the
62.Vt ENGINE
63in question is only being used for acceleration or analysis purposes,
64then in all likelihood the RSA key data is complete and untouched,
65but this can't be assumed in the general case.
66.Sh RETURN VALUE
67.Fn RSA_check_key
68returns 1 if
69.Fa rsa
70is a valid RSA key, and 0 otherwise.
71-1 is returned if an error occurs while checking the key.
72.Pp
73If the key is invalid or an error occurred, the reason code can be
74obtained using
75.Xr ERR_get_error 3 .
76.Sh SEE ALSO
77.Xr ERR_get_error 3 ,
78.Xr rsa 3
79.Sh HISTORY
80.Fn RSA_check_key
81appeared in OpenSSL 0.9.4.
82.Sh BUGS
83A method of verifying the RSA key using opaque RSA API functions might
84need to be considered.
85Right now
86.Fn RSA_check_key
87simply uses the
88.Vt RSA
89structure elements directly, bypassing the
90.Vt RSA_METHOD
91table altogether (and completely violating encapsulation and
92object-orientation in the process).
93The best fix will probably be to introduce a check_key() handler
94to the
95.Vt RSA_METHOD
96function table so that alternative implementations can also provide
97their own verifiers.