Blame doc/man3/X509_sign.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
X509_sign, X509_sign_ctx, X509_verify, X509_REQ_sign, X509_REQ_sign_ctx,
Packit c4476c
X509_REQ_verify, X509_CRL_sign, X509_CRL_sign_ctx, X509_CRL_verify -
Packit c4476c
sign or verify certificate, certificate request or CRL signature
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/x509.h>
Packit c4476c
Packit c4476c
 int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
Packit c4476c
 int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);
Packit c4476c
 int X509_verify(X509 *a, EVP_PKEY *r);
Packit c4476c
Packit c4476c
 int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);
Packit c4476c
 int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);
Packit c4476c
 int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);
Packit c4476c
Packit c4476c
 int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
Packit c4476c
 int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);
Packit c4476c
 int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
X509_sign() signs certificate B<x> using private key B<pkey> and message
Packit c4476c
digest B<md> and sets the signature in B<x>. X509_sign_ctx() also signs
Packit c4476c
certificate B<x> but uses the parameters contained in digest context B<ctx>.
Packit c4476c
Packit c4476c
X509_verify() verifies the signature of certificate B<x> using public key
Packit c4476c
B<pkey>. Only the signature is checked: no other checks (such as certificate
Packit c4476c
chain validity) are performed.
Packit c4476c
Packit c4476c
X509_REQ_sign(), X509_REQ_sign_ctx(), X509_REQ_verify(),
Packit c4476c
X509_CRL_sign(), X509_CRL_sign_ctx() and X509_CRL_verify() sign and verify
Packit c4476c
certificate requests and CRLs respectively.
Packit c4476c
Packit c4476c
=head1 NOTES
Packit c4476c
Packit c4476c
X509_sign_ctx() is used where the default parameters for the corresponding
Packit c4476c
public key and digest are not suitable. It can be used to sign keys using
Packit c4476c
RSA-PSS for example.
Packit c4476c
Packit c4476c
For efficiency reasons and to work around ASN.1 encoding issues the encoding
Packit c4476c
of the signed portion of a certificate, certificate request and CRL is cached
Packit c4476c
internally. If the signed portion of the structure is modified the encoding
Packit c4476c
is not always updated meaning a stale version is sometimes used. This is not
Packit c4476c
normally a problem because modifying the signed portion will invalidate the
Packit c4476c
signature and signing will always update the encoding.
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
X509_sign(), X509_sign_ctx(), X509_REQ_sign(), X509_REQ_sign_ctx(),
Packit c4476c
X509_CRL_sign() and X509_CRL_sign_ctx() return the size of the signature
Packit c4476c
in bytes for success and zero for failure.
Packit c4476c
Packit c4476c
X509_verify(), X509_REQ_verify() and X509_CRL_verify() return 1 if the
Packit c4476c
signature is valid and 0 if the signature check fails. If the signature
Packit c4476c
could not be checked at all because it was invalid or some other error
Packit c4476c
occurred then -1 is returned.
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<d2i_X509(3)>,
Packit c4476c
L<ERR_get_error(3)>,
Packit c4476c
L<X509_CRL_get0_by_serial(3)>,
Packit c4476c
L<X509_get0_signature(3)>,
Packit c4476c
L<X509_get_ext_d2i(3)>,
Packit c4476c
L<X509_get_extension_flags(3)>,
Packit c4476c
L<X509_get_pubkey(3)>,
Packit c4476c
L<X509_get_subject_name(3)>,
Packit c4476c
L<X509_get_version(3)>,
Packit c4476c
L<X509_NAME_add_entry_by_txt(3)>,
Packit c4476c
L<X509_NAME_ENTRY_get_object(3)>,
Packit c4476c
L<X509_NAME_get_index_by_NID(3)>,
Packit c4476c
L<X509_NAME_print_ex(3)>,
Packit c4476c
L<X509_new(3)>,
Packit c4476c
L<X509V3_get_d2i(3)>,
Packit c4476c
L<X509_verify_cert(3)>
Packit c4476c
Packit c4476c
=head1 HISTORY
Packit c4476c
Packit c4476c
The X509_sign(), X509_REQ_sign() and X509_CRL_sign() functions are
Packit c4476c
available in all versions of OpenSSL.
Packit c4476c
Packit c4476c
The X509_sign_ctx(), X509_REQ_sign_ctx()
Packit c4476c
and X509_CRL_sign_ctx() functions were added OpenSSL 1.0.1.
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut