diff options
Diffstat (limited to 'src/lib/libcrypto/doc/EVP_PKEY_verify_recover.pod')
| -rw-r--r-- | src/lib/libcrypto/doc/EVP_PKEY_verify_recover.pod | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/src/lib/libcrypto/doc/EVP_PKEY_verify_recover.pod b/src/lib/libcrypto/doc/EVP_PKEY_verify_recover.pod deleted file mode 100644 index 095e53ea2f..0000000000 --- a/src/lib/libcrypto/doc/EVP_PKEY_verify_recover.pod +++ /dev/null | |||
| @@ -1,105 +0,0 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | EVP_PKEY_verify_recover_init, EVP_PKEY_verify_recover - recover signature using | ||
| 6 | a public key algorithm | ||
| 7 | |||
| 8 | =head1 SYNOPSIS | ||
| 9 | |||
| 10 | #include <openssl/evp.h> | ||
| 11 | |||
| 12 | int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); | ||
| 13 | int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, | ||
| 14 | unsigned char *rout, size_t *routlen, | ||
| 15 | const unsigned char *sig, size_t siglen); | ||
| 16 | |||
| 17 | =head1 DESCRIPTION | ||
| 18 | |||
| 19 | The EVP_PKEY_verify_recover_init() function initializes a public key algorithm | ||
| 20 | context using key B<pkey> for a verify recover operation. | ||
| 21 | |||
| 22 | The EVP_PKEY_verify_recover() function recovers signed data | ||
| 23 | using B<ctx>. The signature is specified using the B<sig> and | ||
| 24 | B<siglen> parameters. If B<rout> is B<NULL> then the maximum size of the output | ||
| 25 | buffer is written to the B<routlen> parameter. If B<rout> is not B<NULL> then | ||
| 26 | before the call the B<routlen> parameter should contain the length of the | ||
| 27 | B<rout> buffer, if the call is successful recovered data is written to | ||
| 28 | B<rout> and the amount of data written to B<routlen>. | ||
| 29 | |||
| 30 | =head1 NOTES | ||
| 31 | |||
| 32 | Normally an application is only interested in whether a signature verification | ||
| 33 | operation is successful in those cases the EVP_verify() function should be | ||
| 34 | used. | ||
| 35 | |||
| 36 | Sometimes however it is useful to obtain the data originally signed using a | ||
| 37 | signing operation. Only certain public key algorithms can recover a signature | ||
| 38 | in this way (for example RSA in PKCS padding mode). | ||
| 39 | |||
| 40 | After the call to EVP_PKEY_verify_recover_init() algorithm specific control | ||
| 41 | operations can be performed to set any appropriate parameters for the | ||
| 42 | operation. | ||
| 43 | |||
| 44 | The function EVP_PKEY_verify_recover() can be called more than once on the same | ||
| 45 | context if several operations are performed using the same parameters. | ||
| 46 | |||
| 47 | =head1 RETURN VALUES | ||
| 48 | |||
| 49 | EVP_PKEY_verify_recover_init() and EVP_PKEY_verify_recover() return 1 for | ||
| 50 | success | ||
| 51 | and 0 or a negative value for failure. In particular a return value of -2 | ||
| 52 | indicates the operation is not supported by the public key algorithm. | ||
| 53 | |||
| 54 | =head1 EXAMPLE | ||
| 55 | |||
| 56 | Recover digest originally signed using PKCS#1 and SHA256 digest: | ||
| 57 | |||
| 58 | #include <openssl/evp.h> | ||
| 59 | #include <openssl/rsa.h> | ||
| 60 | |||
| 61 | EVP_PKEY_CTX *ctx; | ||
| 62 | unsigned char *rout, *sig; | ||
| 63 | size_t routlen, siglen; | ||
| 64 | EVP_PKEY *verify_key; | ||
| 65 | /* NB: assumes verify_key, sig and siglen are already set up | ||
| 66 | * and that verify_key is an RSA public key | ||
| 67 | */ | ||
| 68 | ctx = EVP_PKEY_CTX_new(verify_key); | ||
| 69 | if (!ctx) | ||
| 70 | /* Error occurred */ | ||
| 71 | if (EVP_PKEY_verify_recover_init(ctx) <= 0) | ||
| 72 | /* Error */ | ||
| 73 | if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0) | ||
| 74 | /* Error */ | ||
| 75 | if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0) | ||
| 76 | /* Error */ | ||
| 77 | |||
| 78 | /* Determine buffer length */ | ||
| 79 | if (EVP_PKEY_verify_recover(ctx, NULL, &routlen, sig, siglen) <= 0) | ||
| 80 | /* Error */ | ||
| 81 | |||
| 82 | rout = malloc(routlen); | ||
| 83 | |||
| 84 | if (!rout) | ||
| 85 | /* malloc failure */ | ||
| 86 | |||
| 87 | if (EVP_PKEY_verify_recover(ctx, rout, &routlen, sig, siglen) <= 0) | ||
| 88 | /* Error */ | ||
| 89 | |||
| 90 | /* Recovered data is routlen bytes written to buffer rout */ | ||
| 91 | |||
| 92 | =head1 SEE ALSO | ||
| 93 | |||
| 94 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
| 95 | L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>, | ||
| 96 | L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>, | ||
| 97 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
| 98 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
| 99 | L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)> | ||
| 100 | |||
| 101 | =head1 HISTORY | ||
| 102 | |||
| 103 | These functions were first added to OpenSSL 1.0.0. | ||
| 104 | |||
| 105 | =cut | ||
