mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-06-17 18:33:39 +08:00
quantum init
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
=pod
|
||||
|
||||
=encoding utf8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
EVP_PKEY_verify_recover_init, EVP_PKEY_verify_recover - recover signature using a public key algorithm
|
||||
@@ -12,8 +10,8 @@ EVP_PKEY_verify_recover_init, EVP_PKEY_verify_recover - recover signature using
|
||||
|
||||
int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx);
|
||||
int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx,
|
||||
unsigned char *rout, size_t *routlen,
|
||||
const unsigned char *sig, size_t siglen);
|
||||
unsigned char *rout, size_t *routlen,
|
||||
const unsigned char *sig, size_t siglen);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@@ -31,7 +29,7 @@ B<rout> and the amount of data written to B<routlen>.
|
||||
=head1 NOTES
|
||||
|
||||
Normally an application is only interested in whether a signature verification
|
||||
operation is successful in those cases the EVP_verify() function should be
|
||||
operation is successful in those cases the EVP_verify() function should be
|
||||
used.
|
||||
|
||||
Sometimes however it is useful to obtain the data originally signed using a
|
||||
@@ -60,55 +58,46 @@ Recover digest originally signed using PKCS#1 and SHA256 digest:
|
||||
|
||||
EVP_PKEY_CTX *ctx;
|
||||
unsigned char *rout, *sig;
|
||||
size_t routlen, siglen;
|
||||
size_t routlen, siglen;
|
||||
EVP_PKEY *verify_key;
|
||||
/* NB: assumes verify_key, sig and siglen are already set up
|
||||
* and that verify_key is an RSA public key
|
||||
*/
|
||||
ctx = EVP_PKEY_CTX_new(verify_key);
|
||||
if (!ctx)
|
||||
/* Error occurred */
|
||||
/* Error occurred */
|
||||
if (EVP_PKEY_verify_recover_init(ctx) <= 0)
|
||||
/* Error */
|
||||
/* Error */
|
||||
if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0)
|
||||
/* Error */
|
||||
/* Error */
|
||||
if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0)
|
||||
/* Error */
|
||||
/* Error */
|
||||
|
||||
/* Determine buffer length */
|
||||
if (EVP_PKEY_verify_recover(ctx, NULL, &routlen, sig, siglen) <= 0)
|
||||
/* Error */
|
||||
/* Error */
|
||||
|
||||
rout = OPENSSL_malloc(routlen);
|
||||
|
||||
if (!rout)
|
||||
/* malloc failure */
|
||||
|
||||
/* malloc failure */
|
||||
|
||||
if (EVP_PKEY_verify_recover(ctx, rout, &routlen, sig, siglen) <= 0)
|
||||
/* Error */
|
||||
/* Error */
|
||||
|
||||
/* Recovered data is routlen bytes written to buffer rout */
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<EVP_PKEY_CTX_new(3)>,
|
||||
L<EVP_PKEY_encrypt(3)>,
|
||||
L<EVP_PKEY_decrypt(3)>,
|
||||
L<EVP_PKEY_sign(3)>,
|
||||
L<EVP_PKEY_verify(3)>,
|
||||
L<EVP_PKEY_derive(3)>
|
||||
L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
|
||||
L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>,
|
||||
L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>,
|
||||
L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
|
||||
L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
|
||||
L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
These functions were first added to OpenSSL 1.0.0.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2013-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the OpenSSL license (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
in the file LICENSE in the source distribution or at
|
||||
L<https://www.openssl.org/source/license.html>.
|
||||
|
||||
=cut
|
||||
|
||||
Reference in New Issue
Block a user