]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - crypto/openssl/doc/crypto/RSA_check_key.pod
Import of OpenSSL 0.9.6e.
[FreeBSD/FreeBSD.git] / crypto / openssl / doc / crypto / RSA_check_key.pod
1 =pod
2
3 =head1 NAME
4
5 RSA_check_key - validate private RSA keys
6
7 =head1 SYNOPSIS
8
9  #include <openssl/rsa.h>
10
11  int RSA_check_key(RSA *rsa);
12
13 =head1 DESCRIPTION
14
15 This function validates RSA keys. It checks that B<p> and B<q> are
16 in fact prime, and that B<n = p*q>.
17
18 It also checks that B<d*e = 1 mod (p-1*q-1)>,
19 and that B<dmp1>, B<dmq1> and B<iqmp> are set correctly or are B<NULL>.
20
21 As such, this function can not be used with any arbitrary RSA key object,
22 even if it is otherwise fit for regular RSA operation. See B<NOTES> for more
23 information.
24
25 =head1 RETURN VALUE
26
27 RSA_check_key() returns 1 if B<rsa> is a valid RSA key, and 0 otherwise.
28 -1 is returned if an error occurs while checking the key.
29
30 If the key is invalid or an error occurred, the reason code can be
31 obtained using L<ERR_get_error(3)|ERR_get_error(3)>.
32
33 =head1 NOTES
34
35 This function does not work on RSA public keys that have only the modulus
36 and public exponent elements populated. It performs integrity checks on all
37 the RSA key material, so the RSA key structure must contain all the private
38 key data too.
39
40 =head1 SEE ALSO
41
42 L<rsa(3)|rsa(3)>, L<err(3)|err(3)>
43
44 =head1 HISTORY
45
46 RSA_check() appeared in OpenSSL 0.9.4.
47
48 =cut